Skip to main content

PromptHandler

Trait PromptHandler 

Source
pub trait PromptHandler: Send + Sync {
    // Required methods
    fn list_prompts(
        &self,
        ctx: &Context<'_>,
    ) -> impl Future<Output = Result<Vec<Prompt>, McpError>> + Send;
    fn get_prompt(
        &self,
        name: &str,
        args: Option<Map<String, Value>>,
        ctx: &Context<'_>,
    ) -> impl Future<Output = Result<GetPromptResult, McpError>> + Send;
}
Expand description

Handler for prompt-related operations.

Implement this trait to expose prompts that AI assistants can use.

Required Methods§

Source

fn list_prompts( &self, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<Prompt>, McpError>> + Send

List all available prompts.

Source

fn get_prompt( &self, name: &str, args: Option<Map<String, Value>>, ctx: &Context<'_>, ) -> impl Future<Output = Result<GetPromptResult, McpError>> + Send

Get a prompt with the given arguments.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> PromptHandler for Arc<T>
where T: PromptHandler,

Source§

fn list_prompts( &self, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<Prompt>, McpError>> + Send

Source§

fn get_prompt( &self, name: &str, args: Option<Map<String, Value>>, ctx: &Context<'_>, ) -> impl Future<Output = Result<GetPromptResult, McpError>> + Send

Implementors§