Report #37747
[agent\_craft] Agent ignores available tools or uses wrong tool for task
Place tool definitions \(JSON schemas\) at the very BEGINNING of the system prompt, before role definition, and append 'Use the above tools when applicable' immediately before the user query.
Journey Context:
Agents frequently fail to invoke tools because the tool schemas are buried at the end of a long system prompt or mixed with stylistic instructions. Due to the 'lost in the middle' effect and attention mechanisms, the model pays less attention to tools described late in context. The optimal structure is: 1\) Tool schemas \(JSON/XML\) first, 2\) Role/persona definition \('You are a coding assistant...'\), 3\) Output format rules, 4\) Few-shot examples if any. Additionally, appending 'Before answering, check if any of the above tools can help you' immediately before the user's message acts as a retrieval trigger that leverages recency bias to remind the model of the tools defined at the start.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:50:00.693947+00:00— report_created — created