{"slug": "validating-openai-anthropic-tool-calling-schemas", "title": "Validating OpenAI & Anthropic Tool-Calling Schemas", "summary": "A developer built a free browser-based validator that checks OpenAI and Anthropic tool-calling schemas for common structural mistakes before they reach a live model. The tool catches issues such as missing root type 'object', absent descriptions, and missing 'additionalProperties: false', which can cause silent failures or wrong tool calls.", "body_md": "Tool/function calling only works as well as the schema behind it. A structurally valid schema can still make an agent call your tool wrong — and a subtly broken one can fail silently. This post covers what actually goes wrong, how to catch it before it reaches a live model, and a worked example.\n\nOpenAI and Anthropic both wrap a standard JSON Schema in a tool/function definition — they just nest it under a different field name.\n\n**OpenAI (function calling):**\n\n```\n{\n  \"name\": \"get_weather\",\n  \"description\": \"Get the current weather for a given location.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"location\": { \"type\": \"string\", \"description\": \"City and state, e.g. San Francisco, CA\" },\n      \"unit\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"] }\n    },\n    \"required\": [\"location\"],\n    \"additionalProperties\": false\n  }\n}\n```\n\n**Anthropic (tool use):** identical shape, just `input_schema`\n\ninstead of `parameters`\n\n.\n\n```\n{\n  \"name\": \"get_weather\",\n  \"description\": \"Get the current weather for a given location.\",\n  \"input_schema\": {\n    \"type\": \"object\",\n    \"properties\": { \"location\": { \"type\": \"string\" }, \"unit\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"] } },\n    \"required\": [\"location\"],\n    \"additionalProperties\": false\n  }\n}\n```\n\n**Root type isn't \"object\".** Both providers expect tool arguments to arrive as a JSON object. A schema whose root `type`\n\nis anything else gets rejected or behaves unpredictably — a one-line fix, but the single most common structural mistake.\n\n**Missing or vague description fields.** Not a JSON Schema violation —\n\n`description`\n\nisn't required by the spec — but it's what the model actually reads to decide when and how to call the tool, and what to put in each argument. A schema that's technically valid but under-described leads to wrong calls, not errors.**No additionalProperties: false.** Without it, a model that hallucinates an extra argument still passes validation. Setting it to\n\n`false`\n\ncatches the hallucination immediately instead of letting it reach your function's implementation.**Overly nested or ambiguous schemas.** Deep nesting, ambiguous `oneOf`\n\nbranches, or a huge flat list of optional fields all increase the model's chance of guessing wrong. Flatter, more explicit schemas produce more reliable calls.\n\n**Enum values that don't match what you actually accept.** An `enum`\n\nthat's stale relative to your function's real implementation is a silent mismatch — the schema will validate, but the call can still fail downstream.\n\n`name`\n\nand `description`\n\nboth present and specific?`type`\n\nset to `\"object\"`\n\n?`additionalProperties: false`\n\nset, unless you have a specific reason not to?All six of these are checkable offline, without a live model call. I built a free tool that runs exactly this checklist: [AI Tool / Function Calling Schema Validator](https://www.json-util.com/ai-tool-schema-validator) — paste a tool definition, pick OpenAI or Anthropic, and it validates structure, compiles the schema, and checks sample arguments against it, entirely in your browser, no API calls.\n\n**Before** — technically parseable, but has three of the problems above:\n\n```\n{\n  \"name\": \"search\",\n  \"parameters\": {\n    \"properties\": {\n      \"q\": { \"type\": \"string\" },\n      \"limit\": {}\n    }\n  }\n}\n```\n\nNo `description`\n\n(the model has almost nothing to go on), no root `type: \"object\"`\n\n, no `required`\n\n, and `limit`\n\nhas no type at all.\n\n**After:**\n\n```\n{\n  \"name\": \"search\",\n  \"description\": \"Search the product catalog by keyword and return matching items.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"q\": { \"type\": \"string\", \"description\": \"Search keywords\" },\n      \"limit\": { \"type\": \"integer\", \"minimum\": 1, \"maximum\": 50, \"description\": \"Max results to return\" }\n    },\n    \"required\": [\"q\"],\n    \"additionalProperties\": false\n  }\n}\n```\n\nPaste your own tool definition into the [AI Tool Schema Validator](https://www.json-util.com/ai-tool-schema-validator) and run through this exact checklist automatically, including testing sample arguments against the compiled schema. Nothing is sent to OpenAI, Anthropic, or any server — it's a structural, offline check only.", "url": "https://wpnews.pro/news/validating-openai-anthropic-tool-calling-schemas", "canonical_source": "https://dev.to/jsonutiltools/validating-openai-anthropic-tool-calling-schemas-535", "published_at": "2026-08-24 19:23:25+00:00", "updated_at": "2026-08-24 19:43:58.061849+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "large-language-models"], "entities": ["OpenAI", "Anthropic", "json-util.com"], "alternates": {"html": "https://wpnews.pro/news/validating-openai-anthropic-tool-calling-schemas", "markdown": "https://wpnews.pro/news/validating-openai-anthropic-tool-calling-schemas.md", "text": "https://wpnews.pro/news/validating-openai-anthropic-tool-calling-schemas.txt", "jsonld": "https://wpnews.pro/news/validating-openai-anthropic-tool-calling-schemas.jsonld"}}