Tool

Trait Tool 

Source
pub trait Tool<Ctx>: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn input_schema(&self) -> Value;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 ToolContext<Ctx>,
        input: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn tier(&self) -> ToolTier { ... }
}
Expand description

Definition of a tool that can be called by the agent

Required Methods§

Source

fn name(&self) -> &str

Unique name for the tool (used in LLM tool calls)

Source

fn description(&self) -> &str

Human-readable description of what the tool does

Source

fn input_schema(&self) -> Value

JSON schema for the tool’s input parameters

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 ToolContext<Ctx>, input: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the tool with the given input

§Errors

Returns an error if tool execution fails.

Provided Methods§

Source

fn tier(&self) -> ToolTier

Permission tier for this tool

Implementors§

Source§

impl<Ctx> Tool<Ctx> for LinkFetchTool
where Ctx: Send + Sync + 'static,

Source§

impl<Ctx, P> Tool<Ctx> for WebSearchTool<P>
where Ctx: Send + Sync + 'static, P: SearchProvider + 'static,

Source§

impl<Ctx: Send + Sync + 'static> Tool<Ctx> for TodoReadTool

Source§

impl<Ctx: Send + Sync + 'static> Tool<Ctx> for TodoWriteTool

Source§

impl<Ctx: Send + Sync + 'static> Tool<Ctx> for AskUserQuestionTool

Source§

impl<E: Environment + 'static> Tool<()> for BashTool<E>

Source§

impl<E: Environment + 'static> Tool<()> for EditTool<E>

Source§

impl<E: Environment + 'static> Tool<()> for GlobTool<E>

Source§

impl<E: Environment + 'static> Tool<()> for GrepTool<E>

Source§

impl<E: Environment + 'static> Tool<()> for ReadTool<E>

Source§

impl<E: Environment + 'static> Tool<()> for WriteTool<E>

Source§

impl<P, H, M, S> Tool<()> for SubagentTool<P, H, M, S>
where P: LlmProvider + Clone + 'static, H: AgentHooks + Clone + 'static, M: MessageStore + 'static, S: StateStore + 'static,

Source§

impl<T: McpTransport + 'static> Tool<()> for McpToolBridge<T>