cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::protocol::CustomNotification< Params > Struct Template Reference

Generic typed MCP notification for extension methods. More...

#include <custom_methods.hpp>

Public Member Functions

template<class Serializer >
JsonRpcNotification to_json_rpc (Serializer serializer) const
 Creates a JsonRpcNotification envelope from this typed notification.
 

Public Attributes

std::string method
 Method name on the wire.
 
Params params
 Typed notification parameters.
 

Detailed Description

template<class Params>
struct mcp::protocol::CustomNotification< Params >

Generic typed MCP notification for extension methods.

Template Parameters
ParamsA struct with a to_json() free function.

Example:

struct MyEvent { std::string name; };
Json my_event_to_json(const MyEvent& e) { return {{"name", e.name}}; }
using MyNotification = CustomNotification<MyEvent>;
nlohmann::json Json
JSON value type used by all protocol DTOs.
Definition types.hpp:28

Member Function Documentation

◆ to_json_rpc()

template<class Params >
template<class Serializer >
JsonRpcNotification mcp::protocol::CustomNotification< Params >::to_json_rpc ( Serializer  serializer) const
inline

Creates a JsonRpcNotification envelope from this typed notification.

Parameters
serializerFunction that converts Params to JSON.

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