Skip to content

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.

new ToolReferenceBlock({ name: weatherTool.name })
new ToolReferenceBlock(data): ToolReferenceBlock;

Defined in: src/types/messages.ts:530

ParameterType
dataToolReferenceBlockData

ToolReferenceBlock

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.

ToolReferenceBlockData.name

toJSON(): {
toolReference: ToolReferenceBlockData;
};

Defined in: src/types/messages.ts:538

Serializes the ToolReferenceBlock to a JSON-compatible ToolResultContentData object. Called automatically by JSON.stringify().

{
toolReference: ToolReferenceBlockData;
}
NameTypeDefined in
toolReferenceToolReferenceBlockDatasrc/types/messages.ts:538

JSONSerializable.toJSON


static fromJSON(data): ToolReferenceBlock;

Defined in: src/types/messages.ts:548

Creates a ToolReferenceBlock instance from its wrapped data format.

ParameterTypeDescription
data{ toolReference: ToolReferenceBlockData; }Wrapped ToolReferenceBlockData to deserialize
data.toolReferenceToolReferenceBlockData-

ToolReferenceBlock

ToolReferenceBlock instance