Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Tool Calling

nounAI Agents and Autonomous Systemsalso tool use, LLM tool use, tool use in language models

In one line

Tool calling is the ability of a language model to request that an external function or service be run, by producing a structured call with a name and arguments, so that it can fetch information or take actions beyond generating text.

Tool calling is the ability of a language model to request that an external function or service be run, by producing a structured call with a name and arguments, so that it can fetch information or take actions beyond generating text. A model on its own cannot check today’s weather, query a company database or send an email. With tool calling, the application describes the available tools, the model decides when one is needed and writes a call such as get_weather with the argument city set to Lisbon, the application runs it and the result is returned to the model, which then continues. It is the mechanism that turns a language model into an AI agent.

How it works

  1. Define tools: the developer describes each tool with a name, a plain-language description and a schema for its parameters, usually in JSON Schema.
  2. Send the request: the tool definitions are supplied to the model along with the conversation.
  3. Model decides: based on the request, the model either answers directly or outputs a tool call with arguments.
  4. Application executes: the application, not the model, runs the function and captures the result or error.
  5. Return the result: the output is added to the conversation as a tool message.
  6. Continue: the model reads the result and writes the answer or requests another call.

The model never executes code by itself: it only produces text that the application interprets as a request. This separation allows the application to validate arguments, enforce permissions and refuse calls.

Tool calling and function calling

The terms are closely related and often used interchangeably. Function calling was the name used when providers first introduced the feature, and it emphasizes the model producing arguments for a named function. Tool calling is the broader term, since tools may include built-in capabilities such as web search, code execution and file reading, as well as developer-defined functions and remote services.

How models learn to use tools

Models are trained, through fine-tuning on examples of calls and through reinforcement learning, to recognize when a tool is useful, choose the right one, fill in arguments correctly and use the result. Training data includes tool descriptions, sample calls and error cases. Methods such as ReAct combine reasoning steps with calls, helping the model plan which tool to use and how to react to results.

Kinds of tools

  • Information retrieval: web search, document search, databases and vector search.
  • Computation: calculators, code interpreters and data analysis environments.
  • Actions: sending messages, creating tickets, booking, updating records or controlling devices.
  • Other models and agents: calling a specialist model or another agent.
  • Interfaces to software: browsing, file systems and graphical interfaces, see computer use.
  • Structured data extraction: calling a tool whose parameters form the desired schema, a trick that yields structured output.

Designing good tools

Tool quality strongly affects agent success.

  • Clear names and descriptions: explain what the tool does, when to use it and when not to.
  • Precise parameters: use types, enumerations and descriptions for each argument.
  • Few, distinct tools: too many overlapping tools confuse the model.
  • Helpful outputs: return concise, relevant results, with clear error messages that suggest what to try next.
  • Safe defaults: make dangerous actions explicit and reversible where possible.
  • Idempotency: design calls so that repeating them does not cause duplicate effects.
  • Pagination and limits: avoid returning huge outputs that flood the context window.

Parallel and multi-step calls

Modern models can request several independent calls at once, such as fetching weather for three cities, and the application can run them in parallel to save time. Agents also chain calls over many steps, using the result of one to decide the next. Developers set limits on the number of steps and on spending, and they may require the model to explain or confirm before consequential calls.

Standards and protocols

Integrating each tool with each model by hand does not scale, so standards have emerged. The model context protocol defines a common way for applications to expose tools, data and prompts to models, and the agent-to-agent protocol addresses communication between agents. Providers also support shared schema formats for describing tools.

Risks and safeguards

  • Wrong or invented calls: a model may choose the wrong tool, supply bad arguments or invent a tool that does not exist. Validate against schemas and reject unknown tools.
  • Unintended actions: broad permissions let mistakes cause real harm. Apply least privilege and approvals.
  • Prompt injection: content returned by a tool, such as a web page, may contain instructions that try to hijack the model, see prompt injection.
  • Data leakage: arguments and results may expose sensitive information to third-party services.
  • Cost and loops: repeated calls can waste money or never end.
  • Reliability of tools: failures, delays and bad data affect results.
  • Accountability: logs should record who authorized each action.

A worked example

A user asks a travel assistant: what is the cheapest flight from Lagos to Accra next Friday, and add it to my calendar. The model calls a flight search tool with origin, destination and date. The application runs the search and returns five options. The model picks the cheapest, asks the user to confirm because booking costs money, then calls the calendar tool to add the trip. Each call is validated against its schema, and the entire exchange is logged. If the search tool times out, the model receives an error message and tries once more before telling the user.

Evaluating tool use

Tool use is evaluated by whether the model picks the right tool, supplies correct arguments, handles errors and reaches the goal. Benchmarks such as the Berkeley Function Calling Leaderboard and tau-bench test these abilities across many tools and multi-turn conversations. Teams build their own test sets from real requests, check the calls against expected ones, and measure success, number of calls, cost and safety violations. Failures usually trace to unclear tool descriptions, overlapping tools or missing validation, which are cheaper to fix than the model.

History

Before tool calling, developers wrote prompts that asked a model to output text in a format a program could parse, an approach that was fragile. Research in 2022 and 2023 on ReAct, MRKL systems and Toolformer showed the promise of models that choose tools. Providers then built the capability into their interfaces, with defined message types and schema validation, and training aimed specifically at accurate calls. Since 2024, shared standards have reduced the work of connecting tools to different models.

Practical tips

Start with a few well-described tools and test them with realistic requests. Write descriptions as if instructing a new colleague, including examples of correct use. Return only the data the model needs, and include identifiers it can use in later calls. Log every call. Add confirmation for actions that spend money, delete data or contact people, and keep a human able to review what the system has done.

FAQs

Does the model run the tool itself? No. It produces a structured request, and the application runs the tool and returns the result.

Is tool calling the same as plugins? Plugins were an early packaging of the idea. Tool calling is the underlying capability.

How many tools can a model handle? It varies, but accuracy often drops when dozens of similar tools are offered, so selection and clear descriptions matter.

More in AI Agents and Autonomous Systems

Key facts

  • Toolformer, published by Schick and colleagues in 2023, showed that a language model can learn to decide which application programming interfaces to call and with what arguments.1
  • OpenAI added function calling to its API in June 2023, and other providers have since added similar tool use features.2
  • The Model Context Protocol, introduced by Anthropic in November 2024, standardizes how applications expose tools and data to language models.3

Related concepts

Quick checkWhat is tool calling?Show answer

It is the ability of a language model to request that an external function or service be run, by producing a structured call with a name and arguments, so that it can fetch information or take actions.

Sources

  1. Schick et al., Toolformer: Language Models Can Teach Themselves to Use Tools, https://arxiv.org/abs/2302.04761
  2. OpenAI, Function calling guide, https://platform.openai.com/docs/guides/function-calling
  3. Anthropic, Introducing the Model Context Protocol, https://www.anthropic.com/news/model-context-protocol

Editorially reviewed by Specialty Digest Editorial TeamLast reviewed November 17, 2026Researched and drafted with AI assistanceReport an issue