[#31]: handle mcp_tool_call turn items from Codex v0.129.0#39
Open
[#31]: handle mcp_tool_call turn items from Codex v0.129.0#39
Conversation
Codex v0.129.0 (PR #20677) introduced mcp_tool_call and
mcp_tool_call_output as first-class response_item turn entries.
Previously these fell through the _ => {} fallback in
handle_response_item and were silently discarded.
Add explicit handlers that wire both new types into the existing
ToolCallBuilder paths:
- mcp_tool_call: registered via add_function_call with a reconstructed
mcp__<server> namespace so the call is classified as McpTool
- mcp_tool_call_output: finalised via add_function_call_output;
supports both content-array and plain-string output shapes
Arguments may arrive as a JSON object or pre-stringified string;
both forms are handled.
Adds four tests covering: content-array output, plain-string output,
stringified arguments, and graceful skipping of unknown future item types.
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 #31
Codex v0.129.0 (PR #20677) introduced
mcp_tool_callandmcp_tool_call_outputas first-classresponse_itemturn entries. Previously these new payload types fell through the_ => {}fallback inhandle_response_itemand were silently discarded, so MCP tool calls from v0.129.0+ sessions would vanish from the parsed turn output.Changes
src-tauri/src/parser/turn.rs"mcp_tool_call"handler inhandle_response_item: readsserver+toolfields (falling back tonamespace/namefor forward compatibility), reconstructs anmcp__<server>namespace, and registers the call via the existingadd_function_callpath so it is classified asToolKind::McpTool. Arguments are accepted as either a JSON object or a pre-stringified string."mcp_tool_call_output"handler: finalises the pending call viaadd_function_call_output, supporting both content-array[{"type":"text","text":"..."}]and plain-string output shapes.No new types, structs, or public API changes — the fix wires the new JSONL item types into the existing
ToolCallBuilderinfrastructure.Tests
Four new tests in
parser::turn::tests:mcp_tool_call_turn_items_classified_as_mcp_toolkind,mcp_server,mcp_tool,output,statusmcp_tool_call_turn_items_with_string_outputmcp_tool_call_turn_items_with_stringified_argumentsunknown_response_item_types_are_silently_skippedVerification