# The tool_calls reply

When the model wants a tool, it replies with tool_calls (a function name plus JSON arguments) and its content is null.

AI developers · Part 03: Tool calling · Card 4 of 10 · Last updated 2026-10-13

## Analogy

Instead of an answer you get a work order: "please run getOrder with id A12, I'll wait".

## Code example

`tool-call.ts`

```typescript
const res = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Where is order A12?" }],
  tools,
});

const message = res.choices[0].message;
// message.content === null
// message.tool_calls = [{
//   id: "call_1",
//   function: { name: "getOrder", arguments: '{"id":"A12"}' },
// }]
```

## In an agent

Checking for tool_calls is how the agent loop decides whether to keep going or stop.

## Practice

### Flashcards

- **What is tool (function) calling?** The model asks your code to run a function with given arguments. Your code runs it and sends back the result.
- **Interview: does the model run your tool?** No. It returns the tool name and arguments; your code validates, runs it, and sends the result back as a tool message.

### Interview questions

**How does function / tool calling work?**

- Describe each tool with a name, a description and a JSON schema for its parameters.
- The model returns which tool to call and with what arguments. It never executes code itself.
- Your code validates the arguments, runs the function, and sends the result back as a tool message.
- The model then continues with the result in context.

## Questions people ask

### How do I know the model wants to call a tool?

Check the reply message for a tool_calls array. When it is present, the content is usually null and each entry holds an id, a function name and a JSON string of arguments. When tool_calls is missing, the model has answered in text. That check is how an agent loop decides to continue or stop.

### Why is the message content null when the model calls a tool?

Because the reply is a request, not an answer. The model is saying run this function and I will wait. The text answer comes later, after your code runs the tool and calls the model again with the result. Code that only reads content would see nothing and miss the tool call.

## Related concepts

- [The tool message](https://studyvisually.com/learn/tech/ai-developers/tool-calling/tool-message)
- [What a tool is](https://studyvisually.com/learn/tech/ai-developers/tool-calling/what-a-tool-is)
- [Validate tool arguments](https://studyvisually.com/learn/tech/ai-developers/production/validate-tool-arguments)
- [Function schema](https://studyvisually.com/learn/tech/ai-developers/tool-calling/function-schema)

Web page: https://studyvisually.com/learn/tech/ai-developers/tool-calling/tool-calls-response
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=tool-calls-response
