Skip to content

codex-tools: extract dynamic tool adapters#15944

Merged
bolinfest merged 1 commit intomainfrom
pr15944
Mar 27, 2026
Merged

codex-tools: extract dynamic tool adapters#15944
bolinfest merged 1 commit intomainfrom
pr15944

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Mar 27, 2026

Why

codex-tools already owned the shared JSON schema parser and the MCP tool schema adapter, but core/src/tools/spec.rs still parsed dynamic tools directly.

That left the tool-schema boundary split in two different ways:

  • MCP tools flowed through codex-tools, while dynamic tools were still parsed in codex-core
  • the extracted dynamic-tool path initially introduced a dynamic-specific parsed shape even though codex-tools already had very similar MCP adapter output

This change finishes that extraction boundary in one step. codex-core still owns ResponsesApiTool assembly, but both MCP tools and dynamic tools now enter that layer through codex-tools using the same parsed tool-definition shape.

What changed

  • added tools/src/dynamic_tool.rs and sibling tools/src/dynamic_tool_tests.rs
  • introduced parse_dynamic_tool() in codex-tools and switched core/src/tools/spec.rs to use it for dynamic tools
  • added tools/src/parsed_tool_definition.rs so both MCP and dynamic adapters return the same ParsedToolDefinition
  • updated core/src/tools/spec.rs to build ResponsesApiTool through a shared local adapter helper instead of separate MCP and dynamic assembly paths
  • expanded core/src/tools/spec_tests.rs so the dynamic-tool adapter test asserts the full converted ResponsesApiTool, including defer_loading
  • updated codex-rs/tools/README.md to reflect the shared parsed tool-definition boundary

Test plan

  • cargo test -p codex-tools
  • cargo test -p codex-core --lib tools::spec::

Stack created with Sapling. Best reviewed with ReviewStack.

@bolinfest bolinfest merged commit 617475e into main Mar 27, 2026
120 of 128 checks passed
@bolinfest bolinfest deleted the pr15944 branch March 27, 2026 16:12
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 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