Claude client functions use the tool_use → tool_result loop with and without a server prompt. Your client executes the function. Formats and restrictions depend on the selected API.
json
{
"model": "claude-opus-5",
"max_tokens": 1024,
"tools": [{
"name": "get_weather",
"description": "Weather by city",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}],
"messages": [{"role": "user", "content": "What's the weather in Moscow?"}]
}The response includes a tool_use block with the tool name and arguments — run it on your side and return the result as a tool_result block.
json
{
"role": "user",
"content": [{
"type": "tool_result",
"tool_use_id": "toolu_…",
"content": "Moscow: 18 °C, clear"
}]
}| Family | Client tools |
|---|---|
| Kimi | Available in Messages, Chat Completions and Responses; tool and selection formats depend on the API |
| Composer | Available on all three surfaces; the client executes the tool. Only automatic tool_choice is supported |
| Grok | Available on all three surfaces; the client executes the tool. Only automatic tool_choice is supported |
toolsmust be an array of objects, a function must have a name, names must be unique.- The argument schema is checked for up to 32 levels of depth, 4096 nodes and 256 KiB in canonical form. Going over returns a local
400before any charge. - On
kimi-for-codingandkimi-for-coding-highspeedthe valuetool_choice: "required"is not supported and is rejected locally. Onk3andk3-256kit passes.
The loop works on all three surfaces in their own format. The model returns a call; the client executes the tool and returns its result in the same conversation. Until the result arrives, the request remains unfinished.
| Surface | What arrives instead of an answer | What you answer with |
|---|---|---|
/v1/messages | tool_use blocks in content and stop_reason: "tool_use" | a tool_result block with the same tool_use_id |
/v1/chat/completions | choices[0].message.tool_calls and finish_reason: "tool_calls" | a message with role tool and a tool_call_id |
/v1/responses | a type: "function_call" item in output with a call_id | a function_call_output item with the same call_id |
An unfinished tool loop has a result-wait limit and a total duration limit. Complete calls in the same conversation and account for the limits below.
| Limit | Value | What happens past it |
|---|---|---|
| Answering a tool call | 120 seconds from the moment you received the turn with the call | the run is closed and the part of it already spent is charged. Coming back later starts the conversation from scratch, and you pay for the input a second time |
| Length of one run | 600 seconds | 504 cursor_run_timeout, or an error event with the same code in a stream. The run is charged |
| Unfinished conversations per key | Concurrent loops waiting for tool results are limited per key | 429 cursor_key_pause_limit before money is reserved, so the refusal is free. Finish or drop one conversation to start the next |