The Tool Selection Problem
Scenario: You give your agent 20 tools. The agent uses wrong ones constantly. Research shows: Agent accuracy decreases with tool count:- 1-5 tools: 92% correct selection
- 6-10 tools: 84% correct selection
- 11-20 tools: 71% correct selection
- 20+ tools: 58% correct selection
Challenge 1: Too Many Tools
Your customer support agent handles customers, products, orders, and tickets. The naive approach: register all 20 CRUD tools in a flat list. The LLM sees all 20 at once and picks the wrong one 42% of the time. Anti-pattern: All 20 tools in a flat list.Pseudocode
Solution 1: Hierarchical Routing
Instead of 20 flat tools, give the agent 1 routing tool. It picks the domain + action, then a second step calls the specific tool.Pseudocode
Solution 2: Context-Based Tool Groups
A support conversation has phases: greeting (authentication), diagnosis (searching), resolution (ticketing). During diagnosis, the agent doesn’t need ticket creation tools. During resolution, it doesn’t need search. Show only the tools relevant to the current phase — the agent sees 2-4 instead of 20.Pseudocode
Challenge 2: Overlapping Functionality
Your e-commerce agent has three product tools:search_products, find_products, and product_lookup. They all sound the same — the LLM picks randomly or calls all three. Even with just 3 tools, overlapping descriptions destroy accuracy.
Solution: Clear Differentiation
Each tool has a distinct purpose with “Use when” / “Do NOT use” guidance:Pseudocode
- “wireless mouse” →
search_products_by_text - “PROD-001” →
get_product_by_sku - “mice under $20” →
filter_products_by_attributes
Advanced: Tool Usage Analytics
Track every tool call to find unused tools, high-failure tools, and latency bottlenecks: Run this in production to get recommendations like:- “Remove unused tool:
legacy_search” - “
flaky_toolfails 40% — review error handling” - “
slow_apiaverages 3000ms — consider caching”