Repository navigation
fix: pair Anthropic MCP connector tool calls with their results - #193
Merged
Andrew Kent (realark) merged 1 commit intoOct 30, 2026
Conversation
Anthropic's MCP connector emits mcp_tool_use / mcp_tool_result blocks. Only server_tool_use was registered as a call, so mcp_tool_result spans were emitted unpaired, named "mcp_tool" and missing input. Fixes braintrustdata#191 Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Andrew Kent (realark)
merged commit Oct 30, 2026
8ff9be8
into
braintrustdata:main
2 of 4 checks passed
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.
Fixes #191
Anthropic's MCP connector returns a
mcp_tool_useblock for the call and amcp_tool_resultblock for the result.addAnthropicServerSideChildSpansonly registeredserver_tool_useas a call. Because the suffix check still matchedmcp_tool_result, the result was emitted with no paired call. The child span ended up namedmcp_tool, and the tool's input was missing.The fix treats
mcp_tool_useas a call type next toserver_tool_use. Pairing, naming, input, metadata and output then work the same way they do for web search. This matches the fix in the Python SDK (braintrust-sdk-python#797).Tests
InstrumentationSemConvTest.pairsMcpToolUseWithMcpToolResult. It fails onmainand passes with this change../gradlew :braintrust-sdk:test --tests 'dev.braintrust.instrumentation.*'passes../gradlew :braintrust-sdk:instrumentation:anthropic_2_2_0:test(VCR replay) passes../gradlew :braintrust-sdk:spotlessCheckpasses.