Skip to content

ToolUseBlock

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

Tool use content block.

new ToolUseBlock(data): ToolUseBlock;

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

ParameterType
dataToolUseBlockData

ToolUseBlock

readonly type: "toolUseBlock";

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

Discriminator for tool use content.


readonly name: string;

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

The name of the tool to execute.

ToolUseBlockData.name


readonly toolUseId: string;

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

Unique identifier for this tool use instance.

ToolUseBlockData.toolUseId


readonly input: JSONValue;

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

The input parameters for the tool. This can be any JSON-serializable value.

ToolUseBlockData.input


readonly optional reasoningSignature: string;

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

Reasoning signature from thinking models (e.g., Gemini). Must be preserved and sent back to the model for multi-turn tool use.

ToolUseBlockData.reasoningSignature

toJSON(): {
toolUse: ToolUseBlockData;
};

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

Serializes the ToolUseBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify().

{
toolUse: ToolUseBlockData;
}
NameTypeDefined in
toolUseToolUseBlockDatasrc/types/messages.ts:248
JSONSerializable.toJSON

static fromJSON(data): ToolUseBlock;

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

Creates a ToolUseBlock instance from its wrapped data format.

ParameterTypeDescription
data{ toolUse: ToolUseBlockData; }Wrapped ToolUseBlockData to deserialize
data.toolUseToolUseBlockData-

ToolUseBlock

ToolUseBlock instance