Tool Use and Function Calling
Tool Use is like giving an assistant a phone and a computer. On its own, an LLM can only work with what it learned during training — but with tool use, it can reach beyond that boundary to call functions, query APIs, and execute actions in the real world. This is what transforms a language model from a sophisticated text predictor into something that can actually do things.
Prerequisites
Before reading this page, make sure you understand:
- Large Language Model (LLM) — how models generate text
- Prompts — how you communicate your intent to the model
How It Works
The diagram shows the function calling cycle — a four-step process that happens within a single interaction.
First, you send a prompt to the LLM along with a list of available tools (functions the model is allowed to call). Each tool has a name, description, and parameter schema. The model reads your request and decides whether it needs to call a tool to answer it.
If the model determines a tool call is necessary — say you asked "What's the weather in Tokyo?" and there's a get_weather function available — it doesn't execute the function itself. Instead, it returns a structured function call message: the function name and the arguments it wants to pass. Your application code receives this, executes the actual function (calling the weather API), and sends the result back to the model.
Finally, the model takes that result and incorporates it into a natural language response: "The current temperature in Tokyo is 22 degrees C with partly cloudy skies."
The critical distinction is that the LLM never executes code directly. It describes what to call and with what arguments, and your application handles the actual execution. This keeps the model sandboxed while giving it access to external capabilities.
Why It Matters
Without tool use, LLMs are limited to their training data — which has a knowledge cutoff date and no access to private systems. Tool use unlocks real-time information (current weather, stock prices), database queries (your company's data), code execution (running calculations), and external API access (sending emails, creating tickets).
This is the bridge between "knows things" and "does things." It's what makes AI assistants genuinely useful in production: they can look up your order status, check a deployment log, or query a monitoring dashboard — all within a conversation.