Tool execution errors should be returned as tool results with isError: true and fix error response formatting#29
Open
kpschaper wants to merge 1 commit intooisee:mainfrom
Open
Conversation
…Error: true and fix error response formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Tool execution errors should be returned as tool results with isError: true (mcp/server.go)
Currently, when wrong input parameters are passed to a tool the server would return a JSON-RPC error and hang (waiting for response), this does not allow the LLM to self-correct and retry with adjusted parameters.
Reference; https://modelcontextprotocol.io/specification/2025-11-25/server/tools#error-handling
2. Fix error response formatting (client/response):
The OData v2 spec specifies an error to return an object with both a code and a message. The code is optional while the message is mandatory. The current implementation checks for a Code while it should check for a Message.
Before: the error returned looks like (because a fallback is used):
After: