Expand description
Tool type definitions, traits, and utilities translated from the TypeScript SDK.
This module defines the core tool system including:
- The
Tooltrait with all optional methods (mirroring the TSTooltype) - Tool permission context and validation types
- Tool use context for runtime execution
- Progress tracking types
- Utility functions for tool lookup and matching
- The
build_toolpattern for constructing tools with safe defaults
Re-exports§
pub use crate::types::hooks::HookProgress;pub use crate::types::message::AssistantMessage;pub use crate::types::message::AttachmentMessage;pub use crate::types::message::Message;pub use crate::types::message::ProgressMessage;pub use crate::types::message::SystemLocalCommandMessage;pub use crate::types::message::SystemMessage;pub use crate::types::message::UserMessage;pub use crate::types::tools::ToolProgressData;pub use crate::types::ToolDefinition;pub use crate::types::ToolInputSchema;pub use crate::types::CompactProgressEvent;pub use crate::types::permissions::ToolPermissionContext;
Structs§
- Agent
Definitions Result - Denial
Tracking State - File
Reading Limits - Glob
Limits - Grouped
Tool Use - Grouped
Tool UseRender Options - Grouped
Tool UseResult - Image
Source - McpMeta
- MCP metadata passed through to SDK consumers.
- McpTool
Info - Query
Chain Tracking - Search
OrRead Info - SetTool
JsxArgs - Terminal
Size - Tool
Builder - Builder for constructing a
Toolimplementation with default values filled in. - Tool
Decision Entry - Tool
Defaults - Default values for tool methods, mirroring the TypeScript
TOOL_DEFAULTS. - Tool
Error Render Options - Tool
Progress - Progress associated with a specific tool use.
- Tool
Progress Render Options - Tool
Rejected Render Options - Tool
Result - Result returned by a tool call.
- Tool
Result Block Param - Maps a tool result to the Anthropic SDK ToolResultBlockParam shape.
- Tool
Result Render Options - Tool
UseContext - Context passed to tool calls during execution, providing access to configuration, state, callbacks, and other runtime infrastructure.
- Tool
UseContext Options - Tool
UseRender Options
Enums§
- Content
Block Param - Permission
Decision - Permission
Result - Tool
Result Message - Messages that can be produced as part of a tool result.
- Validation
Result - Result of validating tool input.
Traits§
- Tool
- A tool that can be called by the agent.
Functions§
- filter_
tool_ progress_ messages - Filter out hook_progress messages from a list of progress messages.
- find_
tool_ by_ name - Finds a tool by name or alias from a list of tool definitions.
- get_
empty_ tool_ permission_ context - Creates an empty tool permission context (matches TS
getEmptyToolPermissionContext). - tool_
matches_ name - Checks if a tool matches the given name (primary name or alias).
Type Aliases§
- SetTool
JsxFn - Callback to update tool JSX/UI rendering state. In Rust this is a generic boxed async callback.
- Tool
Call Progress Fn - Callback type for reporting progress during tool execution.
- Tool
Input Json Schema - JSON schema for tool input, used when a tool specifies its schema directly in JSON Schema format rather than converting from a Zod schema.
- Tools
- A collection of tools. Use this type instead of
Vec<ToolDefinition>to make it easier to track where tool sets are assembled, passed, and filtered across the codebase.