Skip to main content
Version: Next

Variable: parseToolCall()

const parseToolCall: (message) => ToolCall[]

Defined in: utils/llm.ts:21

Parses tool calls from a given message string.

Parameters

message

string

The message string containing tool calls in JSON format.

Returns

ToolCall[]

An array of ToolCall objects extracted from the message. Returns an empty array if the model did not emit a [...] block (i.e. chose not to call any tool).

Throws

InvalidModelOutput when a [...] block is present but cannot be parsed as JSON — distinct from the model legitimately deciding not to invoke a tool.