Skip to content

fix(mcp): accept omitted arguments for argument-free tools - #1

Draft
autoantohaki wants to merge 1 commit into
mainfrom
fix/mcp-optional-tool-arguments
Draft

autoantohaki wants to merge 1 commit into
mainfrom
fix/mcp-optional-tool-arguments

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Requested by mau

Before: an MCP tools/call for ocr_capabilities or ocr_models that omitted arguments came back as a -32602 "unknown tool" error. MCP marks arguments as optional, and both tools take no input, so this is a valid call. Passing unexpected arguments also reported "unknown tool".

After: if arguments is 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_object becomes is_empty_arguments, which also accepts null, 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 .rs sources, so the Windows runtime qualification attestation has to be re-recorded before verify-runtime-qualification-attestation.ps1 passes.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant