Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn parameters_schema(&self) -> Value;
    fn execute(&self, arguments: &str) -> ToolResult;

    // Provided methods
    fn requires_confirmation(&self) -> bool { ... }
    fn confirmation_message(&self, arguments: &str) -> String { ... }
}
Expand description

工具 trait

Required Methods§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

fn parameters_schema(&self) -> Value

Source

fn execute(&self, arguments: &str) -> ToolResult

执行工具(同步)

Provided Methods§

Source

fn requires_confirmation(&self) -> bool

是否需要用户确认(shell 命令需要,文件读取不需要)

Source

fn confirmation_message(&self, arguments: &str) -> String

生成确认提示文字(供 TUI 展示)

Implementors§