What Is Function Calling? How LLMs Use Tools, Explained
Function calling, also called tool calling, lets a model ask your code to run a function you defined, so it can read data and act in systems outside its training set. The model never runs the function itself; it returns a request, your code executes it, and the result goes back.

Key takeaways
- Function calling lets a model request a tool that your code then executes and returns.
- The loop is request, tool call, execute, send the output, then a final response.
- Client tools run in your app; server tools run on the provider's infrastructure.
- Tool definitions count against the context window and are billed as input tokens.
- Keep the starting tool list small and enable strict mode where it is offered.
On this page 10
Function calling, also called tool calling, is how a model reaches outside its training data. You describe the functions it may use, the model asks for one, your code runs it, and the result goes back so the model can answer (OpenAI). The model never executes anything itself, which keeps your code in charge of what actually runs.
TL;DR
- Function calling lets a model request a tool that your code executes and returns.
- The loop is request, tool call, execute, send the output, then a final response.
- Client tools run in your app; server tools run on the provider's infrastructure.
- Tool definitions count against the context window and are billed as input tokens.
- Keep the starting tool list small, and enable strict mode where it is offered.
Disclosure: ZeroRaised publishes this guide and is a launch site for bootstrapped products. Facts come from the linked sources as checked on 2 Nov 2026; ZeroRaised has no commercial relationship with the companies named.
Function calling is a model feature that lets an application expose defined functions to a model, which can then return a structured request to run one, so the model can use data and systems outside its training data.
What is function calling?#
OpenAI describes it plainly: "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" (OpenAI). Anthropic uses the same idea under the tool use label: "Tool use (also called function calling) lets Claude call functions that you define or that Anthropic provides" (Anthropic).
Three terms are worth keeping straight: a tool is a functionality you tell the model it has, a tool call is the model's request to use one, and a tool call output is what your code returns, referenced by a call id (OpenAI).
A function is a tool defined by a JSON schema. Providers also support custom tools with free text input and built-in tools such as web search, code execution and MCP (OpenAI).
How does the five-step loop work?#
The flow is short and worth memorising:
- Send a request that includes the available tools.
- Receive a tool call from the model.
- Execute the matching code on your side.
- Send a second request that includes the tool output.
- Receive a final response, or another round of tool calls.
That is the whole pattern (OpenAI). Everything else is detail around argument validation, permissions and what happens when a tool fails. If you need the tool output itself to follow a schema, see how to get structured output from an LLM.
The important consequence is that you control the boundary. The model proposes, your code decides. If an argument looks wrong, reject it. If the action is irreversible, require a human.
What is the difference between client and server tools?#
With client tools, the function runs in your application: Claude returns a stop reason of tool_use with tool_use blocks, and you send back a tool_result (Anthropic). Server tools, such as web search, web fetch, code execution and tool search, run on Anthropic's infrastructure, and some add usage-based charges (Anthropic).
A client tool can use your database credentials and business rules. A server tool is convenient, but you trust the provider's environment and pay its rates. The guide to building an MCP server covers tool hosting.
What does strict mode do?#
Strict mode makes the model's calls adhere to your schema. OpenAI recommends always enabling it, and it requires additionalProperties set to false with all fields listed as required; optional fields use a null type (OpenAI). Anthropic offers strict: true on custom tools to ensure calls match your schema exactly (Anthropic).
Strict mode is not a substitute for validation. Your code still has to check values, authorise the action and handle errors.
What does tool_choice control?#
tool_choice decides whether the model may call a tool and which one: auto, which is the default, required, a forced specific function, an allowed_tools subset, and none (OpenAI). The allowed_tools subset helps prompt caching. Forcing a function suits a known next step, and none gives a plain answer without tool access.
Parallel tool calls are separate. parallel_tool_calls can be set to false (OpenAI); in our view that is worth doing when order matters or tools change shared state.
What do tool definitions cost?#
Tool definitions are not free metadata. They count against the context limit and are billed as input tokens (OpenAI).
On Anthropic, tool definitions, tool_use blocks and tool_result blocks all add input tokens, plus a tool-use system prompt, which is 286 tokens for Claude Opus 5.5 with auto or none (Anthropic). Server tools can add usage-based charges on top.
A large tool catalogue quietly raises the cost of every request, including ones that never call a tool. The guide to prompt caching explains why a stable tool list is also easier to cache.
What are the best practices?#
OpenAI's docs are mostly about reducing ambiguity:
- Use clear names and descriptions.
- Use enums and structure to prevent invalid states.
- "Pass the intern test": could an intern correctly use the function given only what you gave the model?
- Do not make the model fill arguments you already know.
- Combine functions that are always called in sequence.
- "Aim for fewer than 20 functions available at the start of a turn", which the docs call a soft suggestion.
- Use tool search to defer rarely used tools on GPT-5.4 and later.
All of that is from the OpenAI guide (OpenAI). Each definition costs tokens and attention. The guide to evaluating LLM outputs covers how to test tool selection before you ship.
There is also a behavioural difference to plan for. If required parameters are missing, Anthropic says Opus is more likely to ask, while Sonnet might infer a value, such as guessing "New York, NY" (Anthropic). Validate before you act on a guess.
What is the next step after function calling?#
Programmatic tool calling is the pattern where the agent writes a program that invokes the tools, then runs it end to end in one invocation instead of making one model round trip per call (Factory). Factory made it the default in Droid 1.0 and reports that it cuts Droid's cost by 15% on Claude Opus 5.5 (Factory).
That is an optimisation, not a replacement: you still need the same definitions, validation and permissions. See how Factory made agents write code to call tools for the breakdown, and the agent versus workflow comparison if you are unsure whether you need a loop.
Where ZeroRaised fits#
ZeroRaised is a launch and discovery site for products built without institutional venture capital or accelerator equity. If you ship a developer tool or an AI feature, submit it here and be specific about what it connects to, because buyers search for the integration, not the category. The newsletter carries new analysis like this, and the pricing page explains the listing options. We make no promise of traffic or results.
Sources#
Frequently asked questions
What is function calling in simple terms?
It is a way to give a language model a menu of functions it may ask for. The model replies with a structured request naming a function and its arguments, your code runs that function, and you send the result back so the model can answer.
Does the model execute the function?
No. The model only produces the request, including the arguments. Your application decides whether to run it, runs it with your own credentials and returns the output. That separation is what lets you validate arguments and block dangerous actions.
What is the difference between client and server tools?
Client tools run in your application: the model returns a tool_use block and you send back a tool_result. Server tools, such as web search or code execution, run on the provider's infrastructure, and some add usage-based charges.
How many tools should I give a model?
OpenAI's docs suggest aiming for fewer than 20 functions available at the start of a turn, as a soft guideline. More tools mean more input tokens and more room for the model to pick the wrong one. Tool search can defer rarely used tools.
Is function calling the same as an agent?
No. Function calling is a mechanism. An agent is a system that uses that mechanism in a loop, deciding which tool to call next until a goal is met. You can use function calling for a single lookup without building an agent.