|
cxxmcp 1.1.6
C++ MCP SDK
|
Adapts a transport::ClientTransport to the existing client::Transport API. More...
#include <transport_adapter.hpp>
Public Member Functions | |
| ContractTransportAdapter (transport::ClientTransport &transport) | |
| ContractTransportAdapter (std::unique_ptr< transport::ClientTransport > transport) | |
| ContractTransportAdapter (const ContractTransportAdapter &)=delete | |
| ContractTransportAdapter & | operator= (const ContractTransportAdapter &)=delete |
| ContractTransportAdapter (ContractTransportAdapter &&other) noexcept | |
| ContractTransportAdapter & | operator= (ContractTransportAdapter &&other) noexcept |
| core::Result< protocol::JsonRpcResponse > | send (const protocol::JsonRpcRequest &request) override |
| Sends a JSON-RPC request and waits for the corresponding response. | |
| core::Result< core::Unit > | send_notification (const protocol::JsonRpcNotification ¬ification) override |
| Sends a JSON-RPC notification without waiting for a response. | |
| core::Result< core::Unit > | start (TransportRequestHandler request_handler, TransportNotificationHandler notification_handler={}) override |
| Starts receiving inbound messages for transports that need an active loop. | |
| void | stop () noexcept override |
| Requests transport shutdown. | |
Adapts a transport::ClientTransport to the existing client::Transport API.
This lets the established Client compatibility API and ClientPeer run over the role-generic transport contract. Inbound notifications and requests received while waiting for the matching response are dispatched through handlers installed with start(). This compatibility adapter expects send() calls to be serialized by the caller.
|
inlineoverridevirtual |
Sends a JSON-RPC request and waits for the corresponding response.
| request | Fully formed JSON-RPC request. |
Implements mcp::client::Transport.
|
inlineoverridevirtual |
Sends a JSON-RPC notification without waiting for a response.
| notification | Fully formed JSON-RPC notification. |
Reimplemented from mcp::client::Transport.
|
inlineoverridevirtual |
Starts receiving inbound messages for transports that need an active loop.
| request_handler | Callback used for server-to-client JSON-RPC requests. |
| notification_handler | Callback used for server-to-client notifications. |
Reimplemented from mcp::client::Transport.
|
inlineoverridevirtualnoexcept |
Requests transport shutdown.
stop() is best-effort and must not throw. Request/response-only transports can keep the default no-op implementation.
Reimplemented from mcp::client::Transport.