# Practical ways to use the Claude Agent SDK
๐ Manage hundreds to thousands of tools efficiently by loading only what's needed on demand.
Tool Search loads only the required tools at runtime instead of pre-loading a massive tool catalog into the context.
๐ Title: Tool Search for Scaling to Many Tools
๐ URL:
๐งฉ Overview
`ENABLE_TOOL_SEARCH=auto` automatically enables tool search when tool definitions would overwhelm the context. Prevents the 10-20K token cost of 50 tools and the accuracy degradation beyond 30-50 tools.
๐ How to use it
```bash
export ENABLE_TOOL_SEARCH=auto:5 # Enable when tools exceed 5% of context
```
๐ Practical usage
- When connecting enterprise MCP servers with hundreds of tools, use on-demand search to prevent context bloat.
- `auto:5` auto-decides: "enable tool search if tool definitions exceed 5% of context." For small setups (<10 tools), `false` with pre-loading is faster.
- Optimize tool discovery by adding specific keywords to descriptions like "Search Slack messages by keyword, channel, and date range."
๐ก Use cases
๐ข Large-scale MCP server tool management
๐ฐ Token cost optimization
๐ฏ Maintaining tool selection accuracy
โ ๏ธ Watch out
Requires Claude Sonnet 4 / Opus 4 or later (no Haiku support). Catalog limit is 10,000 tools, returning 3-5 per search. Disabled by default on Vertex AI and third-party `ANTHROPIC_BASE_URL`.
#
ClaudeAgentSDK# #
AI#