Skip to content

mcp: preserve wrapped protocol errors from typed tools - #1528

Closed
ktsoator wants to merge 1 commit into
modelcontextprotocol:mainfrom
ktsoator:fix/wrapped-tool-errors
Closed

ktsoator wants to merge 1 commit into
modelcontextprotocol:mainfrom
ktsoator:fix/wrapped-tool-errors

Conversation

@ktsoator

@ktsoator ktsoator commented Nov 14, 2026 •

Copy link
Copy Markdown

Fixes #1529

Typed tool handlers that wrap a *jsonrpc.Error currently return an isError tool result instead of a JSON-RPC error. Recognize wrapped errors with errors.As and return the underlying protocol error, preserving its code, message, and data.

Add a client/server regression test for single, nested, and joined errors.

Recognize wrapped JSON-RPC errors with errors.As before converting
ordinary handler errors into tool results. Return the underlying protocol
error to preserve its code, message, and data.

Add a client/server regression test for single, nested, and joined errors.
@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Nov 14, 2026
@github-actions github-actions Bot closed this Nov 14, 2026
@github-actions github-actions Bot reopened this Nov 16, 2026
@github-actions github-actions Bot removed the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Nov 16, 2026
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.

mcp: typed tool handlers lose wrapped JSON-RPC errors

2 participants