Skip to main content

ToolRuntime

Trait ToolRuntime 

Source
pub trait ToolRuntime:
    Send
    + Sync
    + Debug {
    // Required methods
    fn list(&self) -> BoxFuture<'_, Result<Vec<ToolSpec>, ToolError>>;
    fn call<'a>(
        &'a self,
        name: &'a str,
        arguments: Value,
        context: &'a ToolCallContext,
    ) -> BoxFuture<'a, Result<ToolOutput, ToolError>>;

    // Provided method
    fn accepts_secrets(&self) -> bool { ... }
}
Expand description

A source of tools.

Required Methods§

Source

fn list(&self) -> BoxFuture<'_, Result<Vec<ToolSpec>, ToolError>>

Tools currently available.

Source

fn call<'a>( &'a self, name: &'a str, arguments: Value, context: &'a ToolCallContext, ) -> BoxFuture<'a, Result<ToolOutput, ToolError>>

Invoke a tool with a JSON arguments object and a per-call context.

context is empty unless this runtime accepts secrets and the caller configured some. Runtimes that cannot forward it ignore it.

Provided Methods§

Source

fn accepts_secrets(&self) -> bool

Whether this runtime may receive plaintext secrets in a ToolCallContext.

false by default. The plugin runtime returns true only for plugins that request permissions.secrets and that the operator trusts.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§