Intermediate

Tool calling: when an AI asks to take action

Tool calling, also known as function calling, lets a language model reply not with text but with a structured request: “run this function with these arguments”. Your application runs the function and sends the result back, and the model uses it to carry on.

Data as of October 22, 2026

Key figures

LevelIntermediate
Origin2023
Introduced bySchick et al. (Toolformer)

How it works in practice

The flow takes a few steps, described in very similar terms in the OpenAI and Anthropic documentation:

  1. Your application describes the available tools to the model: a name, a description and a schema of the expected parameters.
  2. The user asks a question.
  3. If a tool would help, the model replies with a structured call: the tool name and arguments in JSON.
  4. Your code runs the function, for example a request to an API or a database.
  5. The result goes back to the model, which writes the final answer or asks for another tool.

A concrete example

You ask an airline’s assistant: “Is my flight to Lisbon tomorrow on time?” The model has no idea about live flight status. So it produces a call such as flight_status(number="AB 123", date="tomorrow"). The application queries the booking system, returns “delayed by 40 minutes”, and the model turns that into a clear reply.

Chain several calls like this, with decisions in between, and you have an AI agent or an agentic workflow.

Why it matters

Tool calling is the building block that lets a model read fresh data and act inside real software. It underpins agent frameworks, which you can browse on our frameworks page, and the MCP protocol, which standardises how tools are plugged in. The ReAct pattern, which alternates reasoning and acting, also relies on it.

Common mistakes and myths

  • “The model has access to the internet or my systems.” It only reaches the tools you give it, and in the usual setup it does not run them itself.
  • “Arguments are always valid.” Without strict mode, the model can produce malformed or nonsensical arguments. The strict option offered by several providers keeps arguments in line with the schema; see also structured output.
  • “More tools is better.” Each tool adds tokens and room for confusion. A few well-described tools work better.
  • “It is harmless.” A tool that sends email or edits data can be hijacked through prompt injection, so plan for limited permissions and confirmations.

Related terms

Try it

Full glossary

Frequently asked questions

Does the model run the function itself?

Not for tools your application defines. The model only produces the tool name and its arguments; your code runs it and returns the result. Some providers also offer tools that run on their side, such as web search or code execution.

Are tool calling and function calling the same thing?

Yes, in everyday use. Anthropic's documentation says “tool use (also called function calling)” and OpenAI's uses both terms. “Tool” is simply the broader word.

Where does the idea come from?

Several research projects explored models that can use tools. A frequently cited milestone is Toolformer, published in February 2023 by Timo Schick and co-authors, in which a model learns which APIs to call, when, with what arguments, and how to use the result.

Do tool definitions cost tokens?

Yes. Tool descriptions are sent to the model with each request and count as input tokens. A long list of tools therefore raises the bill and can also make it harder for the model to pick the right one.

Data sources

Data as of October 22, 2026

Report an error

Does a figure, a date or a fact look wrong? Tell us: every report is checked.