ToolUseBlock
Defined in: src/types/messages.ts:207
Tool use content block.
Implements
Section titled “Implements”ToolUseBlockDataJSONSerializable<{toolUse:ToolUseBlockData; }>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolUseBlock(data): ToolUseBlock;Defined in: src/types/messages.ts:235
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | ToolUseBlockData |
Returns
Section titled “Returns”ToolUseBlock
Properties
Section titled “Properties”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.
Implementation of
Section titled “Implementation of”toolUseId
Section titled “toolUseId”readonly toolUseId: string;Defined in: src/types/messages.ts:221
Unique identifier for this tool use instance.
Implementation of
Section titled “Implementation of”readonly input: JSONValue;Defined in: src/types/messages.ts:227
The input parameters for the tool. This can be any JSON-serializable value.
Implementation of
Section titled “Implementation of”reasoningSignature?
Section titled “reasoningSignature?”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.
Implementation of
Section titled “Implementation of”ToolUseBlockData.reasoningSignature
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): { toolUse: ToolUseBlockData;};Defined in: src/types/messages.ts:248
Serializes the ToolUseBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify().
Returns
Section titled “Returns”{ toolUse: ToolUseBlockData;}| Name | Type | Defined in |
|---|---|---|
toolUse | ToolUseBlockData | src/types/messages.ts:248 |
Implementation of
Section titled “Implementation of”JSONSerializable.toJSONfromJSON()
Section titled “fromJSON()”static fromJSON(data): ToolUseBlock;Defined in: src/types/messages.ts:265
Creates a ToolUseBlock instance from its wrapped data format.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | { toolUse: ToolUseBlockData; } | Wrapped ToolUseBlockData to deserialize |
data.toolUse | ToolUseBlockData | - |
Returns
Section titled “Returns”ToolUseBlock
ToolUseBlock instance