Repository navigation
fix(mcp): failed generated tools return an MCP error, not success text - #59
Merged
Merged
Conversation
Every generated tool caught the SDK exception and returned 'Error: ...' as normal content, so MCP clients saw isError false on a rejected write (an X DM safety rejection read as an attempted send). Raise ToolError instead, keeping the same text.
Contributor
Author
|
Review (opus): APPROVE
|
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.
Why
Every generated MCP tool (1122 of them) caught the SDK exception and returned
Error: ...as normal text, so clients gotisError: falseon a failed call. A customer's agent read an X DM safety rejection (403) frommessages_create_inbox_conversationas an attempted send.Feedback: feedback_6ae377fd1995255eb637b6ba
What
scripts/generate_mcp_tools.pyemitsraise ToolError(f'Error: {e}') from e, so the error text stays the same and is now flagged as an error.generated_tools.py: only the 1122 error lines and the import change (byte-identical otherwise).call_toolproxy: a 403 comes back withis_errortrue and X's text (it fails on develop).Follow-ups
server.pystill returnError: ...strings (e.g.support_ask, which its tests assert). Not touched here.