McpIo

Trait McpIo 

Source
pub trait McpIo: Send + Sync {
    // Required methods
    fn read_line<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write_line<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        line: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for MCP I/O operations

This trait abstracts over the I/O operations needed by the MCP server, allowing for both production (stdin/stdout) and test (mock) implementations.

Required Methods§

Source

fn read_line<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a line from the input stream

Returns Ok(Some(line)) if a line was read, Ok(None) on EOF, or Err if an error occurred.

Source

fn write_line<'life0, 'life1, 'async_trait>( &'life0 mut self, line: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write a line to the output stream

The line should NOT include a trailing newline - it will be added automatically.

Source

fn flush<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush the output stream

Implementors§