Repository navigation
fix(mcp): accept omitted arguments for argument-free tools - #1
Draft
autoantohaki wants to merge 1 commit into
Draft
autoantohaki wants to merge 1 commit into
autoantohaki wants to merge 1 commit into
Conversation
MCP makes tools/call arguments optional, but ocr_capabilities and ocr_models only matched an explicit empty object. A call without arguments fell through to "unknown tool". Treat a missing value as no arguments, and report unexpected arguments on these tools as invalid params instead of an unknown tool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by mau
Before: an MCP
tools/callforocr_capabilitiesorocr_modelsthat omittedargumentscame back as a-32602 "unknown tool"error. MCP marksargumentsas optional, and both tools take no input, so this is a valid call. Passing unexpected arguments also reported "unknown tool".After: if
argumentsis missing, null, or{}, both tools return their normal result. If arguments are passed to these tools, the error is-32602 "invalid params", and a truly unknown tool name still reports "unknown tool".How:
is_empty_objectbecomesis_empty_arguments, which also acceptsnull, and the match arm for unexpected arguments is now separate from the unknown-tool fallback. A new test covers HTTP MCP calls with omitted, empty and non-empty arguments, plus an unknown tool name.Note: this PR changes
.rssources, so the Windows runtime qualification attestation has to be re-recorded beforeverify-runtime-qualification-attestation.ps1passes.