Files
codex/codex-rs/tool-api
2026-05-11 19:11:15 +01:00
..
2026-05-11 19:11:15 +01:00
2026-05-11 19:11:15 +01:00
2026-05-11 19:11:15 +01:00

codex-tool-api

codex-tool-api is the minimal extension-facing contract for contributed function tools that can be injected into Codex without making codex-core depend on the tool owner's crate.

Crates that define contributed tools should depend on this crate. It owns:

  • the executable bundle contract: ToolBundle, ToolExecutor, ToolCall, and ToolError
  • the shared model-visible function-tool fields stored directly on ToolBundle
  • contributed namespace metadata through ToolNamespace

The contract is intentionally narrow: contributed tools receive a call id plus raw JSON arguments and return a JSON value. If a feature needs richer host integration, its extension is expected to do that wiring before exposing the tool rather than widening this crate around the hardest native tools.

The intended dependency direction is:

tool-owning extension crate --> codex-tool-api <-- codex-core

codex-tools has a different job. It remains the host-side owner of Responses API tool models, namespace rendering and aggregation, discovery, MCP/dynamic conversion, code-mode shaping, and other aggregate host concerns. A crate that only wants to contribute one ordinary function tool through an extension should not need to depend on codex-tools.