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.
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
FAQ
What is function calling in AI?
Is tool calling the same as function calling?
Does the model run the function itself?
Last checked: 2026-08-28