Function Calling
Also known as: Tool calling, Tool use
Capability that lets a language model request calls to external functions or APIs with structured arguments, connecting it to tools, data and actions.
Function calling, also known as tool use, lets a large language model interact with software beyond itself. A developer describes available tools to the model, typically with a name, a description and a schema for the arguments, often written in JSON. When a user's request would benefit from a tool, such as checking the weather, querying a database, running code or sending an email, the model outputs a structured request naming the function and its arguments. The application executes the call and returns the result to the model, which uses it to continue.
Research in 2022 and 2023, including the ReAct framework and Meta's Toolformer, showed that language models could learn when and how to use tools. OpenAI added function calling to its API in June 2023, and other model providers soon offered similar features. In November 2024 Anthropic introduced the Model Context Protocol, an open standard for connecting models to tools and data sources that was subsequently adopted widely across the industry. Models are trained specifically to decide when a tool is needed and to produce well-formed calls.
Function calling is the mechanism that turns a chatbot into an agent, letting models retrieve current information, perform exact calculations and take actions in other systems; it is foundational to agentic AI. It also expands the attack surface. A model that reads untrusted content may be manipulated by prompt injection into calling tools in harmful ways, so applications should validate arguments, restrict permissions, sandbox execution and ask users to confirm consequential actions. Clear tool descriptions and well-designed APIs strongly affect how reliably models use them.
Key points
- Function calling lets a model emit structured requests that an application executes as tool calls.
- Tools are described to the model with names, descriptions and argument schemas, often in JSON.
- OpenAI added function calling to its API in 2023, and Anthropic introduced the Model Context Protocol in 2024.
- Validating arguments and limiting tool permissions help contain prompt injection risks.
Related entries
Agentic AI
AI systems that pursue goals by planning and carrying out multi-step actions, such as using tools and software, with limited human supervision.
Model Context Protocol
Open protocol, introduced by Anthropic in 2024, that standardizes how AI applications connect language models to external tools and data sources.
API
Defined set of rules and interfaces through which one piece of software can request services or data from another without knowing its internals.
JSON
Lightweight, text-based data interchange format that represents structured data as nested objects and arrays, derived from JavaScript syntax.
Prompt Injection
Security vulnerability in which crafted text causes an AI model to follow an attacker's instructions instead of those of its developer or user.
REST API
Web interface that follows the REST architectural style, exposing resources at URLs that clients manipulate with stateless HTTP requests.
Multi-Agent System
System in which multiple autonomous agents interact, cooperating or competing, to solve problems that are difficult for a single agent.
Neural network trained on very large amounts of text to predict the next token, able to generate language and perform many tasks from prompts.
Referenced by
Other entries that discuss or point to Function Calling.