Why OpenAI Codex Enables Tool Search by Default for Better Efficiency

Nicola·
Why OpenAI Codex Enables Tool Search by Default for Better Efficiency

Why OpenAI Codex Enables Tool Search by Default

Codex now activates tool search automatically. This happens for supported models. The shift replaces static schema injection with dynamic discovery. The system retrieves tools only when the agent identifies a specific need.

A fundamental shift has occurred. Previously, developers relied on feature flags. They accepted the performance penalty of loading every tool. The recent merge of PR #17854 promoted ToolSearch to stable status. This update ensures the searched-tool flow is standard. You no longer need complex toggles. Accessing this efficiency is now automatic.

The shift from static to dynamic

Context management is the core distinction. In the legacy approach, Codex received the full Model Context Protocol (MCP) schema. This happened at the start of every session. The method caused significant context pollution. Irrelevant tool definitions occupied valuable space. The model processed this noise unnecessarily.

Dynamic search alters this workflow. The agent begins with a clean slate. It analyzes the user request first. If external action is necessary, it triggers a semantic search. This process queries the tool registry. The system injects only relevant definitions. This targeted approach preserves model attention.

This architecture aligns with Codex design goals. The agent, written primarily in Rust, prioritizes speed. We reduce initial latency by removing upfront schema loading costs. The agent acts like a skilled developer. It consults documentation only when needed. It does not memorize every library function. This on-demand retrieval supports better token optimization. Developers connect numerous MCP servers without fear. The system scales gracefully. Your tool ecosystem grows without issue.

OpenAI removed the full tool list. This eliminates pollution and reduces token waste. Agents process only relevant definitions. This leads to significant cost savings. Response times improve noticeably.

Reducing context pollution

The Model Context Protocol (MCP) connects AI applications efficiently Source: modelcontextprotocol.io. This standardization offers clear benefits. Yet it introduces a challenge. Servers expose hundreds of tools. Injecting every definition creates substantial noise. The model parses irrelevant schemas. This distracts from the primary task. Context pollution degrades reasoning quality.

Before recent updates, MCP tools used tool search conditionally. This occurred only if a feature flag was enabled. Or if there were at least 100 tools Source: github.com. This threshold approach was insufficient. Developers faced latency spikes. The context window filled with unused signatures. OpenAI removed the full list. The agent now focuses on immediate intent. It does not scan a massive registry. The searched-tool flow is now intended behavior Source: github.com. Uniformity prevents accuracy degradation.

Improving token efficiency

Token optimization manages operational costs.

Frequently Asked Questions

Does enabling tool search by default increase latency?
No, it reduces latency. Previously, Codex loaded the full MCP schema at session start, causing significant upfront delay. With dynamic tool search, the agent begins with a clean slate and retrieves only relevant tools when needed. This on-demand approach eliminates the initial schema loading cost, leading to faster response times and better token optimization.
How many tools does Codex retrieve per search query?
Codex retrieves only the tools relevant to the specific user request. Instead of loading every tool from all connected MCP servers, the agent performs a semantic search of the tool registry and injects only the definitions that match the current need. This targeted retrieval keeps the context window clean and efficient, typically returning a small subset of tools rather than hundreds.
Is tool search compatible with custom MCP servers?
Yes, tool search works with any MCP server, including custom ones. The system queries the tool registry dynamically, so as long as your custom server exposes tools via the Model Context Protocol, Codex can discover and retrieve them on demand. This compatibility allows you to scale your tool ecosystem without manual configuration.
What happens if tool search fails to find a relevant tool?
If the semantic search does not find a matching tool, the agent proceeds without injecting any tool definitions. It relies solely on its existing knowledge to respond to the user request. This prevents context pollution from irrelevant schemas and ensures the model focuses on the task at hand. You can verify tool availability by checking your MCP server's registry.
Do I need to update my Codex configuration to use tool search?
No, tool search is now enabled by default for supported models. The recent PR #17854 promoted it to stable status, removing the need for feature flags or manual configuration. You can simply connect your MCP servers, and Codex will automatically use dynamic retrieval. No updates to your existing setup are required.

Nicola

Developer and creator of vexp — a context engine for AI coding agents. I build tools that make AI coding assistants faster, cheaper, and actually useful on real codebases.

Keep reading

Related articles