Book a demo →

Function Calling

Definition

Function calling in the sources: how OpenAI, Anthropic, Google and Mistral define it, how the call loop works, and which checks the docs advise.

In short

Function calling lets a language model ask an application to run a function. The model returns the function name and arguments, the application runs the function and sends the result back. Vendors also call the feature tool calling or tool use. OpenAI advises validating the arguments and Google the function call before the function runs.

What is function calling?

In the sources, function calling means that a language model asks an application to run a function and supplies the arguments. Five sources, retrieved on 6 December 2026, read:

Source and dateWording
OpenAI, “Function calling and other API updates” (13 June 2023)“Developers can now describe functions to gpt-4-0613 and gpt-3.5-turbo-0613, and have the model intelligently choose to output a JSON object containing arguments to call those functions.”
Anthropic, “Tool use with Claude” (page without date)“Claude determines when to call a tool based on the user’s request and the tool’s description.”
Google AI Studio, “Function calling with the Gemini API” (page without date)“Instead of generating text responses, the model determines when to call specific functions and provides the necessary parameters to execute real-world actions.”
Google Cloud, “Introduction to function calling” (last updated 4 December 2026)“When processing a prompt, the model intelligently determines if a tool is needed and, if so, outputs structured data specifying the tool to call and its parameters (for example, get_current_weather(location='Boston')).”
IBM, “What is tool calling?” (no visible date; page metadata 7 March 2025 and 2 March 2026)“Tool calling refers to the ability of artificial intelligence (AI) models to interact with external tools, application programming interfaces (APIs) or systems to enhance their functions.”

In four of the five rows the model decides when or whether to call a function; IBM describes the link to external tools. OpenAI calls the output a “JSON object containing arguments”, Google Cloud “structured data”.

How a function call works

OpenAI's guide (page without date) calls the process “a multi-step conversation between your application and a model via the OpenAI API.” The guide lists five steps:

  1. “Make a request to the model with tools it could call”
  2. “Receive a tool call from the model”
  3. “Execute code on the application side with input from the tool call”
  4. “Make a second request to the model with the tool output”
  5. “Receive a final response from the model (or more tool calls)”

Mistral (page without date) also counts five steps, Google AI Studio four, with the same order. Google heads its step 3 “Execute Function Code (Your Responsibility)”.

Order of steps as in the OpenAI function calling guide, retrieved on 6 December 2026. The model does not run the function; the application does.

Function calling, tool calling and tool use

The wording differs from row to row:

Source and dateWording
OpenAI, “Function calling” guide (page without date)“Function calling (also known as tool calling) provides a powerful and flexible way for OpenAI models to interface with external systems and access data outside their training data.”
Anthropic, “Tool use with Claude” (page without date)“Tool use (also called function calling) lets Claude call functions that you define or that Anthropic provides.”
Google Cloud, “Introduction to function calling” (last updated 4 December 2026)“Function calling, also known as tool use, provides the LLM with definitions of external tools (for example, a get_current_weather function).”
Mistral, “Function Calling” (page without date)“Function calling, under the Tool Calling umbrella, allows Mistral models to connect to external local tools.”
Hugging Face, Transformers, “Tool use” (page without date)“Chat models are commonly trained with support for ‘function-calling’ or ‘tool-use’.”

IBM leads with tool calling (see the section on MCP and agents). OpenAI's guide separates two kinds of tools: “We’ll show how to use function tools (defined by a JSON schema) and custom tools which work with free form text inputs and outputs.” Google Cloud asks for functions defined “in the OpenAPI schema format”; neither page says whether the two formats are the same. None of the sources quoted here names a technical difference between function calling and tool calling.

Who runs the function

Three vendor pages state that the model only asks and the application runs the code. Google AI Studio: “The model doesn't execute the function itself.” Anthropic, “How tool use works” (page without date): “The model never runs anything on its own.” OpenAI's guide: “When the model calls a function, you must execute it and return the result.”

Anthropic names an exception for some of its own tools. The same page sorts tools into groups: “Every tool falls into one of three buckets, and the bucket determines what your application is responsible for.” For tools the user defines and for tools whose schema Anthropic publishes, the code runs in the application. For the third group the page says: “For web_search, web_fetch, code_execution, and tool_search, Anthropic runs the code.”

Grouping from the Anthropic page How tool use works, retrieved on 6 December 2026.

Checks before the function runs

OpenAI's API reference “Create chat completion” (page without date) warns about the arguments: “Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema.” The next sentence: “Validate the arguments in your code before calling your function.” Google AI Studio lists a related step under “Best practices”: “Validate function calls before executing.”

OpenAI's guide describes a setting for the schema: “Setting strict to true will ensure function calls reliably adhere to the function schema, instead of being best effort.” The guide adds: “We recommend always enabling strict mode.” Neither OpenAI page says whether strict mode replaces the check in code.

OpenAI's announcement of 13 June 2023 cites a proof-of-concept exploit that illustrates how “untrusted data from a tool’s output can instruct the model to perform unintended actions” and advises: “Developers can protect their applications by only consuming information from trusted tools and by including user confirmation steps before performing actions with real-world impact, such as sending an email, posting online, or making a purchase.” Checks on tool calls are the subject of the AI guardrails entry.

Function calling, MCP and AI agents

The sources place function calling at three levels: the call of one function, a protocol through which servers offer tools, and agents.

Source and dateWording
OpenAI, “MCP servers” (page without date)“In addition to tools you make available to the model with function calling, you can give models new capabilities using remote MCP servers or Secure MCP Tunnel.”
MCP specification, “Tools”, version 2026-07-28 (page metadata 24 November 2026)“The Model Context Protocol (MCP) allows servers to expose tools that can be invoked by language models.”
IBM, “What is tool calling?” (no visible date)“Tool calling, sometimes referred to as function calling, is a key enabler of agentic AI.”

OpenAI sets MCP servers next to function calling, the MCP specification describes tools offered by servers, and IBM ties tool calling to agentic AI. The protocol has its own MCP entry, and the loop of an agent is covered in the AI agent entry.

Research and benchmarks

Two papers on arXiv describe models that call APIs, each in one version. Schick et al., “Toolformer: Language Models Can Teach Themselves to Use Tools” (arXiv 2302.04761, version 1, 9 February 2023): “We introduce Toolformer, a model trained to decide which APIs to call, when to call them, what arguments to pass, and how to best incorporate the results into future token prediction.” Patil et al., “Gorilla: Large Language Model Connected with Massive APIs” (arXiv 2305.15334, version 1, 24 May 2023): “We release Gorilla, a finetuned LLaMA-based model that surpasses the performance of GPT-4 on writing API calls.”

The Berkeley Function Calling Leaderboard (last updated 12 April 2026) writes: “The Berkeley Function Calling Leaderboard (BFCL) V4 evaluates the LLM's ability to call functions (aka tools) accurately.” The leaderboard defines two modes: “FC = native support for function/tool calling.” and “Prompt = walk-around for function calling, using model's normal text generation capability.”

Anthropic's article “Claude can now use tools” (30 May 2024) reports: “Tool use, which enables Claude to interact with external tools and APIs, is now generally available across the entire Claude 3 model family on the Anthropic Messages API, Amazon Bedrock, and Google Cloud's Vertex AI.” OpenAI's announcement dates from 13 June 2023.

Other meanings of “function calling”

In programming, a function call runs a function in code. The Python language reference (section 6.3.3, last updated 5 December 2026) writes: “A call calls a callable object (e.g., a function) with a possibly empty series of arguments”. Searches such as “function call” or “how to call a function in python” use that sense. This entry covers language models only.

AI agent. The loop in which a model uses tools toward a goal is covered in the entry on AI agents.

Model Context Protocol. Servers that offer tools to applications; the Model Context Protocol entry describes the protocol.

WebMCP. Tools that a web page offers to agents are the subject of the WebMCP entry.

AI guardrails. Checks on tool calls and tool responses; the entry on AI guardrails sets them out.

Prompt injection. Instructions hidden in content that a model reads; the prompt injection entry covers them.

Source

Frequently asked questions

What is the definition of function calling?

Anthropic writes “Tool use (also called function calling) lets Claude call functions that you define or that Anthropic provides.” Google's Gemini API page writes “Function calling lets you connect models to external tools and APIs.” OpenAI's guide names tool calling as another word for the same feature.

What is tool calling vs function calling?

The sources use both words for one feature. OpenAI writes “Function calling (also known as tool calling)” and Google Cloud “Function calling, also known as tool use”. IBM puts it the other way round: “Tool calling, sometimes referred to as function calling”. None of the sources quoted here describes a technical difference.

What is function calling in LLM?

The model returns a request instead of running anything. OpenAI's guide describes “a function containing a name and JSON-encoded arguments”. Google AI Studio states “The model doesn't execute the function itself.” The application runs the function and sends the result back, and the model then writes the final answer or asks for another call.

What is an example of a function call?

OpenAI's announcement of 13 June 2023 lists five example functions. One converts “Email Anya to see if she wants to get coffee next Friday” to “send_email(to: string, body: string)”, another turns “What’s the weather like in Boston?” into a call of get_current_weather with location and unit. Google Cloud shows “get_current_weather(location='Boston')” as its example.

How does a tool call work?

Anthropic's page “How tool use works” describes what the model does and what follows: “It emits a structured request, your code (or Anthropic’s servers) runs the operation, and the result flows back into the conversation.” OpenAI's guide lists five steps, from sending the tools to “Receive a final response from the model (or more tool calls)”.