Report #63996
[synthesis] Identical JSON-schema tool definition produces different parameter types across Claude and GPT-4o
Always validate and coerce tool-call parameter types on the client side after deserialization. Never trust that the model will emit the exact JSON primitive type specified in the schema — wrap every tool invocation in a validation layer that casts, for example, string-encoded integers to actual integers before forwarding to downstream code.
Journey Context:
Developers assume that providing a JSON Schema with \`"type": "integer"\` guarantees the model will pass an integer. In practice, GPT-4o frequently serializes numerically-reasoned values as strings \(e.g. \`"5"\` instead of \`5\`\) when the value originated in natural-language reasoning. Claude is stricter about type fidelity but still occasionally coerces when the schema contains \`oneOf\` or nested refs. The root cause is that both models reason in tokens, not types, and the serialization step from token-stream to JSON can lose type discipline. Client-side coercion is the only universally reliable fix; schema-only enforcement is a suggestion, not a contract.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:54:01.608571+00:00— report_created — created