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)
Implementations§
Source§impl MessageFromClient
impl MessageFromClient
Sourcepub fn is_initialize_request(&self) -> bool
pub fn is_initialize_request(&self) -> bool
Returns true
if the request is an InitializeRequest
.
Trait Implementations§
Source§impl Clone for MessageFromClient
impl Clone for MessageFromClient
Source§fn clone(&self) -> MessageFromClient
fn clone(&self) -> MessageFromClient
Returns a duplicate 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<'de> Deserialize<'de> for MessageFromClient
impl<'de> Deserialize<'de> for MessageFromClient
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageFromClient, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageFromClient, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<CallToolRequest> for MessageFromClient
impl From<CallToolRequest> for MessageFromClient
Source§fn from(value: CallToolRequest) -> MessageFromClient
fn from(value: CallToolRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<CancelledNotification> for MessageFromClient
impl From<CancelledNotification> for MessageFromClient
Source§fn from(value: CancelledNotification) -> MessageFromClient
fn from(value: CancelledNotification) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<CompleteRequest> for MessageFromClient
impl From<CompleteRequest> for MessageFromClient
Source§fn from(value: CompleteRequest) -> MessageFromClient
fn from(value: CompleteRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<CreateMessageResult> for MessageFromClient
impl From<CreateMessageResult> for MessageFromClient
Source§fn from(value: CreateMessageResult) -> MessageFromClient
fn from(value: CreateMessageResult) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ElicitResult> for MessageFromClient
impl From<ElicitResult> for MessageFromClient
Source§fn from(value: ElicitResult) -> MessageFromClient
fn from(value: ElicitResult) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<GetPromptRequest> for MessageFromClient
impl From<GetPromptRequest> for MessageFromClient
Source§fn from(value: GetPromptRequest) -> MessageFromClient
fn from(value: GetPromptRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<InitializeRequest> for MessageFromClient
impl From<InitializeRequest> for MessageFromClient
Source§fn from(value: InitializeRequest) -> MessageFromClient
fn from(value: InitializeRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<InitializedNotification> for MessageFromClient
impl From<InitializedNotification> for MessageFromClient
Source§fn from(value: InitializedNotification) -> MessageFromClient
fn from(value: InitializedNotification) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ListPromptsRequest> for MessageFromClient
impl From<ListPromptsRequest> for MessageFromClient
Source§fn from(value: ListPromptsRequest) -> MessageFromClient
fn from(value: ListPromptsRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ListResourceTemplatesRequest> for MessageFromClient
impl From<ListResourceTemplatesRequest> for MessageFromClient
Source§fn from(value: ListResourceTemplatesRequest) -> MessageFromClient
fn from(value: ListResourceTemplatesRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ListResourcesRequest> for MessageFromClient
impl From<ListResourcesRequest> for MessageFromClient
Source§fn from(value: ListResourcesRequest) -> MessageFromClient
fn from(value: ListResourcesRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ListRootsResult> for MessageFromClient
impl From<ListRootsResult> for MessageFromClient
Source§fn from(value: ListRootsResult) -> MessageFromClient
fn from(value: ListRootsResult) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ListToolsRequest> for MessageFromClient
impl From<ListToolsRequest> for MessageFromClient
Source§fn from(value: ListToolsRequest) -> MessageFromClient
fn from(value: ListToolsRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<MessageFromClient> for MessagesFromClient
impl From<MessageFromClient> for MessagesFromClient
Source§fn from(value: MessageFromClient) -> MessagesFromClient
fn from(value: MessageFromClient) -> MessagesFromClient
Converts to this type from the input type.
Source§impl From<NotificationFromClient> for MessageFromClient
impl From<NotificationFromClient> for MessageFromClient
Source§fn from(value: NotificationFromClient) -> MessageFromClient
fn from(value: NotificationFromClient) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<PingRequest> for MessageFromClient
impl From<PingRequest> for MessageFromClient
Source§fn from(value: PingRequest) -> MessageFromClient
fn from(value: PingRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ProgressNotification> for MessageFromClient
impl From<ProgressNotification> for MessageFromClient
Source§fn from(value: ProgressNotification) -> MessageFromClient
fn from(value: ProgressNotification) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ReadResourceRequest> for MessageFromClient
impl From<ReadResourceRequest> for MessageFromClient
Source§fn from(value: ReadResourceRequest) -> MessageFromClient
fn from(value: ReadResourceRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<RequestFromClient> for MessageFromClient
impl From<RequestFromClient> for MessageFromClient
Source§fn from(value: RequestFromClient) -> MessageFromClient
fn from(value: RequestFromClient) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<Result> for MessageFromClient
impl From<Result> for MessageFromClient
Source§fn from(value: Result) -> MessageFromClient
fn from(value: Result) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<ResultFromClient> for MessageFromClient
impl From<ResultFromClient> for MessageFromClient
Source§fn from(value: ResultFromClient) -> MessageFromClient
fn from(value: ResultFromClient) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<RootsListChangedNotification> for MessageFromClient
impl From<RootsListChangedNotification> for MessageFromClient
Source§fn from(value: RootsListChangedNotification) -> MessageFromClient
fn from(value: RootsListChangedNotification) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<RpcError> for MessageFromClient
impl From<RpcError> for MessageFromClient
Source§fn from(value: RpcError) -> MessageFromClient
fn from(value: RpcError) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<SetLevelRequest> for MessageFromClient
impl From<SetLevelRequest> for MessageFromClient
Source§fn from(value: SetLevelRequest) -> MessageFromClient
fn from(value: SetLevelRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<SubscribeRequest> for MessageFromClient
impl From<SubscribeRequest> for MessageFromClient
Source§fn from(value: SubscribeRequest) -> MessageFromClient
fn from(value: SubscribeRequest) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<UnsubscribeRequest> for MessageFromClient
impl From<UnsubscribeRequest> for MessageFromClient
Source§fn from(value: UnsubscribeRequest) -> MessageFromClient
fn from(value: UnsubscribeRequest) -> MessageFromClient
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<ClientMessage, 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
Source§impl Serialize for MessageFromClient
impl Serialize for MessageFromClient
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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