Describe a function contract
A tool contains a name, a clear description, and a JSON Schema for parameters. The description says when the tool should be selected, while the schema constrains arguments.
The model proposes a call; it does not gain access to your network, database, or files by itself.
{
"model": "openai/gpt-5.6-sol",
"messages": [{"role": "user", "content": "What is the weather in Tashkent?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Read current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
"additionalProperties": false
}
}
}],
"tool_choice": "auto"
}Execute on your side
- Check the tool name against an allowlist.
- Validate arguments against the schema before calling an internal service.
- Apply your own authorization, timeouts, and idempotency to the tool action.
Return the result
Add a tool message with the tool_call_id and a compact serialized result, then continue the conversation with the same context.
Keep a tool execution failure distinct from a model failure: return a structured reason the model can explain to the user.