Tool Use / Function Calling
The ability of an LLM to request execution of external functions, APIs, or tools by returning a structured call that matches a declared schema, so an application or the provider's servers can run it and return the result.
Function calling (OpenAI's and Google's term) or tool use (Anthropic's term) is the mechanism that lets an LLM take actions instead of only generating text. The application sends the model a list of tools, each with a name, a description and a JSON Schema for its parameters. When the model decides a tool is needed, it returns a structured call instead of, or alongside, a text answer. The application runs the function, sends the result back, and the model continues.
The standard loop
- Send the request with tool definitions (name, description, parameters as JSON Schema)
- The model returns one or more calls, for example
{"name": "get_weather", "arguments": {"city": "London"}} - The application executes each call and returns the results, matched to each call's ID
- The model uses the results to answer, or makes further calls
How the main APIs implement it
- Claude (Messages API): Tools go in
toolswith aninput_schema. Claude stops withstop_reason: "tool_use"and returnstool_useblocks, and the application answers withtool_resultblocks. Addingstrict: trueto a tool guarantees its inputs match the schema. Parallel calls are on by default and can be limited withdisable_parallel_tool_use. On Claude Opus 5.5, Sonnet 5.5 and Fable 5.2, forcing a call withtool_choiceset toanyortoolreturns a 400 error; Anthropic's docs recommendautowith strict tools, or structured outputs, instead. - OpenAI (Responses API): Function tools use
"type": "function"withname,parametersandstrict, and results go back asfunction_call_outputitems matched bycall_id. The Responses API normalizes schemas to strict mode when it can, while Chat Completions defaults to non-strict.parallel_tool_calls: falselimits a turn to at most one call, andtool_choiceacceptsauto,required, a named function,allowed_toolsornone. Custom tools take free-form text that can be constrained by a Lark or regex grammar. OpenAI's guide says GPT-6 Astra, GPT-6.1 Sol and GPT-6.1 Terra require the Responses API for tool calling. - Gemini API: Function declarations follow the same name, description and parameters pattern, with
auto,any,noneandvalidatedcalling modes. Gemini can make parallel calls and chain dependent ones (compositional calling), and Gemini 3 series models can combine function calls with built-in tools such as Google Search in one request. Google lists function calling, structured outputs, search grounding, code execution, URL context and computer use as supported on Gemini 4 Argon.
Server tools and MCP
Providers also run tools on their own infrastructure, so the application never executes them. Anthropic's server tools include web search, web fetch, code execution and tool search. For GPT-6 Astra, OpenAI lists web search, file search, code interpreter, hosted shell, computer use, image generation, MCP and tool search. Tool search lets the model load rarely used tool definitions on demand instead of sending every schema with each request: both Anthropic and OpenAI let you mark tools with defer_loading, and OpenAI's tool_search works on GPT-5.4 and later. All three APIs can call remote MCP servers directly: Claude through its MCP connector (in beta, using mcp_servers plus an mcp_toolset entry in tools), OpenAI through an mcp tool with a server_url, and Gemini through the Interactions API, which supports Streamable HTTP servers only.
Multi-step tool use
Agents chain many tool calls to finish a task: search the web, read a document, run a calculation, write a file. Every call and result adds tokens to the context window, so long tool-use chains consume tokens quickly and context size limits how far an agent can go before it needs compaction or summarization. Anthropic and OpenAI also offer programmatic tool calling, where the model writes code that calls your tools inside a sandbox instead of making each call as a separate turn.
Reliability considerations
Models can hallucinate arguments, call tools in the wrong order, or get stuck in loops. Common mitigations:
- Strict schema mode (Claude and OpenAI) or validating arguments before execution
- Clear, specific tool descriptions, which Anthropic's docs call the most important factor in tool performance
- Keeping the active tool set small or using tool search; Google's guidance suggests 10 to 20 active tools at most
- Human approval for irreversible actions (OpenAI's MCP tool has a
require_approvalsetting) - Returning errors in tool results (Claude uses
is_error: true) so the model can recover from failed calls
Related terms
Models relevant to Tool Use / Function Calling
Claude Opus 5.5
Anthropic's current Opus and its recommended starting model, priced at $4/$20 per 1M tokens
View model →Claude Sonnet 5.5
Faster, cheaper mid-tier model for everyday tasks and agentic work
View model →GPT-6 Astra
OpenAI's most capable model for the most demanding work
View model →GPT-6.1 Sol
Near-Astra intelligence for a fifth of the price
View model →Gemini 4 Argon
Google's frontier model for real-world coding, enterprise knowledge work, and cybersecurity defense
View model →