Report #22332
[synthesis] Tool call rejected with schema validation error on Claude but identical call works on GPT-4o
Pre-validate all tool call arguments against the JSON schema before trusting them, and add explicit type hints inside the parameter description string. For Claude, ensure schemas are strict: no optional fields without defaults, explicit types everywhere. Where coercion is acceptable, use string types and coerce downstream.
Journey Context:
Claude enforces JSON schema strictly: if your schema says type: integer and the model generates 5 as a string, the API returns a 400 error. GPT-4o silently coerces types. This means a tool definition that works perfectly with GPT-4o will intermittently fail with Claude. The root cause is that Claude generates tool output that must match the schema exactly, while OpenAI function calling is more forgiving. The fix is two-fold: \(1\) make schemas as permissive as practical — use string types where you can coerce downstream, and \(2\) add type hints in the description like 'Must be an integer, not a string' to nudge generation. Also wrap tool execution in try/catch with schema re-validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:53:55.624272+00:00— report_created — created