Skip to main content

PromptProvider

Trait PromptProvider 

Source
pub trait PromptProvider: Send + Sync {
    // Required methods
    fn list_prompts<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PromptDescriptor>, CapabilityError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_prompt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        id: &'life1 PromptId,
        args: Value,
        ctx: &'life2 mut CapabilityContext<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<PromptContents, CapabilityError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

A provider of parameterised prompt templates.

Implement this trait to offer reusable prompt templates that the host can render with user-supplied arguments and inject into the conversation transcript. The agentkit MCP bridge uses this trait to surface MCP-server prompts into the agentic loop.

Required Methods§

Source

fn list_prompts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PromptDescriptor>, CapabilityError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all prompt templates currently available from this provider.

§Errors

Returns CapabilityError if the provider cannot enumerate its prompts.

Source

fn get_prompt<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 PromptId, args: Value, ctx: &'life2 mut CapabilityContext<'life3>, ) -> Pin<Box<dyn Future<Output = Result<PromptContents, CapabilityError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Renders a prompt template with the given arguments.

§Arguments
  • id - The unique prompt identifier, as returned in a PromptDescriptor.
  • args - A JSON value containing the template arguments, validated against the prompt’s PromptDescriptor::input_schema.
  • ctx - The shared capability context for this turn.
§Errors

Returns CapabilityError::Unavailable if the prompt does not exist, CapabilityError::InvalidInput if the arguments are malformed, or CapabilityError::ExecutionFailed if rendering fails.

Implementors§