ToolReferenceBlock
Defined in: src/types/messages.ts:517
A tool whose input schema a tool result loads. load_tools returns one for each tool it loads, and any
tool can return them too, such as a custom loader that searches the tool catalog.
It reaches the model as a reference only when the model defers tools natively
(modelInfo.capabilities.deferredToolLoading is 'native'), the request defers this tool, and the tool result holds
only such references; the provider then sends a reference the API expands into the tool’s definition. Otherwise the
model gets the parameters of the request’s tool with this name as text, so a tool that changed is shown as it is now.
Example
Section titled “Example”new ToolReferenceBlock({ name: weatherTool.name })Implements
Section titled “Implements”ToolReferenceBlockDataJSONSerializable<{toolReference:ToolReferenceBlockData; }>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolReferenceBlock(data): ToolReferenceBlock;Defined in: src/types/messages.ts:530
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | ToolReferenceBlockData |
Returns
Section titled “Returns”ToolReferenceBlock
Properties
Section titled “Properties”readonly type: "toolReferenceBlock";Defined in: src/types/messages.ts:523
Discriminator for tool reference content.
readonly name: string;Defined in: src/types/messages.ts:528
Name of the tool the result loads.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): { toolReference: ToolReferenceBlockData;};Defined in: src/types/messages.ts:538
Serializes the ToolReferenceBlock to a JSON-compatible ToolResultContentData object. Called automatically by JSON.stringify().
Returns
Section titled “Returns”{ toolReference: ToolReferenceBlockData;}| Name | Type | Defined in |
|---|---|---|
toolReference | ToolReferenceBlockData | src/types/messages.ts:538 |
Implementation of
Section titled “Implementation of”JSONSerializable.toJSON
fromJSON()
Section titled “fromJSON()”static fromJSON(data): ToolReferenceBlock;Defined in: src/types/messages.ts:548
Creates a ToolReferenceBlock instance from its wrapped data format.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | { toolReference: ToolReferenceBlockData; } | Wrapped ToolReferenceBlockData to deserialize |
data.toolReference | ToolReferenceBlockData | - |
Returns
Section titled “Returns”ToolReferenceBlock
ToolReferenceBlock instance