A customer workflow needs one account lookup, but the agent receives the definitions for billing, recruiting, support and reporting tools before it can start. The growing catalog takes up context and makes tool selection harder to inspect. OpenAI tool search lets the model load relevant definitions when needed instead of loading every schema at the beginning.
That changes how tools reach the model. It does not replace the permission checks in your application. This guide covers the Responses API configuration and a recommended customer rollout design. Backend authorization, approval records and reconciliation controls described below are engineering recommendations, not automatic guarantees from tool search.
Enable deferred loading explicitly
In Responses, add a tool_search tool to the tools array. Mark the functions you want deferred with defer_loading set to true. For an MCP server, set defer_loading on the server tool definition. Confirm support for your chosen model before enabling the route. Do not assume every model or every API runtime shares the same configuration.
Adding tool_search does not automatically defer all functions. A function without the flag remains available immediately. For namespace groups, the flag belongs to the functions inside the namespace, not the namespace object. Review the actual request your application sends rather than relying on a configuration label in your own dashboard.
Keep a versioned inventory of tool names, descriptions and parameter definitions. Classify each by its purpose and whether it reads or changes external state. Start with the workflow that suffers from a large catalog. A small, stable set of frequently used tools may not need another discovery step.
Choose hosted or client-executed search
| Route | Discovery owner | Useful starting point |
|---|---|---|
| Hosted tool search | OpenAI searches the declared deferred inventory | The candidate tools are known when constructing the request |
| Client-executed search | Your application looks up trusted definitions | The inventory depends on project or customer state |
| Immediate loading | The request exposes the definition at the start | A small catalog or a tool needed for most tasks |
For hosted search, declare the candidate functions, namespaces or MCP servers up front. The API loads the selected subset when the model searches. When that happens, the response includes tool_search_call and tool_search_output items before the eventual function call. Inspect those items when diagnosing why a workflow chose a particular tool.
Client-executed search gives your application control of the lookup. Configure tool_search with execution set to client and a schema for search arguments. The model emits a tool_search_call. Your application performs the search and returns a tool_search_output containing the selected definitions. Echo the original call_id so the result belongs to the correct request.
Do not treat the search result as the business operation's result. Returning a definition makes a function callable. A later function call still needs execution and its own result handling. Keep these steps distinct in logs and operator screens.
Write descriptions that help discovery
The model still sees searchable names and descriptions before loading details. For a namespace or MCP server, that means its high-level name and description are visible while the individual function definitions wait for discovery. An individual deferred function still exposes its name and description, so the main deferred part is its parameter schema.
Group tools by a concrete use case, such as customer account lookup or interview coordination. Describe what the group contains in plain language. Keep detailed argument rules with the functions. A vague namespace called utilities gives the model little basis for deciding whether it contains the needed action.
Do not put secrets, customer records or privileged operational notes into descriptions. Deferred loading should not be used as a confidentiality boundary. Review descriptions as information deliberately supplied to the model, even when the corresponding function has not yet been loaded.
Keep discovery separate from authorization
For client search, accept only tool definitions from a registry you control. Validate returned schemas before including them in the response. The guide supports advanced flows that introduce tools not declared in the original request, but that flexibility makes the registry boundary important. User-provided text should not create an executable tool definition.
At execution, check the authenticated actor, customer account, resource and operation. Recheck current permissions even if discovery happened earlier. If a workflow requests a write, bind any approval to the exact resource and intended change. Our MCP approval guide covers the separate sharing and approval concerns around remote tools.
Record whether the system discovered a tool, called it, received a result and confirmed the external change. An uncertain write should enter reconciliation rather than being retried because the model failed to produce a final sentence. Tool discovery does not solve duplicate business actions.
Preserve the conversation and measure the full task
The Responses guide places newly loaded tools at the end of the model context to preserve its cache. In client mode, tools listed in tool_search_output.tools become available for future turns. Your conversation handling must retain the relevant output items rather than rebuilding history from only the visible final answer.
Changing the loaded tool set can break the cache from that point onward. Treat tool-definition versions as part of a release, not an invisible background edit. Measure input-token usage and total task latency on representative requests. Include discovery, empty searches, incorrect selections and execution failures. The vendor describes possible savings, not a guaranteed improvement for every catalog.
Test failure paths before customer rollout
- Run a task that needs a deferred function and confirm it is discovered before use.
- Use an ambiguous request and check that the selected tool matches the intended operation.
- Search for an unavailable tool and require a clear limitation instead of an invented result.
- Attempt a resource lookup outside the authorized customer and verify backend denial.
- Change a permission after discovery and confirm execution checks it again.
- Interrupt a write after execution and verify reconciliation prevents a duplicate action.
Save the request, catalog version, loaded tools and confirmed application state for each test. Keep customer data out of broadly shared debugging exports. Compare the new route with the existing implementation on the same cases. Do not release solely because the response contains valid tool-search objects.
How Remqa helps with tool search rollouts
Remqa provides forward deployed engineering for customer AI workflows. A scoped implementation can cover the tool catalog, discovery route, backend checks and a release test set. Bring one workflow with its current tools and a failed run. We can use that concrete boundary to plan an implementation and handoff without assuming deferred loading alone makes the agent safe to operate.