Skip to content

[wip]tool-api: move extension-facing tool bundles out of codex-tools#22183

Draft
jif-oai wants to merge 2 commits into
mainfrom
jif/keep-splitting-tool-bundles
Draft

[wip]tool-api: move extension-facing tool bundles out of codex-tools#22183
jif-oai wants to merge 2 commits into
mainfrom
jif/keep-splitting-tool-bundles

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 11, 2026

Why

codex-tool-api and codex-tools still have different jobs.

codex-tool-api is the small authoring surface that a tool-owning extension crate should depend on. It needs enough to describe and execute an ordinary contributed function tool: ToolBundle, ToolExecutor, ToolCall, ToolError, ToolName, JsonSchema, and namespace metadata.

codex-tools remains host-side. It owns the Responses API wire types and the logic that aggregates built-in tools, MCP tools, dynamic tools, and extension bundles into the model-visible/runtime tool surface. That includes namespace rendering, code-mode augmentation, MCP/dynamic conversion, discovery, and other host-only shaping.

Keeping both crates lets us prove the reusable external tool seam without dragging host-only machinery back into extension crates.

What changed

  • move the extension-facing bundle authoring surface into codex-rs/tool-api/
  • move the shared JSON schema types and parser there as well, and add explicit namespace metadata so bundle authors can describe namespaced tools without depending on host codex-tools types
  • keep codex-rs/tools/ as the host owner of Responses API tool specs and code-mode/discovery/MCP/dynamic conversion logic, while re-exporting the shared schema types from codex-tool-api
  • update core's extension tool registration path to build host ToolSpecs directly from ToolBundle metadata and coalesce namespaced extension bundles into namespace specs
  • update codex_extension_api re-exports and tests to use the new surface

@jif-oai jif-oai requested a review from a team as a code owner May 11, 2026 18:11
@jif-oai jif-oai changed the title go further tool-api: move extension-facing tool bundles out of codex-tools May 11, 2026
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e244b254b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +566 to +567
let spec = match bundle.namespace() {
Some(namespace) => ToolSpec::Namespace(ResponsesApiNamespace {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Do not expose namespace specs when disabled

register_tool_bundle always turns a namespaced extension bundle into ToolSpec::Namespace, but this path is called regardless of config.namespace_tools. MCP and dynamic tools explicitly hide namespace specs when that capability is false; extensions will still be sent in model_visible_specs, causing requests to models without namespace-tool support to fail instead of keeping the handler hidden.

Useful? React with 👍 / 👎.

executor,
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure yet if we need all those accessor but that tends to make my tests cleaner

@jif-oai jif-oai marked this pull request as draft May 11, 2026 18:34
@jif-oai jif-oai changed the title tool-api: move extension-facing tool bundles out of codex-tools [wip]tool-api: move extension-facing tool bundles out of codex-tools May 11, 2026
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.

1 participant