Update tools/call input validation errors to be tool execution errors#824
Conversation
domdomegg
left a comment
There was a problem hiding this comment.
Hey @fredericbarthelet, thanks for raising this PR!
I think as written, the spec would include these errors as protocol errors, as the fall under 'Invalid arguments'. So at this time I don't think we'd be willing to accept this PR.
However, it does raise a good point: it adds complexity to have two types of errors which are inconsistently handled in clients - resulting in the behaviour where models can't retry failed things in a range of cases.
Would you be open to raising a spec proposal in the main repo on this? https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/CONTRIBUTING.md
|
Thanks @domdomegg for your feedback. I'll have a crack at it :) Closing this in the meantime. |
b1bb528 to
bccf053
Compare
|
Closing this one as it has already been addressed in #1044 😅 |
Reporting input validation errors as Tool Execution Errors instead of Protocol Errors in order to increase model self-recovery success rate.
Motivation and Context
The tools error handling specs is quite vague on wether input validation errors shall be treated as Protocol Errors (following the Invalid arguments exemple) or as Tool Execution Errors (following the Invalid input data exemple).
Only Tool Execution Errors are injected back into the LLM context window, just like successful responses. Input validation error messages can be leveraged by the model as much as any other prompt, giving it a chance to recover from the error without human intervention.
How Has This Been Tested?
The
should validate tool argstest suite insrc/server/mcp.test.tshas been updated to reflect the new error reponse format.Breaking Changes
None
Types of changes
Checklist
Additional context
I am the author of the following article on MCP tool execution errors : Better MCP tools/call Error Responses: Help Your AI Recover Gracefully