Skip to main content

ToolHandlerBackend

Trait ToolHandlerBackend 

Source
pub trait ToolHandlerBackend: Send + 'static {
    // Required method
    fn step(
        &mut self,
        input: ToolHandlerInput,
    ) -> impl Future<Output = Result<ToolHandlerOutput, ToolError>> + Send + '_;
}
Expand description

Public implementation contract for one unique resumable tool handler. One handler owns one invocation. Start with Invoke, resume only the current interaction with its exact id, and use Cancel for cancellation. A completed result is terminal; a model-visible failure is a completed result with is_error. Import ToolHandlerBackend to call behavior on the supplied handle.

See crate::local::ToolRegistration for a complete example.

Required Methods§

Source

fn step( &mut self, input: ToolHandlerInput, ) -> impl Future<Output = Result<ToolHandlerOutput, ToolError>> + Send + '_

Advances the unique handler with an invocation, interaction response, or cancellation request.

§Errors

Returns ToolError for invalid transitions, arguments or interaction replies, unsupported behavior, cancellation, closure, transport or protocol failure. An accepted tool-authored failure is returned as a completed error result.

See crate::local::ToolRegistration for a complete example.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§