AdvancedSamplingHandler

Trait AdvancedSamplingHandler 

Source
pub trait AdvancedSamplingHandler: Send + Sync {
    // Required methods
    fn collect_context<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        include_context: &'life1 IncludeContext,
        request: &'life2 SamplingRequest,
    ) -> Pin<Box<dyn Future<Output = MCPResult<Option<SamplingContext>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_human_approval<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 SamplingRequest,
        response: &'life2 SamplingResponse,
    ) -> Pin<Box<dyn Future<Output = MCPResult<ApprovalStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn process_human_feedback<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 SamplingRequest,
        feedback: &'life2 HumanFeedback,
    ) -> Pin<Box<dyn Future<Output = MCPResult<SamplingResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn estimate_cost<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 SamplingRequest,
    ) -> Pin<Box<dyn Future<Output = MCPResult<CostInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_sampling_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 SamplingRequest,
    ) -> Pin<Box<dyn Future<Output = MCPResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Handler for advanced sampling features including context collection and human-in-the-loop

Required Methods§

Source

fn collect_context<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, include_context: &'life1 IncludeContext, request: &'life2 SamplingRequest, ) -> Pin<Box<dyn Future<Output = MCPResult<Option<SamplingContext>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Collect context information for sampling requests

Source

fn handle_human_approval<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 SamplingRequest, response: &'life2 SamplingResponse, ) -> Pin<Box<dyn Future<Output = MCPResult<ApprovalStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle human-in-the-loop approval workflow

Source

fn process_human_feedback<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 SamplingRequest, feedback: &'life2 HumanFeedback, ) -> Pin<Box<dyn Future<Output = MCPResult<SamplingResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Process human feedback and modifications

Source

fn estimate_cost<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SamplingRequest, ) -> Pin<Box<dyn Future<Output = MCPResult<CostInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Estimate cost for sampling request

Source

fn validate_sampling_request<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SamplingRequest, ) -> Pin<Box<dyn Future<Output = MCPResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate sampling request with advanced checks

Implementors§