fix(mcp): Add catalog tool spans#582
Merged
Merged
Conversation
Wrap resolved MCP catalog tool calls in their own execute_tool spans so latency and errors are attributable to the actual provider tool instead of callMcpTool. Thread conversation privacy and tool call ids into catalog execution so captured arguments/results follow the same redaction policy and private MCP errors do not leak raw payloads through telemetry. Fixes GH-581 Co-Authored-By: GPT-5 Codex <codex@openai.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
MCP catalog tools invoked through callMcpTool now run inside their own
gen_ai.execute_toolchild span keyed by the resolved catalog tool name. The catalog span carries the standard GenAI/MCP tool attributes, propagates the model tool-call id when available, and records successful tool arguments/results under the standardgen_ai.tool.call.*attributes instead of folding all catalog work into the outercallMcpToolspan.The privacy policy now travels through tool execution so private MCP arguments/results are captured as metadata only, and private MCP tool errors use a generic telemetry message instead of copying raw provider error content into span/log attributes. The touched behavior tests were narrowed away from direct telemetry-shape assertions, and the instrumentation specs now distinguish standard GenAI attributes from repo-local custom pivots.
Validation:
pnpm --filter @sentry/junior exec vitest run tests/unit/mcp/tool-manager.test.ts tests/unit/tools/call-mcp-tool.test.ts tests/unit/tools/agent-tools.test.ts tests/unit/tools/tool-error-handler.test.ts tests/unit/tools/execution/tool-error-handler.test.ts;pnpm --filter @sentry/junior typecheck.Fixes GH-581