Skip to content

[#35]: resolve MCP tool calls from tool_id in v0.130.0 sessions#44

Open
delexw wants to merge 1 commit intomainfrom
fix-issue-35
Open

[#35]: resolve MCP tool calls from tool_id in v0.130.0 sessions#44
delexw wants to merge 1 commit intomainfrom
fix-issue-35

Conversation

@delexw
Copy link
Copy Markdown
Contributor

@delexw delexw commented May 10, 2026

Summary

Fixes #35

Codex v0.130.0 (upstream PR #21454) removed string-keyed MCP tool maps from its 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+ were silently classified as ToolKind::Unknown rather than ToolKind::McpTool, resulting in missing tool metadata in traces.

Changes

src-tauri/src/parser/toolcall.rs

  • Added mcp_server: Option<String> field to PendingCall for direct server storage (bypasses parse_mcp_namespace — needed because that function splits on __ and would misinterpret multi-segment server names like codex_apps__slack).
  • Extended add_function_call signature with mcp_server_direct: Option<String> parameter.
  • Updated add_function_call_output: checks pending.mcp_server first; only falls through to namespace-based parsing when it is absent. This keeps full backward compatibility with pre-v0.130.0 sessions.
  • Updated all PendingCall fallback constructions to include mcp_server: None.

src-tauri/src/parser/turn.rs

  • In the function_call response_item handler: when namespace is absent, extracts tool_id.server and passes it as mcp_server_direct to add_function_call. The tool_id path is only taken when namespace is not present, so older sessions are unaffected.

Tests

Three new tests in parser::turn::tests:

Test Covers
function_call_with_tool_id_classified_as_mcp_tool v0.130.0 session: function_call with tool_id correctly resolves to McpTool with server, tool name, output, and status
function_call_with_tool_id_multi_segment_server Server names containing __ (e.g. codex_apps__slack) are stored verbatim without mangling
function_call_namespace_still_works_without_tool_id Pre-v0.130.0 namespace field path continues to produce correct mcp_server / mcp_tool values

Verification

cargo test --lib  →  62 passed, 0 failed
npx vitest run    →  122 passed, 0 failed
cargo clippy      →  0 warnings
npx oxlint        →  0 warnings / errors
npx oxfmt --check →  all files correctly formatted
npx tsc --noEmit  →  no type errors
HTTP API (POST /api/sessions) → returns session JSON correctly

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compat] Codex v0.130.0: string-keyed MCP tool maps removed

1 participant