Repository navigation
fix(tracing): capture completed McpToolCall items as named tool calls - #106
Open
lakshya-dhariwal wants to merge 1 commit into
Open
lakshya-dhariwal wants to merge 1 commit into
lakshya-dhariwal wants to merge 1 commit into
Conversation
Desktop code-mode turns surface nested MCP calls only as item_completed McpToolCall items - no mcp_tool_call_begin/end events and no model-visible call to enrich - so they never became observations. Map them to server.tool tool calls with arguments/result, record failures as errors, and deduplicate by call ID against existing calls.
Author
|
Friendly bump. This captures completed McpToolCall items as native tool spans, and the CLA is signed. Could a maintainer take a look when you have time? Happy to adjust. |
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 langfuse/langfuse#17969
What
Desktop code-mode turns emit nested MCP calls only as completed
McpToolCallitems onitem_completed- there are nomcp_tool_call_begin/endevents for them and no model-visible tool call to enrich.parse.tsonly handleditem_completedforUserMessage, so those calls never became observations: traces showed the outerTOOL execbut nothing for the MCP call inside it.Change
Handle
item_completedwithitem.type === "McpToolCall"in the parser:server.tool(the existingmcpnaming path intrace.tsrenders it the same way) withargumentsas input andresultas output.status: "failed"records an error instead of an output, unwrappingErr/string error shapes.mcp_tool_call_begin/end.startTimeuses the completion timestamp. The item carries aduration, but its serialized shape/units are not documented, so this does not guess from it; the span is zero-length rather than wrong.Testing
McpToolCallbecomes onecodex_app.list_projectstool call with input/output; a completed item whose ID matches a model-visiblefunction_callenriches it (MCP identity + failure error) without duplicating it. Both fail without the parser change.pnpm test- 122/122 pass.pnpm run lint(format + tsc + build) clean.Notes