[#35]: resolve MCP tool calls from tool_id in v0.130.0 sessions#44
Open
[#35]: resolve MCP tool calls from tool_id in v0.130.0 sessions#44
Conversation
Codex v0.130.0 (PR #21454) removed string-keyed MCP tool maps from the
internal representation. function_call response_item entries for MCP tools
no longer carry a flat namespace string (e.g. mcp__server__); instead they
carry a structured tool_id: { server, tool } object.
The previous code read only the namespace field, so MCP tools in sessions
recorded with v0.130.0+ would be silently classified as ToolKind::Unknown
rather than ToolKind::McpTool.
Fix: when namespace is absent, extract tool_id.server from the function_call
payload and store it directly on PendingCall.mcp_server. In
add_function_call_output, check pending.mcp_server first before falling
through to namespace-based parse_mcp_namespace — this avoids the existing
function misinterpreting multi-segment server names like codex_apps__slack
as namespace suffixes.
Pre-v0.130.0 sessions (with namespace field) continue to work unchanged;
the new tool_id path is only taken when namespace is absent.
Adds three tests:
- function_call_with_tool_id_classified_as_mcp_tool: v0.130.0 session with
tool_id resolves to McpTool with correct server + tool + output
- function_call_with_tool_id_multi_segment_server: server names containing
__ (e.g. codex_apps__slack) are preserved verbatim
- function_call_namespace_still_works_without_tool_id: pre-v0.130.0 namespace
path continues to produce correct mcp_server / mcp_tool values
Fixes #35
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.
Summary
Fixes #35
Codex v0.130.0 (upstream PR #21454) removed string-keyed MCP tool maps from its internal representation.
function_callresponse_item entries for MCP tools no longer carry a flatnamespacestring (e.g.mcp__server__); instead they carry a structuredtool_id: { server, tool }object.The previous code read only the
namespacefield, so MCP tools in sessions recorded with v0.130.0+ were silently classified asToolKind::Unknownrather thanToolKind::McpTool, resulting in missing tool metadata in traces.Changes
src-tauri/src/parser/toolcall.rsmcp_server: Option<String>field toPendingCallfor direct server storage (bypassesparse_mcp_namespace— needed because that function splits on__and would misinterpret multi-segment server names likecodex_apps__slack).add_function_callsignature withmcp_server_direct: Option<String>parameter.add_function_call_output: checkspending.mcp_serverfirst; only falls through to namespace-based parsing when it is absent. This keeps full backward compatibility with pre-v0.130.0 sessions.PendingCallfallback constructions to includemcp_server: None.src-tauri/src/parser/turn.rsfunction_callresponse_item handler: whennamespaceis absent, extractstool_id.serverand passes it asmcp_server_directtoadd_function_call. Thetool_idpath is only taken whennamespaceis not present, so older sessions are unaffected.Tests
Three new tests in
parser::turn::tests:function_call_with_tool_id_classified_as_mcp_toolfunction_callwithtool_idcorrectly resolves toMcpToolwith server, tool name, output, and statusfunction_call_with_tool_id_multi_segment_server__(e.g.codex_apps__slack) are stored verbatim without manglingfunction_call_namespace_still_works_without_tool_idnamespacefield path continues to produce correctmcp_server/mcp_toolvaluesVerification