pub struct ToolUseBlock {
pub id: String,
pub name: String,
pub input: Value,
}Expand description
Tool use invocation block
Represents Claude invoking a tool (Read, Write, Edit, Bash, etc.)
§Example
{
"type": "tool_use",
"id": "toolu_abc123",
"name": "Read",
"input": {
"file_path": "/path/to/file.rs"
}
}§Links
idlinks toToolResultBlock.tool_use_idin user messagesidlinks toProgressEvent.tool_use_idfor progress updates
§Common Tool Names
Read- Read file contentsWrite- Write new fileEdit- Edit existing fileBash- Execute bash commandGlob- Search for files by patternGrep- Search file contentsTodoWrite- Update todo listAgent- Spawn sub-agent
Fields§
§id: StringUnique tool use ID
Links to tool result in user message
Format: "toolu_{random}" or "{tool_name}-{uuid}"
name: StringTool name
Common tools: Read, Write, Edit, Bash, Glob, Grep, Agent
input: ValueTool input parameters (JSON object)
Structure depends on tool type:
- Read:
{"file_path": "/path"} - Write:
{"file_path": "/path", "content": "..."} - Edit:
{"file_path": "/path", "old_string": "...", "new_string": "..."} - Bash:
{"command": "cargo build", "description": "..."}
Trait Implementations§
Source§impl Clone for ToolUseBlock
impl Clone for ToolUseBlock
Source§impl Debug for ToolUseBlock
impl Debug for ToolUseBlock
Source§impl<'de> Deserialize<'de> for ToolUseBlock
impl<'de> Deserialize<'de> for ToolUseBlock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolUseBlock
impl RefUnwindSafe for ToolUseBlock
impl Send for ToolUseBlock
impl Sync for ToolUseBlock
impl Unpin for ToolUseBlock
impl UnsafeUnpin for ToolUseBlock
impl UnwindSafe for ToolUseBlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more