pub enum MessageFromServer {
RequestFromServer(RequestFromServer),
ResultFromServer(ResultFromServer),
NotificationFromServer(NotificationFromServer),
Error(JsonrpcErrorError),
}
Expand description
An enum representing various types of messages that can be sent from an MCP Server.
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§
RequestFromServer(RequestFromServer)
ResultFromServer(ResultFromServer)
NotificationFromServer(NotificationFromServer)
Error(JsonrpcErrorError)
Trait Implementations§
Source§impl Clone for MessageFromServer
impl Clone for MessageFromServer
Source§fn clone(&self) -> MessageFromServer
fn clone(&self) -> MessageFromServer
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 MessageFromServer
impl Debug for MessageFromServer
Source§impl From<CallToolResult> for MessageFromServer
impl From<CallToolResult> for MessageFromServer
Source§fn from(value: CallToolResult) -> Self
fn from(value: CallToolResult) -> Self
Converts to this type from the input type.
Source§impl From<CancelledNotification> for MessageFromServer
impl From<CancelledNotification> for MessageFromServer
Source§fn from(value: CancelledNotification) -> Self
fn from(value: CancelledNotification) -> Self
Converts to this type from the input type.
Source§impl From<CompleteResult> for MessageFromServer
impl From<CompleteResult> for MessageFromServer
Source§fn from(value: CompleteResult) -> Self
fn from(value: CompleteResult) -> Self
Converts to this type from the input type.
Source§impl From<CreateMessageRequest> for MessageFromServer
impl From<CreateMessageRequest> for MessageFromServer
Source§fn from(value: CreateMessageRequest) -> Self
fn from(value: CreateMessageRequest) -> Self
Converts to this type from the input type.
Source§impl From<GetPromptResult> for MessageFromServer
impl From<GetPromptResult> for MessageFromServer
Source§fn from(value: GetPromptResult) -> Self
fn from(value: GetPromptResult) -> Self
Converts to this type from the input type.
Source§impl From<InitializeResult> for MessageFromServer
impl From<InitializeResult> for MessageFromServer
Source§fn from(value: InitializeResult) -> Self
fn from(value: InitializeResult) -> Self
Converts to this type from the input type.
Source§impl From<JsonrpcErrorError> for MessageFromServer
impl From<JsonrpcErrorError> for MessageFromServer
Source§fn from(value: JsonrpcErrorError) -> Self
fn from(value: JsonrpcErrorError) -> Self
Converts to this type from the input type.
Source§impl From<ListPromptsResult> for MessageFromServer
impl From<ListPromptsResult> for MessageFromServer
Source§fn from(value: ListPromptsResult) -> Self
fn from(value: ListPromptsResult) -> Self
Converts to this type from the input type.
Source§impl From<ListResourceTemplatesResult> for MessageFromServer
impl From<ListResourceTemplatesResult> for MessageFromServer
Source§fn from(value: ListResourceTemplatesResult) -> Self
fn from(value: ListResourceTemplatesResult) -> Self
Converts to this type from the input type.
Source§impl From<ListResourcesResult> for MessageFromServer
impl From<ListResourcesResult> for MessageFromServer
Source§fn from(value: ListResourcesResult) -> Self
fn from(value: ListResourcesResult) -> Self
Converts to this type from the input type.
Source§impl From<ListRootsRequest> for MessageFromServer
impl From<ListRootsRequest> for MessageFromServer
Source§fn from(value: ListRootsRequest) -> Self
fn from(value: ListRootsRequest) -> Self
Converts to this type from the input type.
Source§impl From<ListToolsResult> for MessageFromServer
impl From<ListToolsResult> for MessageFromServer
Source§fn from(value: ListToolsResult) -> Self
fn from(value: ListToolsResult) -> Self
Converts to this type from the input type.
Source§impl From<LoggingMessageNotification> for MessageFromServer
impl From<LoggingMessageNotification> for MessageFromServer
Source§fn from(value: LoggingMessageNotification) -> Self
fn from(value: LoggingMessageNotification) -> Self
Converts to this type from the input type.
Source§impl From<NotificationFromServer> for MessageFromServer
impl From<NotificationFromServer> for MessageFromServer
Source§fn from(value: NotificationFromServer) -> Self
fn from(value: NotificationFromServer) -> Self
Converts to this type from the input type.
Source§impl From<PingRequest> for MessageFromServer
impl From<PingRequest> for MessageFromServer
Source§fn from(value: PingRequest) -> Self
fn from(value: PingRequest) -> Self
Converts to this type from the input type.
Source§impl From<ProgressNotification> for MessageFromServer
impl From<ProgressNotification> for MessageFromServer
Source§fn from(value: ProgressNotification) -> Self
fn from(value: ProgressNotification) -> Self
Converts to this type from the input type.
Source§impl From<PromptListChangedNotification> for MessageFromServer
impl From<PromptListChangedNotification> for MessageFromServer
Source§fn from(value: PromptListChangedNotification) -> Self
fn from(value: PromptListChangedNotification) -> Self
Converts to this type from the input type.
Source§impl From<ReadResourceResult> for MessageFromServer
impl From<ReadResourceResult> for MessageFromServer
Source§fn from(value: ReadResourceResult) -> Self
fn from(value: ReadResourceResult) -> Self
Converts to this type from the input type.
Source§impl From<RequestFromServer> for MessageFromServer
impl From<RequestFromServer> for MessageFromServer
Source§fn from(value: RequestFromServer) -> Self
fn from(value: RequestFromServer) -> Self
Converts to this type from the input type.
Source§impl From<ResourceListChangedNotification> for MessageFromServer
impl From<ResourceListChangedNotification> for MessageFromServer
Source§fn from(value: ResourceListChangedNotification) -> Self
fn from(value: ResourceListChangedNotification) -> Self
Converts to this type from the input type.
Source§impl From<ResourceUpdatedNotification> for MessageFromServer
impl From<ResourceUpdatedNotification> for MessageFromServer
Source§fn from(value: ResourceUpdatedNotification) -> Self
fn from(value: ResourceUpdatedNotification) -> Self
Converts to this type from the input type.
Source§impl From<Result> for MessageFromServer
impl From<Result> for MessageFromServer
Source§impl From<ResultFromServer> for MessageFromServer
impl From<ResultFromServer> for MessageFromServer
Source§fn from(value: ResultFromServer) -> Self
fn from(value: ResultFromServer) -> Self
Converts to this type from the input type.
Source§impl From<ToolListChangedNotification> for MessageFromServer
impl From<ToolListChangedNotification> for MessageFromServer
Source§fn from(value: ToolListChangedNotification) -> Self
fn from(value: ToolListChangedNotification) -> Self
Converts to this type from the input type.
Source§impl FromMessage<MessageFromServer> for ServerMessage
impl FromMessage<MessageFromServer> for ServerMessage
fn from_message( message: MessageFromServer, request_id: Option<RequestId>, ) -> Result<Self, JsonrpcErrorError>
Source§impl MCPMessage for MessageFromServer
impl MCPMessage for MessageFromServer
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 MessageFromServer
impl RefUnwindSafe for MessageFromServer
impl Send for MessageFromServer
impl Sync for MessageFromServer
impl Unpin for MessageFromServer
impl UnwindSafe for MessageFromServer
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