Tool use (function calling)
The model returns a structured request to run a function you defined; your code runs it.
Tool use, also called function calling, lets a language model ask your code to run a function you defined: look up an order, search documents, send an email. The model returns a structured call with arguments; your code decides whether and how to execute it and sends the result back.
You describe each tool with a name, a description and a JSON schema for the input. The model never runs anything itself. Tool descriptions are prompts too, and they decide how well the model picks tools and fills in arguments; vague names and overlapping tools are a common cause of wrong calls. Structured outputs use the same mechanism to force a reply into a fixed shape. Anthropic’s tool use documentation and other vendors’ equivalents describe the format.
Tool use is the building block; an agentic loop repeats it until the task is done, and MCP is a standard way to package tools so many AI apps can use them. The risk sits in what the tools can do. A model that read a malicious document can be talked into calling a tool with attacker-chosen arguments (prompt injection), and a tool with more power than the task needs is excessive agency.
Sources
- Claude Docs: Tool use with Claude platform.claude.com
Related terms
- MCP (Model Context Protocol): An open protocol for plugging tools and data into AI apps: write a server once, use it from any client.
- Structured outputs: The model’s answer is constrained to match a JSON schema you provide.
- Agentic loop: The cycle of model call, tool call and result that an agent repeats until it stops.
- AI agent: A model that decides its next step itself, calls tools and repeats until the task is done.
- Excessive agency: An AI agent with more tools, permissions or autonomy than its task needs, so a mistake or an injected instruction can do real damage.
- Prompt injection: Instructions hidden in data (a web page, an email, a file) that the model follows as if they came from you.
