Guide Developer Tools 6 min read

Tool-definition schemas follow different keyword rules at OpenAI, Anthropic and Gemini

A function-calling tool definition carries a JSON Schema for its arguments, and each provider documents its own rules for which keywords that schema may use. OpenAI requires every field under strict mode, Anthropic lets fields stay optional within a per-request budget, and none of the Gemini pages we read documents a strict flag.

Maya Lin
Digital Platforms Analyst
Published 17 Nov 2026, 7:31 AM (SGT)
Share:
A code editor on a monitor, with a file tree down the left and lines of source code on the right. A code editor on a monitor, with a file tree down the left and lines of source code on the right. Photo by Daniil Komov on Pexels
Advertisement

A tool definition gives a language model a function's name and a JSON Schema for its arguments, and strict mode asks the provider to hold the arguments to that schema. OpenAI's own documentation writes an optional enum field two ways. Its function-calling guide, as read on 16 November 2026, gives a strict get_weather example whose optional units field has the type ["string", "null"] and the enum ["celsius", "fahrenheit"]. Checked with ajv 8.20.0 against draft 2020-12, that field can never be null, since the enum lacks null. The moderation example in OpenAI's structured-outputs guide adds null to the enum in its Go, Java, C# and Ruby versions, where ajv accepts null; its curl version leaves null out. We called no API, so this describes the schemas as printed and says nothing about OpenAI's decoder. OpenAI wants every field required, Anthropic lets fields stay optional within a budget, and none of the Gemini pages we read documents a strict flag.

Strict mode recuts the key differently at OpenAI and Anthropic

OpenAI's function-calling guide sets two requirements for strict mode: additionalProperties must be false on each object, and "All fields in properties must be marked as required." An optional field is written by adding null as a type.

Anthropic's structured-outputs page also requires additionalProperties to be false, but optional parameters may stay optional. They share a budget of 24 per request, across every strict tool schema and JSON output schema. A second cap of 16 per request covers parameters with union types, and the page names type arrays such as ["string", "null"] among them. On our reading, OpenAI's optional-as-null style spends that budget too.

None of the Gemini pages we read documents a strict flag. Its structured-output guide covers response schemas, and its v1beta Interactions API reference says function parameters support "a subset of JSON Schema".

The same keyword jams one lock and slides through another unnoticed

We sorted five keywords by what each page said on 16 November 2026. "Not stated" means the page neither supports nor excludes the keyword.

KeywordOpenAI strictAnthropic strict, raw schemaGemini response schemaGemini Interactions function parameters
additionalPropertiesmust be falsemust be falseboolean or schemanot stated
maxLengthlisted only as unsupported for fine-tuned modelsnot supportedstripped and ignoredignored and not enforced
minimumsupportednot supportedsupportednot stated
recursionsupportednot supportedin examples onlynot stated
maxItemssupportednot supported, our inferenceenforcednot stated

Anthropic lists string constraints as unsupported and says an unsupported feature brings "a 400 error with details", but that applies to a schema sent as written: most of its SDK helpers remove minLength and maxLength and add them to the field's description, and a helper that validates responses still checks them. Gemini's structured-output guide says the API strips and ignores such keywords "rather than returning an error", and the Interactions reference lists eight, maxLength among them, as "ignored and not enforced" in function parameters.

OpenAI names minLength and maxLength only among keywords fine-tuned models "additionally" do not support, and leaves them off its supported list; which rule governs a base model, the page does not say. The Anthropic maxItems cell is our reading of "Array constraints beyond minItems of 0 or 1".

A valid schema can still describe a key that opens nothing

Until a revision dated 16 November 2026, our function-calling schema builder wrote every allowed value as a string, so an integer parameter with values 1 and 2 came out as {"type": "integer", "enum": ["1", "2"]}. We drove the old page in jsdom 30.0.1 on Node 26.13.0 through 96 single-parameter cases and checked each output with ajv 8.20.0. All 96 passed the draft 2020-12 meta-schema, yet 60 of the 72 with an enum described a parameter no value could satisfy, and none set additionalProperties to false. It also stripped hyphens from names.

Advertisement

The revised builder converts allowed values to the parameter's type and refuses the rest. On the same sweep it built 72 outputs, refused 24 and left none unsatisfiable. With strict mode on, all 36 outputs in each format set additionalProperties to false, and the OpenAI ones listed every field as required; those are the two requirements the sweep checks, and both providers document more. Load the get_weather example with OpenAI Responses and strict mode on, and the optional unit comes out required, typed ["string", "null"], with null added to its enum. Under Anthropic Messages it stays optional.

Hyphens fit every published keyhole for function names, and dots fit Gemini's alone

OpenAI's Chat Completions reference allows letters, digits, underscores and dashes in a function name, up to 64 characters. Its Responses reference gives no pattern or length. Anthropic's Define tools page gives ^[a-zA-Z0-9_-]{1,128}$. Google's v1beta generateContent reference also allows colons and dots in a FunctionDeclaration name, up to 128 characters; the Interactions function object states no name rule.

So get-weather fits all three published patterns, weather.get fits only Gemini's, and a 65-character name breaks only the Chat Completions limit. No pattern admits a letter outside ASCII, so a Thai name such as ค้นหา ("search") matches none of them.

OpenAI's Responses API rehangs the door at the top level of the tool

Chat Completions nests the definition, as {"type": "function", "function": {...}}. The Responses reference and the function-calling guide put name, parameters and strict beside type, and the guide says "GPT-6 Astra and GPT-6.1 Sol require the Responses API for tool calling." If strict is left out, Responses requests "will attempt to normalize your schema into strict mode when possible", while "Chat Completions requests remain non-strict by default."

Anthropic puts name, input_schema and strict at the top of each tool, and its reference examples send anthropic-version: 2026-10-21. Gemini's Interactions reference describes a flat function with type, name, description and parameters, and no strict key.

Constrained decoding shapes the key and says nothing about the room behind the door

OpenAI's structured-outputs guide says the feature "constrains completed, non-refusal model output" and that applications must still handle refusals and incomplete responses. Anthropic's page says output might not match the schema when a response stops for "refusal" or "max_tokens", and that string enum values may come back with different capitalisation, so it tells readers to compare them case-insensitively. vLLM's stable tool-calling page, whose source links point at the v0.34.0 tag (PyPI then listed 0.33.0), promises "a validly-parsable function call - not a high-quality one".

OpenAI's guide says "We recommend always enabling strict mode." Anthropic's, for requests that hit its complexity limits, puts "Mark only critical tools as strict" first, and next says each optional parameter "roughly doubles a portion of the grammar’s state space".

All provider pages were read on 16 November 2026; none printed a last-updated date. The null check compiled the OpenAI enum fields as printed with ajv 8.20.0 (Ajv2020, MIT licence). Parsers can disagree about JSON itself, as our guide on why valid JSON is not one predicate shows.

This guide was drafted with a model made by Anthropic, whose API is one of those described here. Where it sets Anthropic's documented rules beside OpenAI's and Google's, weigh that interest.

Advertisement
Maya Lin
Digital Platforms Analyst

Maya Lin covers SaaS platforms, workflow automation, creator tools, and productivity software for RECATOOLS.

View author profile → · Editorial policy

About this byline Maya Lin is a RECATOOLS editorial persona used for platform and productivity coverage. Articles are produced and reviewed under RECATOOLS editorial supervision.

Corrections policy

Advertisement