---
title: "Tool search pattern for AI agents | Agentic Pattern Language"
description: "Give the agent a search over its tools, and load only the tool definitions a task needs. Sourced from Cursor, Anthropic, and OpenAI."
url: https://agenticpatternlanguage.com/patterns/tool-search/
---

35 [One agent](https://agenticpatternlanguage.com/#one-agent)

# Tool search

Give the agent a search over its tools, and load only the tool definitions a task needs.

Also called On-demand tool loading

Cursor, Anthropic, OpenAI, GitHub

[How to read this](https://agenticpatternlanguage.com/notation/)

## Part of

* [Just-in-time context retrieval](https://agenticpatternlanguage.com/patterns/just-in-time-context-retrieval/)

## Alternatives

* [Code actions](https://agenticpatternlanguage.com/patterns/code-actions/)

## The problem

Every tool definition takes room in the context window, and with too many tools the agent picks the wrong one.

> Connecting MCP servers and other external tools to Copilot CLI is powerful, but every tool you add carries a cost: its definition takes up space in the model's context window, and a long menu of tools makes it harder for the agent to pick the right one.

GitHub [Loading tools on demand with tool search](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search)

> Claude’s ability to pick the right tool degrades once you exceed 30–50 available tools.

Anthropic [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)

## Therefore

> The tool search tool lets Claude work with hundreds or thousands of tools by discovering and loading them on demand. Instead of loading all tool definitions into the context window up front, Claude searches your tool catalog (including tool names, descriptions, argument names, and argument descriptions) and loads only the tools it needs.

Anthropic [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool)

> Tool search allows the model to dynamically search for and load tools into the model’s context as needed. This allows you to avoid loading all tool definitions into the model’s context up front and may help reduce overall token usage and cost.

OpenAI [Tool search](https://developers.openai.com/api/docs/guides/tools-tool-search)

> On-demand tool loading (or "tool search") prevents the context window from being cluttered by definitions for tools that the agent doesn't use. The agent starts with just its built-in tools and a way to look up the rest, then loads extra tools only when they're needed to complete a task.

GitHub [Loading tools on demand with tool search](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search)

## In use

Claude Code

> Tool search keeps MCP context usage low by deferring tool definitions until Claude needs them. Only tool names and server instructions load at session start, so adding more MCP servers has minimal impact on your context window.

Anthropic [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp)

GitHub Copilot CLI

> Tool search keeps your context small by letting Copilot CLI load external tools only when a task needs them.

GitHub [Loading tools on demand with tool search](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search)

## Where it breaks

Each search costs an extra round-trip, and with only a few tools it saves too little to be worth it.

> Tool search adds one extra round-trip each time Claude searches for tools, but for large tool sets this is offset by smaller context on every turn.

Anthropic [Scale to many tools with tool search](https://code.claude.com/docs/en/agent-sdk/tool-search)

> We considered a tool search approach, but that would scatter tools across a flat index.

Cursor [Dynamic context discovery](https://cursor.com/blog/dynamic-context-discovery) Jan 6, 2026

> Below roughly 30 tools, the savings you get from tool search aren't worth it, so Copilot CLI skips tool search entirely and just loads everything.

GitHub [Loading tools on demand with tool search](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search)

## Sources

1. [Dynamic context discovery](https://cursor.com/blog/dynamic-context-discovery) Jediah Katz, Cursor, Jan 6, 2026
2. [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) Anthropic
3. [Tool search](https://developers.openai.com/api/docs/guides/tools-tool-search) OpenAI
4. [Loading tools on demand with tool search](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/tool-search) GitHub
   > On-demand tool loading (or "tool search") prevents the context window from being cluttered by definitions for tools that the agent doesn't use.
5. [Scale to many tools with tool search](https://code.claude.com/docs/en/agent-sdk/tool-search) Anthropic
6. [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp) Anthropic

Added Nov 14, 2026
