---
title: "Tool calling"
type: "glossary term"
url: "https://aifordevs.org/glossary#tool-calling"
markdown: "https://aifordevs.org/glossary/tool-calling.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/glossary#tool-calling"
also_known_as: "Function calling"
---

# Tool calling (Function calling)

Tool calling is a model returning a structured request to run a function you defined, with arguments, instead of plain text. Your code runs the function and sends the result back, which is how an agent loop reaches systems outside the model.

The model only produces the request, and your code or the provider's servers do the execution. On the Claude API a client tool comes back as a tool_use block with stop_reason tool_use, and you reply with a tool_result block. Tool names, descriptions, and schemas all count as input tokens, so a large tool set shrinks your context budget.

## Example

Given a get_weather tool, the model returns {"location": "San Francisco, CA"} as arguments, your code calls the weather API, and the next request carries the result as a tool_result.

## Source

[Anthropic docs: Tool use with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)

## Related terms

- [Agent](https://aifordevs.org/glossary#agent)
- [Agent loop](https://aifordevs.org/glossary#agent-loop)
- [MCP](https://aifordevs.org/glossary#mcp)
- [MCP server](https://aifordevs.org/glossary#mcp-server)
- [Structured outputs](https://aifordevs.org/glossary#structured-outputs)
- [Constrained decoding](https://aifordevs.org/glossary#constrained-decoding)

## Read the article

[What is an AI agent? The loop in code, and where it fails](https://aifordevs.org/articles/what-is-an-ai-agent)

## Cite this term

AI for Devs. "Tool calling." https://aifordevs.org/glossary#tool-calling

- Page: https://aifordevs.org/glossary#tool-calling
- Markdown: https://aifordevs.org/glossary/tool-calling.md
- Reuse: Quote or summarize with a link to this page. Terms: https://aifordevs.org/reuse
- Publisher: AI for Devs
