Skip to content
mentoor

Topic 1 of 5 · 4 min read

A tool call is generated text

Goal: Identify in a transcript which steps the model generated and which the application executed.

A language model cannot run anything. When it "calls a tool", it writes a short, structured piece of text that says which tool it wants and with what arguments; your application is what actually runs it.

Check yourself · 1 of 3

In a tool-using chat, which step is actually carried out by the model?

Choose one answer

Why it matters

Tool use sounds like the model reaching out into the world. It is not. Claude, ChatGPT, Gemini and open-weight models all work the same way: the model produces tokens, and some of those tokens form a request. Everything that happens after that, such as a search, a file write or a payment, is done by ordinary software. This is why a tool call can be wrong, can be refused, or can be edited before it runs. It is also why you should never read "I sent the email" as proof that an email was sent.

How it works

  1. The app sends the model your message plus a list of available tools, each with a name, a description and the arguments it takes.
  2. The model reads this and decides what to write next. It may write a normal answer. Or it may write a tool request, for example get_weather with the argument city: "Lisbon".
  3. The app sees the request, checks it, and decides whether to run it. It may run it, block it, ask you first, or change the arguments.
  4. If it runs, the app sends the result back to the model as a new message. The model then writes the next piece of text.

Only step 2 is the model. Steps 1, 3 and 4 are the application. Providers give the request a special format so the app can tell it apart from chat text, but it is still generated one token at a time, like any other output.

Before and after

Weak: "The assistant checked my calendar and booked the meeting, so it must be done."

Better: look at the transcript. Is there a tool request for create_event, followed by a tool result that contains an event id? If there is a request but no result, the app never ran it. If there is no request at all, the model only described booking a meeting.

What goes wrong

  • Wrong arguments. The model writes a plausible but wrong value, such as a date in the wrong year. The app runs it anyway because the format was valid.
  • Claims without calls. The model writes "I have checked the website" in plain text with no tool request behind it. It is generating a sentence, not a result.
  • Treating the request as a command. A request is a proposal. Apps that run every request without checks hand the model more power than they intended.

For engineers

A raw tool request in a provider API looks like a message with a typed block:

{
  "type": "tool_use",
  "id": "call_01",
  "name": "get_weather",
  "input": { "city": "Lisbon" }
}

Your code reads name and input, validates them, runs the function and replies with a result block that carries the same id.

Examples

Reading a transcript

A support bot shows these steps: the user asks for order 4471; the model writes a request lookup_order with id: 4471; the app returns status: shipped; the model answers "Your order has shipped." The model wrote steps 2 and 4. The app ran the lookup and wrote step 3. If step 3 were missing, the answer would be a guess.

The sentence with no call

You ask an assistant with no search tool turned on: "Check the latest price of this laptop." It replies "I looked it up: it costs 899 euros." No request, no result. The number came from training data or was invented. Turn on web search and look for the search step.

Key points

  • A model only generates text; a tool call is a structured request written as part of that text.
  • The application, not the model, decides whether a tool request runs, and with which arguments.
  • A result is real only if the transcript shows a tool result that came back after the request.
  • The model can write a tool request with wrong or invented arguments, and a valid format does not make them correct.
  • A plain sentence such as 'I checked' is not evidence that any tool ran.

Common mistakes

  • Thinking the model itself connects to the internet, your files or your calendar.
  • Believing a confident 'done' without finding the tool result in the transcript.
  • Assuming a well-formed tool request must have correct arguments.
  • Letting an app run every request automatically without any check.

Check yourself · 2 of 3

A chatbot says 'I sent the report to Sam', but the transcript shows no tool request and no tool result. What is the best reading?

Choose one answer

Check yourself · 3 of 3

An app receives a tool request with a valid format but the argument 'year: 2019' when it is 2026. What should a careful app do?

Choose one answer

Practice items, not counted towards your mastery.

Start here