Skip to main content

PluginTool

Trait PluginTool 

Source
pub trait PluginTool: 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,
        args: Value,
        ctx: &'life1 PluginToolContext,
    ) -> Pin<Box<dyn Future<Output = PluginResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A tool provided by a plugin.

Similar to BuiltinTool but returns &str instead of &'static str because plugin tool names are loaded at runtime. Uses PluginToolContext instead of ToolContext to provide scoped KV storage and restrict access.

Required Methods§

Source

fn name(&self) -> &str

Tool name (unique within the plugin).

The fully qualified name exposed to the LLM is plugin:{plugin_id}:{tool_name}.

Source

fn description(&self) -> &str

Human-readable description for the LLM.

Source

fn input_schema(&self) -> Value

JSON schema for tool input parameters.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, args: Value, ctx: &'life1 PluginToolContext, ) -> Pin<Box<dyn Future<Output = PluginResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the tool with the given arguments.

Trait Implementations§

Source§

impl Debug for dyn PluginTool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§