pub struct TransportDispatcher<T>where
T: Transport,{ /* private fields */ }Expand description
Generic dispatcher for any Transport implementation
This provides bidirectional MCP support for any transport that implements
the Transport trait. Unlike StdioDispatcher which directly reads/writes
stdin/stdout, this uses the Transport trait’s send() and receive() methods.
Usage:
ⓘ
use turbomcp_transport::TcpTransport;
use turbomcp_server::runtime::TransportDispatcher;
let addr = "127.0.0.1:8080".parse().unwrap();
let transport = TcpTransport::new_server(addr);
let dispatcher = TransportDispatcher::new(transport);Implementations§
Source§impl<T> TransportDispatcher<T>where
T: Transport,
impl<T> TransportDispatcher<T>where
T: Transport,
Trait Implementations§
Source§impl<T> Clone for TransportDispatcher<T>where
T: Transport,
impl<T> Clone for TransportDispatcher<T>where
T: Transport,
Source§impl<T> Debug for TransportDispatcher<T>where
T: Transport,
impl<T> Debug for TransportDispatcher<T>where
T: Transport,
Source§impl<T> ServerRequestDispatcher for TransportDispatcher<T>
impl<T> ServerRequestDispatcher for TransportDispatcher<T>
Source§fn send_elicitation<'life0, 'async_trait>(
&'life0 self,
request: ElicitRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<ElicitResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_elicitation<'life0, 'async_trait>(
&'life0 self,
request: ElicitRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<ElicitResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send an elicitation request to the client
Source§fn send_ping<'life0, 'async_trait>(
&'life0 self,
_request: PingRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<PingResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_ping<'life0, 'async_trait>(
&'life0 self,
_request: PingRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<PingResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a ping request to the client
Source§fn send_create_message<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<CreateMessageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_create_message<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<CreateMessageResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a sampling create message request to the client
Source§fn send_list_roots<'life0, 'async_trait>(
&'life0 self,
_request: ListRootsRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<ListRootsResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_list_roots<'life0, 'async_trait>(
&'life0 self,
_request: ListRootsRequest,
_ctx: RequestContext,
) -> Pin<Box<dyn Future<Output = ServerResult<ListRootsResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a roots list request to the client
Source§fn supports_bidirectional(&self) -> bool
fn supports_bidirectional(&self) -> bool
Check if client supports bidirectional communication
Source§fn get_client_capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_client_capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get client capabilities
Auto Trait Implementations§
impl<T> Freeze for TransportDispatcher<T>
impl<T> !RefUnwindSafe for TransportDispatcher<T>
impl<T> Send for TransportDispatcher<T>
impl<T> Sync for TransportDispatcher<T>
impl<T> Unpin for TransportDispatcher<T>
impl<T> !UnwindSafe for TransportDispatcher<T>
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