Protocols & Standards

Function Calling / Tool Calling

Also called: Tool Calling · Function Call

Function calling (also called tool calling) is a model capability where the model can output a structured request to invoke a specific function with specific arguments, instead of only producing free-form text.

ModelTool / FunctionStructured call → result
The model emits a structured call instead of free text; the application executes it and returns the result.

A model that can only produce text can describe what it wants to do, but something else has to parse that description and act on it — unreliably, since free text is ambiguous. Function calling gives the model a defined set of functions (name, description, and expected arguments), and when the model wants to use one, it outputs a structured call matching that definition instead of prose.

The calling application is responsible for actually running the function — the model itself doesn't execute anything. It emits the structured intent (which function, with what arguments), the application executes the real logic, and the result is fed back to the model so it can continue reasoning with that new information.

This is the foundational mechanism most agent tool use is built on. Whether an agent is searching the web, running a shell command, or calling an MCP server's tool, the underlying pattern is the same: the model emits a structured call, something executes it, and the result comes back into the conversation.

How it works

The calling application defines each available function with a name, a natural-language description, and a schema for its expected parameters. That definition is included in the model's context. When the model decides a function is relevant, it outputs a structured object — the function name and argument values — instead of natural-language text. The application parses that structured output, runs the actual function with those arguments, and returns the result to the model as a new message, which the model can then use to keep reasoning or to produce its next output.

Example

For instance, a model given a get_weather(location: string) function might, when asked "what's the weather in Tokyo", output a structured call like get_weather({"location": "Tokyo"}) rather than guessing at an answer from its training data; the calling application runs the real lookup and returns the current conditions for the model to report back.

How it differs

Function/tool calling is the underlying mechanism a model uses to invoke a single, defined function. MCP builds on top of that same mechanism to standardize how those functions (and related resources and prompts) get discovered and connected across many different tools and applications, rather than being hand-defined for each one.

Common misconceptions

Often assumed: Function calling means the model directly executes code.
Actually: The model only emits a structured request; the calling application is what actually runs the function and returns the result.
Often assumed: Function calling and MCP are the same thing.
Actually: Function calling is the general mechanism for invoking a single function; MCP is a protocol built on top of a similar mechanism that standardizes how tools (among other things) are discovered and connected across applications.

FAQ

What is function calling in AI?
It's a model capability where instead of free-form text, the model can output a structured request to call a specific function with specific arguments, which the calling application then actually executes.
Is tool calling the same as function calling?
Yes, they're generally used as interchangeable terms for the same capability — a structured, schema-defined call the model can emit instead of plain text.
Does the model run the function itself?
No — the model only produces the structured call; the application hosting the model is responsible for actually executing the function and returning its result.

Last checked: 2026-08-28

Related terms