AsyncPromptHandler

Trait AsyncPromptHandler 

Source
pub trait AsyncPromptHandler: Sized {
    type Arguments: PromptArguments;

    const NAME: &'static str;
    const DESCRIPTION: Option<&'static str> = None;

    // Required method
    fn resolve_async(
        args: Value,
    ) -> impl Future<Output = Result<Vec<PromptMessage>, String>>;
}
Expand description

Async trait for implementing MCP prompts.

Prompts are templates that can be resolved with arguments to produce messages. This async version allows for non-blocking operations like external API calls, etc.

Required Associated Constants§

Source

const NAME: &'static str

The name of the prompt as it will appear to MCP clients.

Provided Associated Constants§

Source

const DESCRIPTION: Option<&'static str> = None

Optional description of what the prompt does.

Required Associated Types§

Source

type Arguments: PromptArguments

The type that defines the prompt’s arguments.

Required Methods§

Source

fn resolve_async( args: Value, ) -> impl Future<Output = Result<Vec<PromptMessage>, String>>

Resolves the prompt with the given arguments to produce messages asynchronously.

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.

Implementors§