Report #64424
[synthesis] Optional tool parameters arrive as null, absent, or empty string depending on model provider
Normalize tool call arguments at the orchestration layer before passing to business logic. Implement middleware that: \(1\) treats absent keys and null values equivalently, \(2\) coerces empty strings to null for optional string fields, \(3\) validates against the tool schema post-normalization. Alternatively, make all parameters required in the schema and use sentinel default values.
Journey Context:
OpenAI's function calling spec allows omitting optional parameters from the arguments JSON entirely when the model has no value. Claude's tool use implementation frequently includes optional keys with null values. Gemini may send empty strings for optional string-type parameters. Downstream code that checks \`if \(args.param\)\` works for absent keys and null but fails for empty strings; code that checks \`if \('param' in args\)\` works for null but not absent keys. No single defensive pattern covers all three behaviors without normalization. The synthesis insight is that the JSON Schema \`required\` field is a suggestion not a contract — models interpret optionality differently, and your code must handle all three representations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:37:09.685647+00:00— report_created — created