Brief in AI engineering
LLM tool calling formats
Field names, shapes and limits for tool definitions and tool calls in the Anthropic, OpenAI and Gemini APIs.
- Changed 4 Dec 2026
- Sources read 4 Dec 2026
- 8 sources
- Version 1
- About 1,350 tokens
- Needed by both models tested, 4 Dec 2026
Anthropic nests the schema as input_schema and returns tool_use content blocks. OpenAI Responses uses flat function tools and function_call items with a JSON string of arguments. Gemini has two shapes: generateContent parts (functionCall, functionResponse) and Interactions API steps (function_call, function_result).
Facts
| Item | Anthropic Messages | OpenAI | Gemini generateContent |
|---|---|---|---|
| Tool name limit | regex ^[a-zA-Z0-9_-]{1,128}$ [1] |
Chat Completions: a-z, A-Z, 0-9, underscores and dashes; at most 64 characters [6] | Function declaration: a-z, A-Z, 0-9, underscores, colons, dots and dashes; at most 128 characters [8] |
| Result sent back | tool_result block in a user message with tool_use_id, optional content, optional is_error [2] |
Responses: input item {type: "function_call_output", call_id, output} [5] |
functionResponse part with name, response object and the matching id [8] |
| Choice modes | tool_choice type auto, any, tool or none [1] |
Responses: tool_choice "auto", "required", "none", {type: "function", name} or allowed_tools [5] |
functionCallingConfig.mode AUTO, ANY, NONE or VALIDATED [8] |
- Anthropic:
tool_choiceautois the default when tools are given [1]. - Anthropic:
tool_choicenoneis the default when no tools are given [1]. - Anthropic:
tool_choiceanyortoolreturns a 400 error on Claude Fable 5.2, Claude Mythos 5.2, Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1 and Claude Mythos 5.1 [1]. - Anthropic:
disable_parallel_tool_use: truegoes inside thetool_choiceobject; it is not a top-level parameter [3]. - Anthropic: with
tool_choiceauto,disable_parallel_tool_use: truemeans at most one tool call per response [3]. - Anthropic: with
tool_choiceanyortool,disable_parallel_tool_use: truemeans exactly one tool call [3]. - Anthropic:
strict: trueon a tool uses grammar-constrained sampling [4]. - Anthropic: the compiled strict schema is cached for up to 24 hours since last use [4].
- OpenAI Responses: when
strictis omitted, it tries to make the schema strict and falls back to non-strict [5]. - OpenAI Chat Completions: function calling is non-strict by default [5].
- OpenAI: built-in tools cannot be in a parallel function-call batch [5].
- OpenAI Chat Completions:
parallel_tool_callsdefaults to true [6]. - Gemini:
VALIDATEDmode lets the model answer in text or call a function [8]. - Gemini:
VALIDATEDmode validates function calls with constrained decoding [8]. - Gemini:
allowedFunctionNamesshould only be set when the mode isANYorVALIDATED[8]. - Gemini: the function calling guide uses the Interactions API at
v1beta/interactions[7]. - Gemini Interactions API: a tool is flat:
{type: "function", name, description, parameters}[7]. - Gemini Interactions API: a call comes back as a
function_callstep with anid[7]. - Gemini Interactions API: a result goes back as a
function_resultstep whosecall_idis thatid[7]. - Gemini Interactions API: the mode is
tool_choiceingeneration_config:auto(default),any,noneorvalidated[7].
Use it for
- Translating one tool definition and one call/result loop between the three APIs.
- Checking tool names against each vendor's character set and length limit.
- Choosing how to force, forbid or serialize tool calls per vendor and model.
- It does not cover token cost of tool definitions, server-side tools, or JSON Schema subsets.
Sources
- [1] Define tools, Anthropicread 4 Dec 2026
- [2] Handle tool calls, Anthropicread 4 Dec 2026
- [3] Parallel tool use, Anthropicread 4 Dec 2026
- [4] Strict tool use, Anthropicread 4 Dec 2026
- [5] Function calling, OpenAIread 4 Dec 2026
- [6] Create chat completion, OpenAIread 4 Dec 2026
- [7] Function calling with the Gemini API, Googleread 4 Dec 2026
- [8] Gemini API reference, Tool and FunctionCallingConfig, Googleread 4 Dec 2026
Tested
Tested 4 Dec 2026: claude-haiku-5-5 stated 3 of its 23 facts without this page and 22 with it; claude-fable-5-2 stated 2 of its 23 facts without this page and 23 with it.
Changes
- Opened on mysi.4 Dec 2026
Cite as: mysi, LLM tool calling formats, mysi.dev/llm-tool-calling-formats, version 1, changed 2026-12-04. Text and data CC BY 4.0.