Tools · Function Calling
Function Calling
Define custom tools that the model can call to interact with external systems. Grok decides when to invoke a tool, you execute it, and the result is fed back so the model can answer with live data.
How It Works
Developer
Grok𝕏
User query with tool definition
"Is it warm in Palo Alto?"
get_weather(location)
Tool Call
get_weather("PA")
Tool Result
{ "temp": 72, "unit": "F" }
Model response
Yes — it's a warm 72°F in Palo Alto right now.
The loop
- 1. You send a user query plus your tool definitions.
- 2. Grok responds with a tool call instead of a final answer.
- 3. You execute the tool and return its result.
- 4. Grok uses the result to produce the final model response.