pub struct SessionAwareMcpHandlerBridge { /* private fields */ }Expand description
Session-aware bridge handler that adapts McpHandler to JsonRpcHandler
Provides session management and lifecycle enforcement for custom MCP handlers, automatically injecting session context and enforcing initialization requirements.
Implementations§
Source§impl SessionAwareMcpHandlerBridge
impl SessionAwareMcpHandlerBridge
Sourcepub fn new(
handler: Arc<dyn McpHandler>,
session_manager: Arc<SessionManager>,
strict_lifecycle: bool,
) -> Self
pub fn new( handler: Arc<dyn McpHandler>, session_manager: Arc<SessionManager>, strict_lifecycle: bool, ) -> Self
Creates a new session-aware handler bridge
Trait Implementations§
Source§impl JsonRpcHandler for SessionAwareMcpHandlerBridge
impl JsonRpcHandler for SessionAwareMcpHandlerBridge
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<RequestParams>,
session_context: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = Result<Value, McpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<RequestParams>,
session_context: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = Result<Value, McpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a JSON-RPC method call with optional session context
Returns domain errors only - dispatcher handles conversion to JSON-RPC errors
Source§fn handle_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<RequestParams>,
session_context: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = Result<(), McpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<RequestParams>,
session_context: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = Result<(), McpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a JSON-RPC notification with optional session context (optional - default does nothing)
Source§fn supported_methods(&self) -> Vec<String>
fn supported_methods(&self) -> Vec<String>
List supported methods (optional - used for introspection)
Auto Trait Implementations§
impl Freeze for SessionAwareMcpHandlerBridge
impl !RefUnwindSafe for SessionAwareMcpHandlerBridge
impl Send for SessionAwareMcpHandlerBridge
impl Sync for SessionAwareMcpHandlerBridge
impl Unpin for SessionAwareMcpHandlerBridge
impl !UnwindSafe for SessionAwareMcpHandlerBridge
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<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.