-
Notifications
You must be signed in to change notification settings - Fork 724
Improve Handling of MCP Tool Call Arguments #3127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me but let's wait for @hanouticelina 's review
@bot /style |
Style fixes have been applied. View the workflow run here. |
@danielholanda I'm curious about how you are using the MCP Tool. What have been your use case and how did it go so far? (trying to gather feedback from early adopters 🤗) |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, thanks @danielholanda for fixing this!
Hi @Wauplin and @hanouticelina. Congrats on the great work on My team and I own an open-source LLM serving framework called Lemonade (repo created 2 weeks ago). Our focus is local LLMs and we are doing cool things like streaming tool calls tageting onnx-runtime-genai, which afaik others are not doing yet. We are planning on hopefully publishing a Blog on AMD's developer's page on TinyAgents MCP + Lemonade in the next week or so. If you find that interesting and would like to participate or get some additional info there feel free to send me an email (see bio) so we can schedule something. :) |
* Handle empty MCP tool call arguments * Apply style fixes --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This PR handles two issues as described below.
Handle empty MCP tool call arguments
Some OpenAI-compatible providers may generate tool calls with empty arguments represented by an empty JSON object
"{}"
instead ofNone
. This PR addresses that corner case.Avoid argument duplication
The code aggregates tool call chunks by index. The first
if
checks if it's the first chunk and initializesfinal_tool_calls[tool_call.index]
with the current tool_call, including its arguments. The secondif
appends arguments regardless, causing duplication on the first chunk. Changing the secondif
toelif
ensures arguments are only appended for subsequent chunks, not during initialization.