Qore json Module 1.9.1
Loading...
Searching...
No Matches
McpServerHandler::McpServerHandler Class Reference

McpServer class definition; to be registered as a handler in the HttpServer class. More...

#include <McpServerHandler.qc.dox.h>

Inherits JsonRpcHandler, and ServerSentEventHandler.

Public Member Methods

 constructor (Logger::LoggerInterface logger, HttpServer::AbstractAuthenticator auth)
 Creates the handler.
 
 constructor (HttpServer::AbstractAuthenticator auth)
 Creates the handler.
 
 constructor ()
 Creates the handler.
 
 registerTool (string name, string desc, *AbstractDataProviderType input, code tool, *bool input_initialized, *hash< auto > extra, *AbstractDataProvider prov)
 Registers a tool.
 
 registerResource (string uri, string name, string desc, string mimeType)
 Registers a resource.
 
string getNextRequestId ()
 Returns the next request ID and increments the internal counter.
 
*string getCompatV1Endpoint (hash< auto > cx, hash< auto > hdr)
 Returns the 2024-11-05 JSON-RPC compatible endpoint, if any.
 
ServerSentEventConnection getConnectionImpl (Socket sock, hash< auto > cx, hash< auto > hdr, string cid)
 Called when a connection is established; the default implementation creates a ServerSentEventConnection object.
 

Public Attributes

const NoInputDescription = ...
 The input description for tools that do not require any input.
 
const SseHandlerOpts = ...
 Default SSE handler options.
 
const MaxMcpToolNameLength = 60
 Maximum name length for an MCP tool.
 

Private Member Methods

string getHeartbeatMessage (McpServerConnection conn)
 Use MCP ping as heartbeat message.
 
 registerNewConnectionIntern (string cid, ServerSentEventConnection conn)
 Called while holding the write lock to register the new connection.
 

Private Attributes

hash< string, hash< McpToolInfo > > tmap
 Registered tools: name -> tool.
 
hash< string, hash< McpResourceInfo > > rmap
 Registered resources: URI -> resource info.
 
hash< string, hash< McpPromptInfo > > pmap
 Registered prompts: name -> prompt info.
 
hash< string, hash< McpSessionInfo > > smap
 Session map; session ID -> session info.
 
hash< string, int > sidmap
 Session ID map.
 
int rid = 0
 Request ID counter.
 

Detailed Description

McpServer class definition; to be registered as a handler in the HttpServer class.


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