Skip to content

fix(mcp): preserve legacy content in trace details - #127361

Open
betegon wants to merge 5 commits into
masterfrom
bt/fix-mcp-result-compat
Open

betegon wants to merge 5 commits into
masterfrom
bt/fix-mcp-result-compat

Conversation

@betegon

@betegon betegon commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

MCP spans use names such as tools/call example with span.op: mcp.server. The drawer checks the name instead of the operation, hiding captured inputs and outputs. It also ignores legacy mcp.tool.result.* output fields.

Before: A tools/call example span with mcp.tool.result.0.content and mcp.tool.result.2.content has no Output panel; those fields are only visible in Attributes.

After: Identify MCP spans by operation and show the captured fields in Output, preserving the original indices and partial payloads. Prefer canonical GenAI attributes when present and render one Input/Output pair.

Compatibility:

  • Keep reading existing mcp.request.argument.* and mcp.tool.result.* payloads, including singleton and indexed results. Do not reconstruct a complete result from legacy fields.
  • Prefer gen_ai.tool.call.arguments and gen_ai.tool.call.result over their older GenAI aliases and MCP fields when both formats are present. Legacy fallback remains necessary when the new SDK omits the canonical result, including error and size-limit cases.
  • Preserve prompt-variable casing, falsy results and Code Mode for complete inputs. Separately serialized legacy arguments stay as JSON. Metadata alone does not create an Output panel, and the capture alert recognizes legacy content.
  • Keep MCP transport identity and network transport as separate highlighted attributes.

This is a read/rendering change; ingestion and stored attributes are unchanged. Deploy before releasing sentry-javascript #25060.

Validation: checked emitted payloads in released JavaScript 11.10.0 and Python 2.73.0, and the pending JavaScript #25060 implementation. On the rebased branch, 98 tests across nine focused frontend suites pass, including realistic span names, legacy/canonical/mixed data, non-contiguous indices, metadata-only output and Code Mode. Frontend typecheck, scoped lint, formatting and repository hooks pass using the pinned Node 26.12.1 and pnpm 12.10.1. Current React Router 8 coverage includes the upstream Decision/Extraction tests preserved during rebase. Not deployed or verified in the production UI in this update.

@obostjancic obostjancic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed considering that getsentry/sentry-javascript#25060 is closed?

This branch was successfully deployed

1 active deployment
Preview — 097ef332 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants