Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn spec(&self) -> &ToolSpec;
    fn call(&self, ctx: &CallCtx<'_>, args: Value) -> Result<Value, ToolError>;

    // Provided method
    fn subject(&self, _args: &Value) -> Option<String> { ... }
}

Required Methods§

Source

fn spec(&self) -> &ToolSpec

Source

fn call(&self, ctx: &CallCtx<'_>, args: Value) -> Result<Value, ToolError>

Provided Methods§

Source

fn subject(&self, _args: &Value) -> Option<String>

The inner verb for tools that carry one (e.g. the app command name of <app>.command). The exposure rules and allowlist see it as <tool>:<subject>.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§