# Load tools when needed

> Instead of sending every tool definition on every request, the agent sees a search tool and loads the few definitions a task needs. StackOne's Tool Gateway MCP does this with Advanced Tool Search, on by default; several harnesses also offer their own tool search for tools defined in code.

Last checked: 30 Nov 2026, against the vendor's own pages.

3.8x cheaper per request than loading every tool, across 824 tasks; Anthropic reported over 85% fewer tool-definition tokens with its tool search. ([source](https://www.stackone.com/platform/tools-discovery/))

Family: Load fewer tools. A StackOne feature.

## Where it fits
- **Building my own agent**: fits. Tool Gateway MCP, or the SDK's own tool search. With StackOne: Add https://mcp.stackone.com/mcp; Advanced Tool Search is on by default.
- **Using a coding agent**: fits. Claude Code and Cursor do it by default. With StackOne: Add https://mcp.stackone.com/mcp; Advanced Tool Search is on by default.
- **Using an enterprise assistant**: fits. One Tool Gateway MCP server exposes two tools. With StackOne: Add https://mcp.stackone.com/mcp; it exposes 2 tools and finds the rest.
- **Using a workflow tool**: fits. One MCP server with Advanced Tool Search in n8n. With StackOne: MCP Client Tool pointed at https://mcp.stackone.com/mcp.

## The setting in each harness
- [Claude API and Agent SDK](https://usefewertokens.com/harnesses/claude-api/): defer_loading: true on your tools, plus the tool_search_tool_bm25_20251119 tool ([source](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool), read 30 Nov 2026)
- [OpenAI Responses and Agents SDK](https://usefewertokens.com/harnesses/openai/): defer_loading on your tools with the tool search tool (gpt-5.4 and later) ([source](https://developers.openai.com/api/docs/guides/tools-tool-search), read 30 Nov 2026)
- [Vercel AI SDK](https://usefewertokens.com/harnesses/vercel-ai-sdk/): toolSearch() with deferLoading on your tools ([source](https://ai-sdk.dev/docs/ai-sdk-core/tool-search), read 30 Nov 2026)
- [Mastra](https://usefewertokens.com/harnesses/mastra/): ToolSearchProcessor ([source](https://mastra.ai/reference/processors/tool-search-processor), read 30 Nov 2026)
- [Pi](https://usefewertokens.com/harnesses/pi/): on by default, MCP tools default to codemode exposure, so scripts find them with searchTools() instead of every tool loading up front ([source](https://github.com/earendil-works/pi/blob/4a080252f06caf63a525d7873c5d94d3c23887e0/packages/coding-agent/docs/mcp.md#L195), read 30 Nov 2026)
- [Claude Code](https://usefewertokens.com/harnesses/claude-code/): on by default, tool search defers MCP tools (ENABLE_TOOL_SEARCH, auto:N to tune) ([source](https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search), read 30 Nov 2026)
- [Cursor](https://usefewertokens.com/harnesses/cursor/): on by default, dynamic context discovery gives the agent tool names and loads definitions from files ([source](https://cursor.com/blog/dynamic-context-discovery), read 30 Nov 2026)
- [Codex](https://usefewertokens.com/harnesses/codex/): on by default, models with tool search defer MCP tools and find them with BM25 ([source](https://github.com/openai/codex/blob/6ff1e1ca3b30fc8b914720681fcf5fe62e95f856/codex-rs/core/src/tools/handlers/tool_search.rs#L171), read 30 Nov 2026)
- [OpenCode](https://usefewertokens.com/harnesses/opencode/): on by default, With Code Mode on, which it is by default for MCP servers, the model finds tools with search() instead of loading them all ([source](https://github.com/anomalyco/opencode/releases/tag/v2.3.1), read 30 Nov 2026)
- [ChatGPT](https://usefewertokens.com/harnesses/chatgpt/): not offered. ChatGPT loads every tool an app exposes up front; tool search is API-only ([source](https://github.com/StackOneHQ/mcp-clients-scorecard/blob/main/EVIDENCE.md#chatgpt), read 30 Nov 2026)
- [Glean](https://usefewertokens.com/harnesses/glean/): on by default, tool search hands agents a small set of the MCP tools that fit each request ([source](https://www.glean.com/blog/mcp-mar-drop-2026), read 30 Nov 2026)
- [Claude](https://usefewertokens.com/harnesses/claude-ai/): on by default, tool access "Auto" loads connectors as needed; "On demand" defers every connector ([source](https://support.claude.com/en/articles/13730515-manage-claude-s-tool-access), read 30 Nov 2026)

## Read more
- [Advanced Tool Search in the StackOne docs](https://docs.stackone.com/optimize/advanced-tool-search)
- [Anthropic's tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)
