Skip to main content

ToolDyn

Trait ToolDyn 

Source
pub trait ToolDyn: WasmCompatSend + WasmCompatSync {
    // Required methods
    fn name(&self) -> String;
    fn definition<'a>(
        &'a self,
        prompt: String,
    ) -> WasmBoxedFuture<'a, ToolDefinition>;
    fn call<'a>(
        &'a self,
        args: String,
    ) -> WasmBoxedFuture<'a, Result<String, ToolError>>;
}
Expand description

Wrapper trait to allow for dynamic dispatch of simple tools

Required Methods§

Source

fn name(&self) -> String

Returns the tool name used for dispatch.

Source

fn definition<'a>( &'a self, prompt: String, ) -> WasmBoxedFuture<'a, ToolDefinition>

Returns the provider-facing tool schema.

Source

fn call<'a>( &'a self, args: String, ) -> WasmBoxedFuture<'a, Result<String, ToolError>>

Calls the tool with JSON-encoded arguments and returns model-facing text.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl ToolDyn for McpTool

Available on crate feature rmcp only.
Source§

impl<T: Tool> ToolDyn for T