Basic flow
- Send a `tools` list with JSON Schema functions.
- The model returns `tool_calls` when it needs external data.
- Execute the function in your backend and return its result as a `tool` message.
- Make a second call so the model can write the final answer.
Minimal example
tools payload
{
"model": "Qwen/Qwen3.6-35B-A3B",
"messages": [{"role": "user", "content": "Find order A-102 status"}],
"tools": [{
"type": "function",
"function": {
"name": "get_order_status",
"parameters": {
"type": "object",
"properties": { "order_id": { "type": "string" } },
"required": ["order_id"]
}
}
}]
}Best practices
- Always validate tool arguments server-side; never execute sensitive actions just because the model asked.
- Use stable function names and short descriptions focused on when to call the tool.
- For destructive operations, require explicit user confirmation before execution.