Report #9920
[agent\_craft] Agent hallucinates rare tools or misses the correct tool in long tool lists \(>20 tools\)
Sort tool descriptions by empirical usage frequency \(most common first\) and place the most likely tool within the first 5 descriptions; use clear XML or markdown separators between tool blocks to prevent attention bleeding.
Journey Context:
LLMs have position bias \(primacy > recency for tool lists\). In long lists, middle tools are 'lost' similar to the lost-in-the-middle phenomenon but for schema descriptions. Alphabetical sorting ignores usage frequency, causing the model to select rare tools that happen to appear early. Frequency sorting exploits the bias toward early items without losing capability on rare tools \(they're just later\). This outperforms random ordering which increases hallucination rates by 15-30% in multi-tool benchmarks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:22:34.895732+00:00— report_created — created