pub struct McpClient {
pub progress_dispatcher: ProgressDispatcher,
/* private fields */
}Fields§
§progress_dispatcher: ProgressDispatcherImplementations§
Source§impl McpClient
impl McpClient
pub fn new( client_info: ClientInfo, server_name: String, event_sender: Sender<McpClientEvent>, roots: Arc<RwLock<Vec<Root>>>, ) -> Self
pub fn server_name(&self) -> &str
Sourcepub async fn dispatch_elicitation(
&self,
request: CreateElicitationRequestParams,
) -> CreateElicitationResult
pub async fn dispatch_elicitation( &self, request: CreateElicitationRequestParams, ) -> CreateElicitationResult
Dispatch an elicitation request through the shared event channel.
Used by both the create_elicitation handler and the -32042
URL_ELICITATION_REQUIRED error path to ensure the same user-facing flow.
Sourcepub async fn forward_url_elicitation_complete(&self, elicitation_id: String)
pub async fn forward_url_elicitation_complete(&self, elicitation_id: String)
Forward a URL elicitation completion through the shared event channel.
Split out from on_url_elicitation_notification_complete so it can be
tested without constructing a NotificationContext.
Trait Implementations§
Source§impl ClientHandler for McpClient
impl ClientHandler for McpClient
fn get_info(&self) -> ClientInfo
async fn on_progress( &self, params: ProgressNotificationParam, _context: NotificationContext<RoleClient>, )
Source§async fn create_elicitation(
&self,
request: CreateElicitationRequestParams,
_context: RequestContext<RoleClient>,
) -> Result<CreateElicitationResult, ErrorData>
async fn create_elicitation( &self, request: CreateElicitationRequestParams, _context: RequestContext<RoleClient>, ) -> Result<CreateElicitationResult, ErrorData>
Handle an elicitation request from a server asking for user input. Read more
async fn on_url_elicitation_notification_complete( &self, params: ElicitationResponseNotificationParam, _context: NotificationContext<RoleClient>, )
async fn list_roots( &self, _context: RequestContext<RoleClient>, ) -> Result<ListRootsResult, ErrorData>
fn ping( &self, context: RequestContext<RoleClient>, ) -> impl Future<Output = Result<(), ErrorData>> + MaybeSendFuture
fn create_message( &self, params: CreateMessageRequestParams, context: RequestContext<RoleClient>, ) -> impl Future<Output = Result<CreateMessageResult, ErrorData>> + MaybeSendFuture
fn on_custom_request( &self, request: CustomRequest, context: RequestContext<RoleClient>, ) -> impl Future<Output = Result<CustomResult, ErrorData>> + MaybeSendFuture
fn on_cancelled( &self, params: CancelledNotificationParam, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_logging_message( &self, params: LoggingMessageNotificationParam, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_resource_updated( &self, params: ResourceUpdatedNotificationParam, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_resource_list_changed( &self, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_tool_list_changed( &self, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_prompt_list_changed( &self, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
fn on_custom_notification( &self, notification: CustomNotification, context: NotificationContext<RoleClient>, ) -> impl Future<Output = ()> + MaybeSendFuture
Auto Trait Implementations§
impl Freeze for McpClient
impl !RefUnwindSafe for McpClient
impl Send for McpClient
impl Sync for McpClient
impl Unpin for McpClient
impl UnsafeUnpin for McpClient
impl !UnwindSafe for McpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
fn handle_request( &self, request: <R as ServiceRole>::PeerReq, context: RequestContext<R>, ) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
fn handle_notification( &self, notification: <R as ServiceRole>::PeerNot, context: NotificationContext<R>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
fn get_info(&self) -> <R as ServiceRole>::Info
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<H> Service<RoleClient> for Hwhere
H: ClientHandler,
impl<H> Service<RoleClient> for Hwhere
H: ClientHandler,
async fn handle_request( &self, request: <RoleClient as ServiceRole>::PeerReq, context: RequestContext<RoleClient>, ) -> Result<<RoleClient as ServiceRole>::Resp, ErrorData>
async fn handle_notification( &self, notification: <RoleClient as ServiceRole>::PeerNot, context: NotificationContext<RoleClient>, ) -> Result<(), ErrorData>
fn get_info(&self) -> <RoleClient as ServiceRole>::Info
Source§impl<S> ServiceExt<RoleClient> for Swhere
S: Service<RoleClient>,
impl<S> ServiceExt<RoleClient> for Swhere
S: Service<RoleClient>,
fn serve_with_ct<T, E, A>( self, transport: T, ct: CancellationToken, ) -> impl Future<Output = Result<RunningService<RoleClient, S>, ClientInitializeError>> + MaybeSendFuture
Source§fn into_dyn(self) -> Box<dyn DynService<R>>
fn into_dyn(self) -> Box<dyn DynService<R>>
Convert this service to a dynamic boxed service Read more