Overview

This page is the atomic definition. The deep-dive lives at structured-output.

Definition

Tool use (also called function calling) is the mechanism by which a language model signals that it needs to invoke an external function rather than generate free text. The model emits a structured tool-call request (tool name + arguments) instead of a prose response. The host application executes the function, captures the result, and returns it to the model in a tool-result message. The model then generates its final response incorporating the result. This allows models to read live data (weather, stock prices, database rows), take actions (send email, modify files), and call computational tools (calculators, code executors, search engines). Tool use turns a stateless text predictor into an agent that can observe and affect its environment. Providers differ in API shape: Anthropic uses tools + tool_use / tool_result message types; OpenAI uses functions / tool_calls; Google uses functionDeclarations.

When it applies

Use tool use for any workflow where the model needs information it cannot generate reliably (current data, private knowledge, computed values) or needs to cause a side effect (write a record, send a notification). Keep tool definitions concise; description quality directly affects which tool the model picks.

Example

// Model emits:
{"type": "tool_use", "name": "get_weather", "input": {"city": "Oslo"}}
 
// App returns:
{"type": "tool_result", "content": "Partly cloudy, 12 C"}
 
// Model continues: "It is currently partly cloudy and 12 C in Oslo."
  • structured-output - the full guide to tool definitions, parallel calls, and error handling.
  • function-calling - the OpenAI-origin term for the same pattern.
  • mcp - an open protocol that standardizes tool discovery across providers.
  • structured-output - tool call arguments use structured schemas.
  • system-prompt - tool definitions are typically injected via the system prompt.

Citing this term

See Tool use (llmbestpractices.com/glossary/tool-use).