ToolDeclaration Class Reference

#include <Pt/Mcp/ToolDeclaration.h>

MCP server and tool registry. More...

Inherits NonCopyable.

Public Member Functions

void toToolsList (std::ostream &os) const
 Writes the tools/list result JSON to the stream.
 
void toInitializeResult (std::ostream &os, const char *protocolVersion=0) const
 Writes the initialize result JSON to the stream. More...
 

Static Public Member Functions

static std::string preferredVersion (const std::string &requested)
 Returns the best supported protocol version for the given request. More...
 
static bool isSupportedVersion (const std::string &version)
 Returns true if version is a supported protocol version.
 

Detailed Description

Describes the MCP server capabilities and registered tools. Generates protocol responses for initialize and tools/list.

Member Function Documentation

◆ preferredVersion()

static std::string preferredVersion ( const std::string &  requested)
static

If requested matches a supported version it is returned verbatim. Otherwise the latest supported version is returned.

◆ toInitializeResult()

void toInitializeResult ( std::ostream &  os,
const char *  protocolVersion = 0 
) const

protocolVersion is the negotiated version string to echo back. If null the latest supported version is used.