Tools & Actions
Give the model functions it can call to fetch data or take actions
Tools & Actions
Tools (also called function calling) let a model do more than talk — it can call functions you define to fetch data or take actions in your game. You describe the available tools; the model decides when to call one and with what arguments; you run it and return the result; the model continues with that result in hand.
Tools are available only on tool-capable models.
Defining tools
Each tool has a name, a description, and a parameter schema. You pass the set of tools with the request:
{
"tools": [
{
"name": "get_player_inventory",
"description": "Look up the player's current items",
"parameters": {
"type": "object",
"properties": { "playerId": { "type": "string" } },
"required": ["playerId"]
}
}
]
}Controlling tool use
tool_choice controls whether and how the model uses tools:
| Value | Behavior |
|---|---|
auto | The model decides whether to call a tool (default). |
required | The model must call a tool. |
none | The model may not call tools. |
| a specific tool | Force the model to call that tool. |
Multi-step actions
A model can call tools across multiple steps — call one, read the result, call another — to complete a task before giving its final reply. This is what turns tool calling into actions: the model drives a short workflow using your functions.
When to use it
- Read game state (inventory, quests, stats) the model wouldn't otherwise know.
- Take actions — grant an item, move an NPC, update a record.
- Ground replies in live data instead of the model's training.
For the exact call in your language, see the JavaScript, Unity, or Unreal text generation guide.