ModelRefs / Function Calling — AI Glossary
Function Calling — AI Glossary
A model capability that emits structured JSON to invoke external tools or APIs instead of free-form text. Function calling turns LLMs into agents.
Overview
Function calling turns LLMs into agents. The model receives a list of JSON schemas describing available tools and decides when and how to call them. Underpins MCP, OpenAI tools API, and Anthropic's tool use. Parallel function calling allows multiple tool calls in a single response.
Reference details
| Topic | agents |
|---|---|
| Also known as | tool calling, tool use API |
| Last reviewed | 2026-06-24 |
Related terms
How it works
- Tool schemas are serialised into the request alongside the messages, and the provider renders them into the prompt using whatever format the model was trained on.
- The model then emits a structured object naming a tool and supplying arguments, and it does so because tool-calling examples were part of its instruction tuning — this is a trained output mode, not text that the harness parses hopefully.
- The emitted arguments are validated against the schema before anything executes, which is the only stage at which a wrong type or an out-of-range value can be caught.
- Where the provider supports constrained decoding, the schema restricts which tokens may be sampled, so the arguments are guaranteed to parse rather than merely likely to.
- Each call carries an identifier, and the result is appended as a message bound to that identifier, which is what lets several calls issued in one turn be resolved in any order.
- Nothing in this sequence runs anything: the model's output is a request, and execution, sandboxing and authorisation are entirely the harness's work.
Example: What the model actually emits
You pass a schema for get_weather(city, unit). Asked “Is it colder in Oslo or Lisbon?”, the model does not answer from memory — it emits two structured calls, your code executes them, and you return the results for the model to compare. The model never runs anything itself; it only produces the arguments.
// You send the schema; the model returns calls, not prose.
{ "tool_calls": [
{ "name": "get_weather", "arguments": { "city": "Oslo", "unit": "c" } },
{ "name": "get_weather", "arguments": { "city": "Lisbon", "unit": "c" } }
] }
// Your runtime executes both, appends the results, and asks again.
Commonly confused with
Function calling does not execute anything. The model only produces a name and arguments — running them, sandboxing them and validating them is entirely your responsibility. Treating a tool call as pre-authorised is the root of most agent security incidents.
When to use it
Reach for it when:
- The answer depends on live data the model cannot hold
- You need a typed, machine-parseable action rather than prose
- Several independent lookups can run in parallel in one turn
Reach for something else when:
- You only need a structured answer, not an action — use structured output instead
- The tool surface is large and unfiltered; models pick wrong tools as the list grows
- The call has side effects and nothing stands between the model and production
Referenced by
This term is used by the following ModelRefs references:
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Function Calling — AI Glossary.
Frequently asked questions
What is Function Calling?
A model capability that emits structured JSON to invoke external tools or APIs instead of free-form text.
Is Function Calling the same as tool calling?
Yes — tool calling, tool use API are common aliases for Function Calling.
What concepts are related to Function Calling?
Closely related concepts include tool use, agent, mcp, json mode.