Skip to content

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
kpschaper:fix-tool-errors
Open

Tool execution errors should be returned as tool results with isError: true and fix error response formatting#29
kpschaper wants to merge 1 commit intooisee:mainfrom
kpschaper:fix-tool-errors

Conversation

@kpschaper
Copy link
Copy Markdown

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):

HTTP 400: {"error":{"code":"","message":{"lang":"en-GB","value":"Unknown function 'contains' at position 0."}}}

After:

OData error (HTTP 400): Unknown function 'contains' at position 0.

…Error: true and fix error response formatting
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