Skip to content

Answer Invalid Params when tool or prompt arguments are not an object - #691

Open
yshmarov wants to merge 1 commit into
modelcontextprotocol:mainfrom
yshmarov:invalid-arguments-object
Open

yshmarov wants to merge 1 commit into
modelcontextprotocol:mainfrom
yshmarov:invalid-arguments-object

Conversation

@yshmarov

Copy link
Copy Markdown

tools/call with "arguments": "x" (or an array or a number) raised NoMethodError inside call_tool. The client got -32603 Internal error, and the server's exception_reporter received the NoMethodError as if it were a server bug. prompts/get did the same.

The MCP schema requires arguments to be an object, and JSON-RPC defines -32602 Invalid params for this. Both handlers now refuse a non-object value with RequestHandlerError and error_type: :invalid_params, as the unknown-tool case does. A missing arguments still works as before.

Reproduced on 1.10.0. The new tests fail on main and pass with the change. rake test and rake rubocop pass.

…bject

tools/call and prompts/get raised NoMethodError on a non-object
arguments value, so the client got -32603 Internal error and the
exception reporter saw a server fault for a client mistake.

This branch has not been deployed

No deployments
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