Open Agent Loops
API Reference

ToolCall

@open-agent-loops/core


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

ToolArguments

Properties

PropertyTypeDescriptionDefined in
function{ arguments: string; name: string; }The function name and its raw argument string.types/tool-calls.ts:56
function.argumentsstringArguments as a JSON string, exactly as the model emitted them.types/tool-calls.ts:60
function.namestringName of the tool/function to invoke.types/tool-calls.ts:58
idstringUnique id for this call, used to match the answering tool result.types/tool-calls.ts:52
typeFunctionThe call kind; always ToolCallType.Function.types/tool-calls.ts:54

On this page