PromptProvider

Trait PromptProvider 

Source
pub trait PromptProvider: Send + Sync {
    // Required methods
    fn list_prompts<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        cursor: Option<&'life1 str>,
        ctx: &'life2 RequestContext,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Prompt>, Option<String>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_prompt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        arguments: Option<HashMap<String, String>>,
        ctx: &'life2 RequestContext,
    ) -> Pin<Box<dyn Future<Output = Result<(Option<String>, Vec<PromptMessage>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for implementing prompt providers

Implement this trait to provide prompts (templates, instructions) to MCP clients. All methods receive a RequestContext with access to headers and request metadata.

Required Methods§

Source

fn list_prompts<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, cursor: Option<&'life1 str>, ctx: &'life2 RequestContext, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Prompt>, Option<String>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List available prompts

§Arguments
  • cursor - Optional pagination cursor
  • ctx - Request context with headers and metadata
§Returns

A tuple of (prompts, next_cursor)

Source

fn get_prompt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, arguments: Option<HashMap<String, String>>, ctx: &'life2 RequestContext, ) -> Pin<Box<dyn Future<Output = Result<(Option<String>, Vec<PromptMessage>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get a specific prompt with arguments

§Arguments
  • name - The name of the prompt to get
  • arguments - Prompt arguments to populate the template
  • ctx - Request context with headers and metadata
§Returns

A tuple of (description, messages)

Implementors§