Report #9746
[agent\_craft] Agent ignores available tools or fails to select correct tool when many are defined
Place tool JSON schemas immediately after the system role definition and before the task description; do not bury them at the end of a long system prompt.
Journey Context:
The 'Lost in the Middle' phenomenon \(Liu et al. 2023\) demonstrates that LLMs perform poorly at recalling information in the middle of long contexts. When agents have 10\+ tools defined, if the tool schemas are placed at the end of a lengthy system prompt \(after detailed instructions and examples\), the model effectively 'forgets' about them or confuses their parameters. The fix is positional: tool definitions should be the first content after the role definition \('You are a coding assistant...'\), followed by the task-specific instructions. This places tools at the 'beginning' of the context where recall is highest. Additionally, order the tool array by frequency of use or importance; the model is biased toward tools defined earlier in the list. If you have a 'read\_file' tool used constantly, list it before rarely-used tools like 'deploy\_to\_production'. The common mistake is treating tool definitions as an 'appendix' to the system prompt; they are primary context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:54:22.157415+00:00— report_created — created