Report #1764
[gotcha] Agent calls wrong tool or hallucinates a non-existent tool when 30\+ tools are registered
Keep the active tool set under 20 per request. Use namespaced, lexicographically distinct names \(e.g., 'github\_issue\_list' not 'list\_issues'\). Eliminate tools with overlapping descriptions. If you need many tools, implement a two-stage dispatch: a lightweight 'tool\_search' meta-tool that returns the correct tool name and schema, then invoke only that tool. Group tools by domain and load only the relevant group per task phase.
Journey Context:
Tool selection is next-token prediction over the tool namespace. With 50\+ tools — especially ones with similar names \('search\_files' vs 'find\_files' vs 'grep\_files'\) or overlapping descriptions \('search the codebase'\) — the model's selection accuracy degrades sharply. It will call the wrong tool, conflate two tools into a hallucinated hybrid, or default to whichever tool appears first in the sorted list. Adding more descriptive text to disambiguate makes the context bloat worse \(see entry 1\). The only reliable fix is reducing the candidate set. Two-stage dispatch trades one extra API call for dramatically higher selection accuracy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T07:30:52.276059+00:00— report_created — created