pub enum MessageFromClient {
RequestFromClient(RequestFromClient),
ResultFromClient(ResultFromClient),
NotificationFromClient(NotificationFromClient),
Error(RpcError),
}
Expand description
An enum representing various types of messages that can be sent from an MCP Client.
It provides a typed structure for the message payload while skipping internal details like
requestId
and protocol version, which are used solely by the transport layer and
do not need to be exposed to the user.
Variants§
RequestFromClient(RequestFromClient)
ResultFromClient(ResultFromClient)
NotificationFromClient(NotificationFromClient)
Error(RpcError)
Trait Implementations§
Source§impl Clone for MessageFromClient
impl Clone for MessageFromClient
Source§fn clone(&self) -> MessageFromClient
fn clone(&self) -> MessageFromClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MessageFromClient
impl Debug for MessageFromClient
Source§impl From<CallToolRequest> for MessageFromClient
impl From<CallToolRequest> for MessageFromClient
Source§fn from(value: CallToolRequest) -> Self
fn from(value: CallToolRequest) -> Self
Converts to this type from the input type.
Source§impl From<CancelledNotification> for MessageFromClient
impl From<CancelledNotification> for MessageFromClient
Source§fn from(value: CancelledNotification) -> Self
fn from(value: CancelledNotification) -> Self
Converts to this type from the input type.
Source§impl From<CompleteRequest> for MessageFromClient
impl From<CompleteRequest> for MessageFromClient
Source§fn from(value: CompleteRequest) -> Self
fn from(value: CompleteRequest) -> Self
Converts to this type from the input type.
Source§impl From<CreateMessageResult> for MessageFromClient
impl From<CreateMessageResult> for MessageFromClient
Source§fn from(value: CreateMessageResult) -> Self
fn from(value: CreateMessageResult) -> Self
Converts to this type from the input type.
Source§impl From<GetPromptRequest> for MessageFromClient
impl From<GetPromptRequest> for MessageFromClient
Source§fn from(value: GetPromptRequest) -> Self
fn from(value: GetPromptRequest) -> Self
Converts to this type from the input type.
Source§impl From<InitializeRequest> for MessageFromClient
impl From<InitializeRequest> for MessageFromClient
Source§fn from(value: InitializeRequest) -> Self
fn from(value: InitializeRequest) -> Self
Converts to this type from the input type.
Source§impl From<InitializedNotification> for MessageFromClient
impl From<InitializedNotification> for MessageFromClient
Source§fn from(value: InitializedNotification) -> Self
fn from(value: InitializedNotification) -> Self
Converts to this type from the input type.
Source§impl From<ListPromptsRequest> for MessageFromClient
impl From<ListPromptsRequest> for MessageFromClient
Source§fn from(value: ListPromptsRequest) -> Self
fn from(value: ListPromptsRequest) -> Self
Converts to this type from the input type.
Source§impl From<ListResourceTemplatesRequest> for MessageFromClient
impl From<ListResourceTemplatesRequest> for MessageFromClient
Source§fn from(value: ListResourceTemplatesRequest) -> Self
fn from(value: ListResourceTemplatesRequest) -> Self
Converts to this type from the input type.
Source§impl From<ListResourcesRequest> for MessageFromClient
impl From<ListResourcesRequest> for MessageFromClient
Source§fn from(value: ListResourcesRequest) -> Self
fn from(value: ListResourcesRequest) -> Self
Converts to this type from the input type.
Source§impl From<ListRootsResult> for MessageFromClient
impl From<ListRootsResult> for MessageFromClient
Source§fn from(value: ListRootsResult) -> Self
fn from(value: ListRootsResult) -> Self
Converts to this type from the input type.
Source§impl From<ListToolsRequest> for MessageFromClient
impl From<ListToolsRequest> for MessageFromClient
Source§fn from(value: ListToolsRequest) -> Self
fn from(value: ListToolsRequest) -> Self
Converts to this type from the input type.
Source§impl From<NotificationFromClient> for MessageFromClient
impl From<NotificationFromClient> for MessageFromClient
Source§fn from(value: NotificationFromClient) -> Self
fn from(value: NotificationFromClient) -> Self
Converts to this type from the input type.
Source§impl From<PingRequest> for MessageFromClient
impl From<PingRequest> for MessageFromClient
Source§fn from(value: PingRequest) -> Self
fn from(value: PingRequest) -> Self
Converts to this type from the input type.
Source§impl From<ProgressNotification> for MessageFromClient
impl From<ProgressNotification> for MessageFromClient
Source§fn from(value: ProgressNotification) -> Self
fn from(value: ProgressNotification) -> Self
Converts to this type from the input type.
Source§impl From<ReadResourceRequest> for MessageFromClient
impl From<ReadResourceRequest> for MessageFromClient
Source§fn from(value: ReadResourceRequest) -> Self
fn from(value: ReadResourceRequest) -> Self
Converts to this type from the input type.
Source§impl From<RequestFromClient> for MessageFromClient
impl From<RequestFromClient> for MessageFromClient
Source§fn from(value: RequestFromClient) -> Self
fn from(value: RequestFromClient) -> Self
Converts to this type from the input type.
Source§impl From<Result> for MessageFromClient
impl From<Result> for MessageFromClient
Source§impl From<ResultFromClient> for MessageFromClient
impl From<ResultFromClient> for MessageFromClient
Source§fn from(value: ResultFromClient) -> Self
fn from(value: ResultFromClient) -> Self
Converts to this type from the input type.
Source§impl From<RootsListChangedNotification> for MessageFromClient
impl From<RootsListChangedNotification> for MessageFromClient
Source§fn from(value: RootsListChangedNotification) -> Self
fn from(value: RootsListChangedNotification) -> Self
Converts to this type from the input type.
Source§impl From<RpcError> for MessageFromClient
impl From<RpcError> for MessageFromClient
Source§impl From<SetLevelRequest> for MessageFromClient
impl From<SetLevelRequest> for MessageFromClient
Source§fn from(value: SetLevelRequest) -> Self
fn from(value: SetLevelRequest) -> Self
Converts to this type from the input type.
Source§impl From<SubscribeRequest> for MessageFromClient
impl From<SubscribeRequest> for MessageFromClient
Source§fn from(value: SubscribeRequest) -> Self
fn from(value: SubscribeRequest) -> Self
Converts to this type from the input type.
Source§impl From<UnsubscribeRequest> for MessageFromClient
impl From<UnsubscribeRequest> for MessageFromClient
Source§fn from(value: UnsubscribeRequest) -> Self
fn from(value: UnsubscribeRequest) -> Self
Converts to this type from the input type.
Source§impl FromMessage<MessageFromClient> for ClientMessage
impl FromMessage<MessageFromClient> for ClientMessage
fn from_message( message: MessageFromClient, request_id: Option<RequestId>, ) -> Result<Self, RpcError>
Source§impl McpMessage for MessageFromClient
impl McpMessage for MessageFromClient
fn is_response(&self) -> bool
fn is_request(&self) -> bool
fn is_notification(&self) -> bool
fn is_error(&self) -> bool
fn message_type(&self) -> MessageTypes
Auto Trait Implementations§
impl Freeze for MessageFromClient
impl RefUnwindSafe for MessageFromClient
impl Send for MessageFromClient
impl Sync for MessageFromClient
impl Unpin for MessageFromClient
impl UnwindSafe for MessageFromClient
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