Skip to content

Record MCP result telemetry on mcp.tools.call spans#19509

Merged
mchen-oai merged 1 commit intomainfrom
mchen/mcp_tool_result_telemetry
Apr 28, 2026
Merged

Record MCP result telemetry on mcp.tools.call spans#19509
mchen-oai merged 1 commit intomainfrom
mchen/mcp_tool_result_telemetry

Conversation

@mchen-oai
Copy link
Copy Markdown
Contributor

@mchen-oai mchen-oai commented Apr 25, 2026

Why

  • Without change: MCP tool call spans include request-side details such as server, tool, call ID, connector, session, and turn.
  • Issue: Some useful telemetry is only known by the MCP server after it handles the tool call, such as target identity or whether the call triggered a user-facing flow.

What Changed

  • With change: Codex reads allowlisted telemetry from _meta["codex/telemetry"]["span"] and records it on the mcp.tools.call span.
  • Adds span fields for codex.mcp.target.id and codex.mcp.user_flow.triggered, with strict type checks and bounded target ID length.

Verification

codex-rs/core/src/mcp_tool_call_tests.rs

@mchen-oai mchen-oai changed the title Record MCP tool result telemetry on spans Record MCP result telemetry on mcp.tools.call Apr 25, 2026
@mchen-oai mchen-oai changed the title Record MCP result telemetry on mcp.tools.call Record MCP result telemetry on mcp.tools.call spans Apr 25, 2026
@mchen-oai mchen-oai force-pushed the mchen/mcp_tool_result_telemetry branch from 6e660ee to 2f334c4 Compare April 25, 2026 14:11
@mchen-oai mchen-oai marked this pull request as ready for review April 25, 2026 14:14
@mchen-oai mchen-oai requested a review from a team as a code owner April 25, 2026 14:14
@mchen-oai mchen-oai force-pushed the mchen/mcp_tool_result_telemetry branch 2 times, most recently from b3d7a9b to 1325338 Compare April 27, 2026 22:56
@mchen-oai mchen-oai force-pushed the mchen/mcp_tool_result_telemetry branch from eabd9a7 to b70ca9f Compare April 28, 2026 16:53
@mchen-oai mchen-oai enabled auto-merge (squash) April 28, 2026 16:55
@mchen-oai mchen-oai merged commit 01de13b into main Apr 28, 2026
25 checks passed
@mchen-oai mchen-oai deleted the mchen/mcp_tool_result_telemetry branch April 28, 2026 17:20
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants