Contents
At a glance
- Category
- Core agent concept
- Also called
- Tool use, function calling
- What the model does
- Emits a structured request naming a tool and its arguments
- What your code does
- Validates, executes, returns the result to the model
- Cost impact
- Every tool definition is re-sent in the context on every call
- Main failure mode
- Wrong tool chosen, or plausible but invalid arguments
What tool calling is
Tool calling is how a language model reaches outside itself. You describe a set of functions to the model - a name, a plain-English description, and a schema for the arguments - and instead of answering in prose, the model can reply with a structured request: call lookup_customer with { "phone": "+15551234567" }. Your code runs that function, sends the result back, and the model continues with information it could not have known.
The vocabulary is unfortunately doubled. Providers originally shipped this as function calling and later renamed it tool use or tool calling as the tool list grew to include things the provider runs itself, like code execution or web search. For everyday purposes they are the same mechanism, and the difference is covered on the function calling page.
How the request-response loop works
The important thing to understand is that the model never runs anything. It only emits a request. Your application is the one that executes code, holds the credentials and decides whether the call is allowed. The loop looks like this:
- You send the conversation plus the tool definitions to the model.
- The model replies with either a final answer or one or more tool-call requests, each with a name and JSON arguments.
- Your code validates the arguments, runs the corresponding function, and appends the result to the conversation as a tool result.
- The model reads the result and either answers or asks for another tool.
That loop is the entire engine of every AI agent. Steps two and three are where all your control lives: you can reject a call, rewrite its arguments, require approval, or return an error message that the model then has to handle.
Limits, cost and failure modes
Every tool definition sits in the context window on every single call, so twenty verbose tool descriptions are a permanent tax on every run. Keep descriptions tight and the list short - most agents perform better with six well-named tools than twenty overlapping ones, because the model's most common failure is picking the wrong tool rather than mis-filling the arguments.
The second failure mode is hallucinated arguments: a plausible customer ID that does not exist, a date in the wrong format, an enum value you never defined. Validate every argument against the schema before executing, and return a clear error rather than throwing - models are good at correcting on a second attempt when they are told precisely what was wrong. The third is loops, where the model calls the same tool repeatedly; cap the number of steps per run.
What you should know
Treat every tool as a permission grant. A tool that can send an SMS is the ability to text your customers; a tool that can issue a refund is the ability to move money. Default to read-only tools, add write tools one at a time, and route anything irreversible through a human approval step. Tool descriptions are also an injection surface - if a tool returns text pulled from an email or a web page, that text can contain instructions, which is the prompt injection problem.
If you are standardising tools across several agents, look at MCP, which turns tool definitions into a reusable server rather than something re-implemented per project.
Tool calling FAQ
What is tool calling in simple terms?
You give the model a menu of functions it is allowed to ask for. Instead of guessing an answer, it says 'run lookup_customer with this phone number'. Your code runs it and hands back the result, and the model carries on with real data. The model never executes anything itself - it only fills in the order slip.
Is tool calling the same as function calling?
Effectively yes. Function calling was the original name; providers now say tool use or tool calling because the tool list grew to include provider-hosted capabilities like web search and code execution alongside your own functions. The wire format and the loop are the same.
How many tools should one agent have?
Usually six or fewer. Every definition is re-sent on every model call, so a long list costs money on every step, and the most common agent failure is selecting the wrong tool from an overlapping menu. If you need more, split the work across specialised agents rather than growing one menu.
What happens when the model calls a tool with bad arguments?
That is your code's problem to catch. Validate against the schema first, and when validation fails, return a readable error as the tool result rather than crashing. Models correct well on a second attempt when the error names the field and the expected format. Also cap retries so a stubborn model cannot loop forever.
Can tool calling be dangerous?
Every tool you add is a permission you have granted. A send-email tool means the model can email your customers; a refund tool means it can move money. Default to read-only, add write access one tool at a time, and put a human approval step in front of anything irreversible or externally visible.
Do no-code platforms support tool calling?
Yes. n8n, Make and Zapier all expose an AI agent node where each connected sub-node becomes a tool the model can call, and the description you type is what the model reads. The same rules apply: few tools, clear descriptions, read-only first, human approval on anything expensive.
Primary source
OpenAI - Function calling guide
Checked August 2026. Anything priced or rate-limited moves, so verify against the source before you budget.
Want this built rather than explained?
Knowing what tool calling means is one thing; having it running in your business is another. We scope one workflow at a time, quote a fixed price in writing after a free consult, build it, and hand it over with documentation you own.
