Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor:
    Debug
    + Send
    + Sync {
    // Required method
    fn execute(
        &self,
        invocation: ValidatedToolInvocation,
        cancellation: CancellationScope,
    ) -> BoxToolExecutionStream;

    // Provided method
    fn preview(
        &self,
        _invocation: &ValidatedToolInvocation,
    ) -> Option<ToolPresentation> { ... }
}
Expand description

Object-safe executor receiving only registry-validated invocations.

Required Methods§

Source

fn execute( &self, invocation: ValidatedToolInvocation, cancellation: CancellationScope, ) -> BoxToolExecutionStream

Creates a lazy execution stream owned by the caller.

Provided Methods§

Source

fn preview( &self, _invocation: &ValidatedToolInvocation, ) -> Option<ToolPresentation>

Produces an optional, non-durable preview for one validated invocation.

Implementations must not mutate external state. A missing preview is intentionally indistinguishable from an unavailable preview so callers can preserve the normal approval and execution flow.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§