Report #7817
[tooling] LLM selects wrong tool or hallucinates parameters due to ambiguous JSON Schema without semantic descriptions
Define tool input schemas using Zod with .describe\(\) on every field including examples \(e.g., z.string\(\).describe\('ISO 8601 datetime, e.g., 2024-01-01T00:00:00Z'\)\), convert via zod-to-json-schema, and regenerate types whenever tools change
Journey Context:
Most examples show bare JSON Schema or simple Zod objects without descriptions. Claude uses field descriptions as the primary signal for disambiguating between similar tools \(e.g., distinguishing 'since' from 'until' in date filters\). Without .describe\(\), the schema is just type information, leading to hallucinated enum values or wrong tool selection. Zod provides runtime validation that catches malformed calls before they hit business logic. The pattern requires maintaining Zod schemas as source-of-truth, not generating them from types.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:46:28.474668+00:00— report_created — created