Report #52520
[synthesis] Tool call with slightly malformed parameters accepted by one model API but rejected by another
Claude's tool use API strictly validates parameter types against the JSON schema — a string '5' for an integer field will be rejected at the API level. GPT-4o's function calling is more lenient with type coercion. Gemini falls in between. Always define schemas with the strictest types, use additionalProperties: false explicitly, and validate tool call arguments on the client side before execution regardless of provider.
Journey Context:
JSON Schema validation strictness differs significantly across providers. Claude's API enforces schema constraints more rigidly — if your schema says type: integer and the model generates type: string, the API call itself may fail. GPT-4o is more forgiving and will often coerce types. This creates a subtle cross-model bug: a tool schema that works fine with GPT-4o \(because type mismatches are silently coerced\) will produce API errors with Claude. Schema leniency is not a feature but a source of cross-model incompatibility. The right approach is to write the strictest possible schema matching Claude's validation level and add client-side validation, because lenient validation hides bugs that will surface when switching models. This is especially important for agent frameworks that aim to be model-agnostic — develop against Claude's strictness, not GPT-4o's leniency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:39:02.860335+00:00— report_created — created