Skip to main content

ClientRequester

Trait ClientRequester 

Source
pub trait ClientRequester: Send + Sync {
    // Required methods
    fn sample<'life0, 'async_trait>(
        &'life0 self,
        params: CreateMessageParams,
    ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn elicit<'life0, 'async_trait>(
        &'life0 self,
        params: ElicitRequestParams,
    ) -> Pin<Box<dyn Future<Output = Result<ElicitResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for sending requests from server to client

This enables bidirectional communication where the server can request actions from the client, such as sampling (LLM requests) and elicitation (user input requests).

Required Methods§

Source

fn sample<'life0, 'async_trait>( &'life0 self, params: CreateMessageParams, ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a sampling request to the client

Returns the LLM completion result from the client.

Source

fn elicit<'life0, 'async_trait>( &'life0 self, params: ElicitRequestParams, ) -> Pin<Box<dyn Future<Output = Result<ElicitResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send an elicitation request to the client

This requests user input from the client. The request can be either form-based (structured input) or URL-based (redirect to external URL).

Returns the elicitation result with the user’s action and any submitted data.

Implementors§