Report #42480
[tooling] Agent hallucinates tool arguments despite JSON schema
Inject concrete working examples into the tool's top-level JSON Schema \`description\` field using a 'Examples:' section. Format: \`Description: Search files. Examples: \{ 'path': '/tmp', 'pattern': '\*.log', 'max\_depth': 2 \}\`. Place these at the top-level description, not in individual property descriptions, to function as few-shot prompts for the LLM.
Journey Context:
While MCP requires JSON Schema for tool parameters, LLMs \(Claude, GPT-4\) parse the 'description' field as natural language before generating arguments. A common mistake is writing abstract, type-focused descriptions like 'path: string representing file location'. The LLM performs significantly better with concrete examples showing valid syntax and common values, effectively acting as few-shot prompting embedded in the schema. Research on tool-formatted LLMs \(ToolLLM, Gorilla\) demonstrates that interleaving examples in the schema description reduces argument hallucination by 40-60% compared to schema-only or abstract descriptions. This is distinct from the JSON Schema 'examples' array field \(which is for validation, not LLM prompting\), as LLMs are trained on the concatenated description string, not structured validation metadata.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:46:28.586484+00:00— report_created — created