What is tool calling?
Tool calling, also called function calling, is a language model returning a structured request to run a named tool with schema-matching arguments, which application code executes before passing the output back to the model.
A language model only produces output. Tool calling is the contract that lets that output trigger real work. The developer describes each tool with a name, a plain-language description and a JSON schema for its inputs. When the model decides a tool is needed, it returns a structured call instead of prose. The application runs the call and sends the result back in the next request.
Anthropic's documentation puts it plainly: the model never runs anything on its own. Every agent, every MCP integration and every computer use setup sits on top of this mechanism.
How tool calling works
Define the tools
Send the request with the list of tools the model may call, each with a name, description and input schema.
Receive a call
The model replies with one or more tool calls, each naming a tool and giving arguments as JSON.
Execute
Application code validates the arguments and runs the matching function, query or API request.
Return the result
A second request carries the tool output back to the model, linked to the call it answers.
Continue or finish
The model either answers or asks for more tools. Repeating this step is what turns tool calling into an agent loop.
Client tools and hosted tools
Most tools run in the developer's own application: a database lookup, a ticket update, a file write. Model providers also host some tools themselves, such as web search, web fetch and code execution, which run on the provider's infrastructure and return results without a round trip through the application.
Anthropic also publishes schemas for common client tools, such as bash and a text editor, which its models are trained on, so they call them more reliably than a custom equivalent.
Controls that matter in production
Strict schemas
Both Anthropic and OpenAI offer a strict mode that makes tool calls match the declared schema exactly, which removes a whole class of parsing errors.
Tool choice
Callers can let the model decide, force it to call some tool, force one named tool, or forbid tools for a turn.
Parallel calls
Models can request several tools at once. Both APIs let developers switch this off when calls must happen in order.
Tool count
OpenAI's guide suggests keeping fewer than 20 functions available at the start of a turn as a soft guideline. Anthropic's docs say selection accuracy degrades past 30 to 50 tools, which is the problem tool search addresses.
How Motiontic's engineers apply it
Motiontic's engineers design tools around the jobs an agent does rather than one wrapper per API endpoint, following the advice in Anthropic's post on writing tools for agents: fewer, consolidated tools, clear names, concise output and error messages that tell the agent what to try next.
Every write action is validated in code before it runs, and the riskier ones sit behind an approval step, because a well-formed call is not the same as a correct one.
Tool calling in the Anthropic and OpenAI APIs
| Anthropic Messages API | OpenAI API | |
|---|---|---|
| Name in the docs | Tool use (also called function calling) | Function calling (tool calling) |
| Input definition | JSON Schema in input_schema | JSON Schema in parameters; custom tools take free text |
| Exact schema match | strict: true | strict: true |
| Force a call | tool_choice set to any or to a named tool | tool_choice set to required or to a named function |
| One call at a time | disable_parallel_tool_use | parallel_tool_calls set to false |
| Large tool sets | Tool search with defer_loading | tool_search, on gpt-5.4 and later |
Common questions
Is tool calling the same as function calling?
Yes. OpenAI popularised the name function calling and Anthropic calls it tool use; both describe a model returning a structured request for code to run a named function with typed arguments.
Does the model execute the tool itself?
No. The model only returns the call. Application code, or the provider's servers for hosted tools such as web search, runs it and sends the result back.
How many tools can an AI agent have?
There is no hard rule, but accuracy drops as the list grows. OpenAI suggests fewer than 20 at the start of a turn as a soft guideline, and Anthropic recommends tool search once a catalogue passes about ten tools or 10k tokens of definitions.
How does tool calling relate to MCP?
MCP is a protocol for exposing tools from a server in a standard way. Once those tools reach the model, it still uses ordinary tool calling to invoke them.
Related
Model Context Protocol (MCP)
The open standard for plugging tools and data into AI agents.
Programmatic tool calling
The model writes a script that calls the tools, so raw results never fill its context.
Tool search
Load tools when they are needed, not all at once before the work starts.
Agent-computer interface (ACI)
The tools, docs and outputs an agent sees, designed as carefully as a UI.
AI agent development
Agents that do real work for users, with the evals, traces and guardrails to keep them in production.
Tool use examples
Sample calls on a tool definition that teach usage a schema cannot.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.