Report #12187
[tooling] Agent selects wrong MCP tool or provides malformed arguments due to ambiguous tool schemas
Use Zod schemas with explicit .describe\(\) on every field including examples \(e.g., z.string\(\).describe\('City name, e.g., "San Francisco"'\)\), mark optionals with .default\(\) rather than .optional\(\), and use zod-to-json-schema with 'target' set to 'jsonSchema7' to preserve descriptions
Journey Context:
Many developers rely on TypeScript's automatic type-to-schema conversion, which strips semantic meaning that LLMs need to distinguish between similar tools. Without explicit descriptions, an agent cannot differentiate between a 'search' parameter meaning 'search query' vs 'search filter'. Optional fields without defaults cause agents to hallucinate values or omit required context. The pattern of explicit descriptions with concrete examples reduces tool selection errors by clarifying intent and expected format, which is more reliable than relying on the property name alone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:17:37.670774+00:00— report_created — created