Skip to content

Return invalid params when typed request decoding fails - #330

Open
jg-oai wants to merge 1 commit into
modelcontextprotocol:mainfrom
jg-oai:jg/mcp-invalid-tool-params
Open

jg-oai wants to merge 1 commit into
modelcontextprotocol:mainfrom
jg-oai:jg/mcp-invalid-tool-params

Conversation

@jg-oai

@jg-oai jg-oai commented Nov 14, 2026

Copy link
Copy Markdown

When a request's parameters cannot be decoded for its method, the SDK returns JSON-RPC error -32602 with the original request ID. Previously, the decoding error reached the generic internal-error handler and returned -32603.

The regression tests send two malformed tools/call requests over an in-memory connection, one missing the tool name and one supplying an array for arguments. The change applies to typed request dispatch on all supported platforms and does not change public Swift API signatures. JSON-RPC 2.0 §5.1

AI assistance: Codex drafted the code, tests, and PR description.

JSON-RPC 2.0 section 5.1 assigns -32602 to invalid method parameters. Map typed request decoding failures to that code before invoking the registered handler.
@jg-oai
jg-oai requested a review from a team as a code owner November 14, 2026 14:21
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