S1 · E4 · Beginner · Season 1: AI Agents & Tools

What is tool calling?

Explained with Pizza

Tool calling (also called function calling) lets an AI model ask an outside tool, like web search or a calculator, for fresh data or an exact result, and then use that result in its answer.

In short

  • A model only knows what it learned in training. For fresh or exact facts, it needs a tool.
  • Tool calling in 4 steps: you ask, the model writes an order, the tool runs and sends back a result, the model answers.
  • The model does not run the tool itself. Your app runs it, or the provider runs it for you.
  • For web answers, open a source link before you trust a number.

The problem: the chef cannot grow tomatoes overnight

An AI model learns from a huge pile of text, and then training stops. After that date it learns nothing new by itself. Ask it about today's weather, a live price or this morning's news, and it simply cannot know.

It is also not a perfect calculator. A language model predicts text, so for long sums it can slip on a digit.

The idea: call the supplier

Picture the model as a pizza chef. The chef is great at cooking, but when the kitchen runs out of fresh basil, the chef does not invent basil. The chef phones a supplier, gets the real thing and finishes the pizza.

Tools are the suppliers: web search, a weather service, a calculator, a database, your calendar. The model decides which supplier to call and what to ask for.

Tool calling in 4 steps

  • Ask: you type "What's the weather in Paris?"
  • Order: the model sees it needs fresh data and writes a short, structured order, like weather(city: "Paris").
  • Fetch: the app runs that tool and sends the result back to the model.
  • Answer: the model writes the reply using the fresh data.

Who actually runs the tool?

Not the model. The model only writes the order. In Anthropic's Claude API, there are two kinds of tools. Client tools run in your own app: Claude returns the order, your code runs it and sends back the result. Server tools, like web search and code execution, are run by Anthropic for you.

With the web search tool, Claude decides when to search, Anthropic runs the search, and the answer comes back with the sources it used.

With the code execution tool, Claude writes a bit of Python, a sandbox runs it, and the exact result comes back. That is the calculator trick: the model writes the math as code instead of guessing the digits.

Why it matters for you

Tool calling is what turns a chatbot into an agent that can look things up and do things. It is also where mistakes can sneak in: a search can find a bad page, and a tool can return old data.

So the habit is simple: when an answer comes from the web, look for the source links and open one before you trust a number.

Test yourself

5 quick questions. Pick an answer to check it.

1. Why does a chatbot need a tool to tell you today's weather?
2. In tool calling, what does the model itself do?
3. What is the right order of the 4 steps?
4. How does Claude's code execution tool get an exact math result?
5. A chatbot gives you a number it found on the web. What is the safest next step?

Sources

Checked November 22, 2026.