API Reference
ToolCall
Defined in: types/tool-calls.ts:50
A tool invocation requested by the model.
Remarks
The OpenAI chat-completions wire shape verbatim: { id, type, function: { name, arguments } }, where arguments is a JSON string (not a parsed
object). The loop JSON-parses and schema-validates it before the tool runs.
Abstraction over — nothing added: every field is OpenAI's, so a ToolCall
is the wire object. It rides as one element of an assistant turn's
AssistantMessage.tool_calls array.
Example
Wire shape (one element of `assistant.tool_calls[]`)
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\":\"NYC\",\"units\":\"metric\"}"
}
}See
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
function | { arguments: string; name: string; } | The function name and its raw argument string. | types/tool-calls.ts:56 |
function.arguments | string | Arguments as a JSON string, exactly as the model emitted them. | types/tool-calls.ts:60 |
function.name | string | Name of the tool/function to invoke. | types/tool-calls.ts:58 |
id | string | Unique id for this call, used to match the answering tool result. | types/tool-calls.ts:52 |
type | Function | The call kind; always ToolCallType.Function. | types/tool-calls.ts:54 |