Tool calling
Let a model request a function, execute it in your application, and return the result.
{
"model": "YOUR_MODEL",
"messages": [{ "role": "user", "content": "Weather in Dhaka?" }],
"tools": [{
"type": "function",
"function": { "name": "get_weather", "description": "Get current weather", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } }
}],
"tool_choice": "auto"
}Describe your tools
Provide a function name, description and JSON Schema parameters. Keep tool inputs constrained and validate them before execution.
Run and return
When the assistant returns tool_calls, execute the requested function, append the assistant message unchanged, then append one tool message for each call ID.
Safety
Treat arguments as untrusted input. Require confirmation for external mutations such as sending, purchasing, deleting or publishing.
Need help?
Keep the request ID and contact Torve support without sharing your API key or private data.
Contact support