Report #26282
[counterintuitive] Does function calling guarantee correct tool parameters
Always validate function call parameters before execution. Never trust that model-generated arguments are type-correct, within valid ranges, or logically consistent. Implement server-side validation, default values for missing parameters, and retry logic with error feedback to the model.
Journey Context:
Function calling constrains the model to produce output in a structured format that looks like a function call, but it does not guarantee semantic correctness. Models frequently: hallucinate enum values not in the schema, pass wrong types like a string where a number is expected, omit required parameters, combine parameters in logically impossible ways, and call the wrong function for the stated intent. The model is predicting the most likely token sequence that resembles a valid function call — it does not execute or verify the call. OpenAI's documentation explicitly warns that models may generate hallucinated function calls. For coding agents, every tool execution must be wrapped in validation, and the agent must handle malformed tool calls gracefully rather than crashing or propagating bad arguments into destructive operations like file writes or shell commands.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T22:31:02.520225+00:00— report_created — created