cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::transport::JsonLineTransport< Role > Class Template Referencefinal

Adapter for transports that expose newline-delimited JSON strings. More...

#include <adapters.hpp>

Inheritance diagram for mcp::transport::JsonLineTransport< Role >:
mcp::transport::Transport< Role >

Public Types

using TxMessage = typename Transport< Role >::TxMessage
 
using RxMessage = typename Transport< Role >::RxMessage
 
- Public Types inherited from mcp::transport::Transport< Role >
using TxMessage = typename MessageTraits< Role >::TxMessage
 
using RxMessage = typename MessageTraits< Role >::RxMessage
 

Public Member Functions

 JsonLineTransport (JsonLineTransportOptions< Role > options)
 
std::string_view name () const noexcept override
 Human-readable transport name for diagnostics.
 
protocol::Json diagnostics () const override
 Structured implementation diagnostics.
 
core::Result< core::Unitsend (TxMessage message) override
 Sends one JSON-RPC message to the peer.
 
core::Result< std::optional< RxMessage > > receive () override
 Receives the next JSON-RPC message from the peer.
 
core::Result< core::Unitclose () override
 Closes the transport and unblocks receive() where possible.
 
- Public Member Functions inherited from mcp::transport::Transport< Role >
virtual void wait_until_ready ()
 Blocks until the transport is ready to process messages.
 

Detailed Description

template<class Role>
class mcp::transport::JsonLineTransport< Role >

Adapter for transports that expose newline-delimited JSON strings.

Member Function Documentation

◆ close()

template<class Role >
core::Result< core::Unit > mcp::transport::JsonLineTransport< Role >::close ( )
inlineoverridevirtual

Closes the transport and unblocks receive() where possible.

Implements mcp::transport::Transport< Role >.

◆ diagnostics()

template<class Role >
protocol::Json mcp::transport::JsonLineTransport< Role >::diagnostics ( ) const
inlineoverridevirtual

Structured implementation diagnostics.

The default keeps the core contract narrow. Transports with useful state may return keys such as "name", "closed", "inflight", or backend-specific counters. Diagnostics are not part of the wire protocol.

Reimplemented from mcp::transport::Transport< Role >.

◆ name()

template<class Role >
std::string_view mcp::transport::JsonLineTransport< Role >::name ( ) const
inlineoverridevirtualnoexcept

Human-readable transport name for diagnostics.

Implements mcp::transport::Transport< Role >.

◆ receive()

template<class Role >
core::Result< std::optional< RxMessage > > mcp::transport::JsonLineTransport< Role >::receive ( )
inlineoverridevirtual

Receives the next JSON-RPC message from the peer.

receive() is the sequential inbound side. A successful std::nullopt return is an orderly end-of-stream signal, not a parse or transport error.

Implements mcp::transport::Transport< Role >.

◆ send()

template<class Role >
core::Result< core::Unit > mcp::transport::JsonLineTransport< Role >::send ( TxMessage  message)
inlineoverridevirtual

Sends one JSON-RPC message to the peer.

Concurrency safety is implementation-specific and must be documented by the concrete transport.

Implements mcp::transport::Transport< Role >.


The documentation for this class was generated from the following file: