Skip to content

fix: MCP integration records tool calls that return isError as successful - #7942

Closed
Roshan931 wants to merge 1 commit into
getsentry:masterfrom
Roshan931:prilog/fix-error-mcp-v2-middleware-ignores-iserror-in-10-10-2026-ea2f80
Closed

Roshan931 wants to merge 1 commit into
getsentry:masterfrom
Roshan931:prilog/fix-error-mcp-v2-middleware-ignores-iserror-in-10-10-2026-ea2f80

Conversation

@Roshan931

Copy link
Copy Markdown

Fixes #7890

Root cause

MCP v2 middleware ignores isError in tool results

Changes

  • In _instrument_v2_tool_call, mark the tools/call span as failed when the handler result dict carries isError, using SpanStatus.ERROR for streamed spans and SPANSTATUS.INTERNAL_ERROR otherwise (same pattern as the openai_agents execute_tool span). Added a v2-only regression test covering both streamed and static span lifecycles.

Signed-off-by: Robert Markovski <5818108+Roshan931@users.noreply.github.com>
@alexander-alderman-webb

Copy link
Copy Markdown
Collaborator

Closing because this required prior discussion on the issue.

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 integration records tool calls that return isError as successful

2 participants