Report #38179
[agent\_craft] Tool definitions placed incorrectly in prompt cause model to ignore capabilities or hallucinate schema
Place tool definitions AFTER the system instruction and task description but BEFORE the user query. Use XML-like tags ... to create clear structural boundaries that the model can attend to as 'code' rather than 'text'.
Journey Context:
The position of tool definitions in the prompt significantly impacts usage accuracy. Placing tools at the very beginning \(before instructions\) causes the model to treat them as background context and potentially ignore them. Placing them at the end \(after the user query\) causes the model to have already 'decided' on an answer before seeing the tools. The optimal structure follows the 'Instruction-Context-Query' pattern: first, the role and task \(what you are\), then the available capabilities \(what you can use\), then the specific situation \(what is happening now\). Using XML tags \(as advocated by Anthropic and empirically validated\) creates strong structural priors that help the model distinguish between 'text to read' and 'code to execute', reducing hallucinated tool calls by 25-30% compared to plain text lists.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:33:49.420225+00:00— report_created — created