TL;DRTool use (function calling) lets a model invoke functions you define, with structured arguments.
You describe available functions (name, purpose, parameters as a schema); the model, when useful, outputs a structured call (which function + JSON arguments) instead of text; your code runs it and returns the result. This is the mechanism behind agents and integrations — it lets the LLM reach real systems (databases, APIs, calculators) while you keep control over what can actually run.
Key points
Describe functions via a schema
Model emits structured call + JSON args
Your code executes and returns results
You control what can actually run
Common mistakes
Vague function descriptions → wrong calls
Executing tool calls without validation
Exposing dangerous tools without limits
Try it: Sketch a function schema and the structured call a model would emit.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>tool: get_weather(city: string)
model emits: {"name":"get_weather","args":{"city":"NYC"}}
your code runs it → returns 21°C → model continues</pre></body></html>