Skip to main content

TypedTool

Trait TypedTool 

Source
pub trait TypedTool:
    Send
    + Sync
    + 'static {
    type Args: DeserializeOwned + JsonSchema;

    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: Self::Args,
        ctx: &'life1 ToolContext,
    ) -> Pin<Box<dyn Future<Output = ToolOutput> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn parallel_safe(&self) -> bool { ... }
    fn mutating(&self) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, args: Self::Args, ctx: &'life1 ToolContext, ) -> Pin<Box<dyn Future<Output = ToolOutput> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn parallel_safe(&self) -> bool

Whether this tool may run concurrently with other calls in the same batch. Default false — a tool opts in, so anything that mutates state is a barrier unless it explicitly claims otherwise.

Source

fn mutating(&self) -> bool

Whether this tool may mutate the workspace. Default false — a mutator opts in, so plan mode’s MUTATING_TOOLS denylist and this flag stay in sync (a test in wcode-cli asserts it).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§