pub struct LoopbackTransport { /* private fields */ }Expand description
Pure-Rust transport that round-trips calls through a local
ToolRegistry. Useful for testing the MCP composition story without
spawning an external process.
LoopbackTransport also doubles as the building block for
McpToolServer-style exports in a future commit: any registry can be
wrapped in a transport and then attached to a real MCP server crate.
Implementations§
Source§impl LoopbackTransport
impl LoopbackTransport
pub fn new(endpoint: impl Into<String>, registry: ToolRegistry) -> Self
Trait Implementations§
Source§impl McpTransport for LoopbackTransport
impl McpTransport for LoopbackTransport
Source§fn endpoint(&self) -> &str
fn endpoint(&self) -> &str
Stable identifier for this transport instance (typically the
server URI or stdio command).
Source§fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolSchema>, KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolSchema>, KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Discover the tools exposed by the remote endpoint. Called at
registration time; the returned schemas are authoritative.
Source§fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoke a named tool. Implementations MUST round-trip the result
JSON without modification so callers can rely on schema fidelity.
Auto Trait Implementations§
impl Freeze for LoopbackTransport
impl !RefUnwindSafe for LoopbackTransport
impl Send for LoopbackTransport
impl Sync for LoopbackTransport
impl Unpin for LoopbackTransport
impl UnsafeUnpin for LoopbackTransport
impl !UnwindSafe for LoopbackTransport
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