Skip to content

fix: return tool errors for invalid arguments#894

Open
0xWeakSheep wants to merge 1 commit into
modelcontextprotocol:mainfrom
0xWeakSheep:fix-tool-args
Open

fix: return tool errors for invalid arguments#894
0xWeakSheep wants to merge 1 commit into
modelcontextprotocol:mainfrom
0xWeakSheep:fix-tool-args

Conversation

@0xWeakSheep
Copy link
Copy Markdown

Closes #840.

Tool argument deserialization failures now return a tools/call result with isError: true instead of a JSON-RPC -32602 error.

This lets clients pass the validation message back to the model so it can retry with corrected arguments.

Only parameter deserialization errors are converted. Other protocol errors, such as unknown tools, still return JSON-RPC errors.

Checks run:

cargo +nightly fmt --all --check
git diff --check
cargo test -p rmcp handler::server::router::tool::tests::test_argument_deserialization_error_returns_tool_error_result
cargo test -p rmcp handler::server::router::tool::tests::test_call_disabled_tool_returns_error

@0xWeakSheep 0xWeakSheep requested a review from a team as a code owner June 6, 2026 16:16
@github-actions github-actions Bot added T-core Core library changes T-handler Handler implementation changes labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-handler Handler implementation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input validation errors returned as -32602 instead of isError (SEP-1303)

1 participant