Tool calling lets the model decide when to request structured function inputs from your application. Your app executes the function, then sends the result back into the conversation or workflow. Use this when the model needs fresh data, side effects, or access to systems outside the prompt.Documentation Index
Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
Use this file to discover all available pages before exploring further.
Support Matrix
| Concept | Responses | Chat Completions | Messages |
|---|---|---|---|
| Tool definition | tools[] | tools[] | tools[] |
| Model tool call | function_call item | tool_calls[] | tool_use block |
| App tool result | function_call_output item | role: tool message | tool_result block |
| Streaming args | response.function_call_arguments.delta | delta.tool_calls[].function.arguments | input_json_delta |
Typical Flow
- Define one or more tools in the request.
- Let the model choose a tool or force a specific one.
- Execute the requested tool in your application.
- Send the tool result back to the model if the workflow needs a final answer.
When It Helps
- calling internal business logic or APIs
- looking up live data such as weather, account state, or inventory
- combining model reasoning with deterministic application behavior
Recommended Example
function_call, continue the workflow by sending its result back as a function_call_output item:
Good Tool Design
- keep tool names explicit and stable
- use narrow JSON schemas instead of vague free-form arguments
- return structured, machine-readable results when possible
- only expose tools the model should actually be allowed to call
Common Mistakes
- defining tools with descriptions that are too vague
- sending tool results back in the wrong protocol shape
- assuming the model will always produce final text in the same response as the tool request
- exposing side-effecting tools without application-level permission checks
Choosing The Right Surface
- use
Responsesfor new tool workflows - use
Chat Completionswhen you already have OpenAI chat tool code - use
Messageswhen your agent stack already expects Anthropic content blocks
Related Guides
- Responses Tool Calling
- Chat Completions Tool Calling
- Messages Tool Use
- Structured Outputs
- Error Handling