Tool Calling
Tool calling lets a model produce structured function arguments. Your application must validate the arguments, authorize and execute the operation, and return the result. The model never executes your function by itself.
Choose a protocol
Chat Completions declares functions under tools[].function. Responses places name, description, and parameters directly on a type: "function" tool. Do not copy request bodies between protocols.
Safe execution checklist
- Validate arguments against a strict schema.
- Check the end user's permission.
- Apply timeouts and resource limits.
- Require confirmation for writes or destructive actions.
- Make repeated tool-call IDs idempotent.
- Return structured failures instead of pretending success.
A successful text prompt does not prove tool calling works. Verify the exact model, protocol, and client combination before production use.
See the Chat Completions guide, Responses guide, and API Reference.
