Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler: Send + Sync {
    // Required method
    fn start(
        &self,
        call: ToolCall,
        context: ToolCallContext,
    ) -> Result<LinkedToolExecutionHandle, ToolStartError>;

    // Provided methods
    fn supports_abort(&self) -> bool { ... }
    fn supports_isolated_kill(&self) -> bool { ... }
    fn os_process_isolated(&self) -> bool { ... }
    fn runtime_owns_abortable_drive(&self) -> bool { ... }
}
Expand description

Host-linked tool implementation.

Required Methods§

Source

fn start( &self, call: ToolCall, context: ToolCallContext, ) -> Result<LinkedToolExecutionHandle, ToolStartError>

Start one execution. Must return a handle with a single completion.

Provided Methods§

Source

fn supports_abort(&self) -> bool

Whether cooperative/abort cancellation is honored (D-024 / D-028). Default false (fail-closed): capability booleans must not self-assert.

Source

fn supports_isolated_kill(&self) -> bool

Whether isolated kill after grace is available (D-024 / D-028). Default false (fail-closed). For process-isolated tool classes, registration also requires Self::os_process_isolated.

Source

fn os_process_isolated(&self) -> bool

Structural OS process isolation boundary (V2 §14.3).

Default false. Only handlers that own a real child process (not a Tokio task) may return true. Capability booleans alone are insufficient.

Source

fn runtime_owns_abortable_drive(&self) -> bool

Structural AbortableAtYield ownership (V2 §14.2 / D-050).

Default false. Only handlers registered via super::host_tools::RegisteredTool::try_new_abortable may return true; they yield CancelOnly + an unspawned drive future the runtime polls. Capability booleans alone are insufficient.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§