Skip to content

Add supports_parallel_tool_calls flag to included mcps#17667

Merged
josiah-openai merged 1 commit intomainfrom
dev/josiah/act/add-parallel-mcp
Apr 13, 2026
Merged

Add supports_parallel_tool_calls flag to included mcps#17667
josiah-openai merged 1 commit intomainfrom
dev/josiah/act/add-parallel-mcp

Conversation

@josiah-openai
Copy link
Copy Markdown
Contributor

@josiah-openai josiah-openai commented Apr 13, 2026

Why

For more advanced MCP usage, we want the model to be able to emit parallel MCP tool calls and have Codex execute eligible ones concurrently, instead of forcing all MCP calls through the serial block.

The main design choice was where to thread the config. I made this server-level because parallel safety depends on the MCP server implementation. Codex reads the flag from mcp_servers, threads the opted-in server names into ToolRouter, and checks the parsed ToolPayload::Mcp { server, .. } at execution time. That avoids relying on model-visible tool names, which can be incomplete in deferred/search-tool paths or ambiguous for similarly named servers/tools.

What was added

Added supports_parallel_tool_calls for MCP servers.

Before:

[mcp_servers.docs]
command = "docs-server"

After:

[mcp_servers.docs]
command = "docs-server"
supports_parallel_tool_calls = true

MCP calls remain serial by default. Only tools from opted-in servers are eligible to run in parallel. Docs also now warn to enable this only when the server’s tools are safe to run concurrently, especially around shared state or read/write races.

Testing

Tested with a local stdio MCP server exposing real delay tools. The model/Responses side was mocked only to deterministically emit two MCP calls in the same turn.

Each test called query_with_delay and query_with_delay_2 with { "seconds": 25 }.

Build/config Observed Wall time
main with flag enabled serial 58.79s
PR with flag enabled parallel 31.73s
PR without flag serial 56.70s

PR with flag enabled showed both tools start before either completed; main and PR-without-flag completed the first delay before starting the second.

Also added an integration test.

Additional checks:

  • cargo test -p codex-tools passed
  • cargo test -p codex-core mcp_parallel_support_uses_exact_payload_server passed
  • git diff --check passed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@josiah-openai josiah-openai force-pushed the dev/josiah/act/add-parallel-mcp branch from bf9bc5a to 6ffbc1b Compare April 13, 2026 18:38
@josiah-openai
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 13, 2026
@josiah-openai josiah-openai force-pushed the dev/josiah/act/add-parallel-mcp branch from 6ffbc1b to 8b08616 Compare April 13, 2026 19:53
@josiah-openai josiah-openai changed the title Add support_parallel_tool_calls flag to included mcps Add supports_parallel_tool_calls flag to included mcps Apr 13, 2026
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok once my comments are processed

Comment thread codex-rs/core/src/tools/js_repl/mod.rs Outdated
.await
.list_all_tools()
.await;
let parallel_mcp_server_names = exec
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks unused here...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - this one is slightly weird because it looks like js_repl uses its own tool call router/dispatcher, but I didn't want to mess around with the parameters too much to allow you to leave out the server names.

Comment thread codex-rs/rmcp-client/src/bin/test_stdio_server.rs Outdated
Comment thread codex-rs/core/tests/suite/rmcp_client.rs
Comment thread codex-rs/config/src/mcp_types_tests.rs
@josiah-openai josiah-openai force-pushed the dev/josiah/act/add-parallel-mcp branch from 8b08616 to eb849d9 Compare April 13, 2026 21:16
@josiah-openai josiah-openai merged commit 937dd38 into main Apr 13, 2026
33 of 38 checks passed
@josiah-openai josiah-openai deleted the dev/josiah/act/add-parallel-mcp branch April 13, 2026 22:16
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants