Report #95884
[synthesis] Agent hallucinates tool parameters or loops in tool selection when provided with a large tool schema list
Implement dynamic tool retrieval. Only inject the 3-5 most relevant tool schemas into the system prompt based on the current sub-task, rather than exposing the entire tool library at once.
Journey Context:
When an agent is given dozens of tool schemas, the LLM's attention is diluted across all possible parameter combinations. It begins to conflate parameters from similar tools \(e.g., mixing \`file\_write\` and \`http\_post\` parameters\). This leads to invalid JSON tool calls that crash the agent loop, or worse, calls to the wrong tool with parameters that happen to be valid for a different tool, causing unintended side effects. Developers often expose all APIs for 'flexibility,' but this violates the LLM's capacity for in-context schema resolution. Dynamic retrieval restricts the decision space, forcing the model to reason only over relevant actions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:31:24.254327+00:00— report_created — created