Peer

Trait Peer 

Source
pub trait Peer: Send + Sync {
    // Required method
    fn notify(
        &self,
        notification: Notification,
    ) -> Pin<Box<dyn Future<Output = Result<(), McpError>> + Send + '_>>;
}
Expand description

Trait for sending messages to the peer (client or server).

This trait abstracts over the transport layer, allowing the context to send notifications without knowing the underlying transport.

Required Methods§

Source

fn notify( &self, notification: Notification, ) -> Pin<Box<dyn Future<Output = Result<(), McpError>> + Send + '_>>

Send a notification to the peer.

Implementors§

Source§

impl Peer for NoOpPeer

Source§

impl<T> Peer for TransportPeer<T>
where T: Transport + 'static, <T as Transport>::Error: Into<McpError>,