Tool calling
Tool calling, also called function calling, is a model API feature where you describe functions with a schema, the model replies with a structured request to call one, and your code runs it and returns the result.
Also called: function calling, tool use
By Divya Sharma · Checked Nov 15, 2026 · How we review
A model on its own can only write text. Tool calling gives it a reliable way to ask for actions: look up the weather, query a database, send an email. The model never runs anything itself. It produces a structured request, and your application decides whether and how to carry it out.
How it works
You send a list of tools, each with a name, a description and a JSON Schema for its inputs. When the model decides a tool would help, it returns a tool call with the tool name and arguments instead of plain text. Your code runs the function and sends the output back in the next request. The model then answers or calls another tool. Repeating this is the agent loop.
Some providers also run certain tools on their own servers, such as web search, so the application only sees the result.
Example
A user asks "What is the weather in San Francisco?" The model returns a call to get_weather with the location filled in. Your code fetches the forecast and returns it, and the model writes the answer.
Related ideas
Tool schemas are also a way to get structured output, since the arguments follow the schema. The Model Context Protocol standardises how tools are published by MCP servers, so one tool can work with many applications.
Related terms
- AI agent
- An AI agent is a system in which a language model decides its own next steps: it calls tools, reads the results and repeats until the task is done, instead of following a fixed script.
- Model Context Protocol
- The Model Context Protocol (MCP) is an open standard that defines how AI applications connect to external tools, data and prompts, using JSON-RPC messages between a host application, its clients and separate servers.
- Structured output
- Structured output is an API feature that makes a language model's reply follow a format you define, usually a JSON schema, so that code can parse it reliably instead of scraping free text.
- Agent loop
- An agent loop is the repeating cycle at the heart of an AI agent: the model asks for a tool call, the application runs it and returns the result, and the model decides what to do next.
- MCP server
- An MCP server is a program that exposes tools, data resources or prompt templates to AI applications through the Model Context Protocol, so any MCP-compatible client can use them without custom integration code.