CompletionHandler

Trait CompletionHandler 

Source
pub trait CompletionHandler: Send + Sync {
    // Required methods
    fn complete_resource(
        &self,
        partial_uri: &str,
        ctx: &Context<'_>,
    ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send;
    fn complete_prompt_arg(
        &self,
        prompt_name: &str,
        arg_name: &str,
        partial_value: &str,
        ctx: &Context<'_>,
    ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send;
}
Expand description

Handler for completion suggestions.

Implement this trait to provide autocomplete suggestions for resource URIs, prompt arguments, etc.

Required Methods§

Source

fn complete_resource( &self, partial_uri: &str, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send

Complete a partial resource URI.

Source

fn complete_prompt_arg( &self, prompt_name: &str, arg_name: &str, partial_value: &str, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send

Complete a partial prompt argument.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> CompletionHandler for Arc<T>

Source§

fn complete_resource( &self, partial_uri: &str, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send

Source§

fn complete_prompt_arg( &self, prompt_name: &str, arg_name: &str, partial_value: &str, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<String>, McpError>> + Send

Implementors§