McpRequestRouter

class McpRequestRouter(tools: List<McpTool>, serverName: String, toolCallListener: (String, Boolean, String?) -> Unit? = null)(source)

Routes incoming MCP JSON-RPC requests to the appropriate handler.

Handles initialize, ping, tools/list, tools/call, and notification methods. Receives a list of McpTool instances and dispatches tools/call by matching the tool name.

Constructors

Link copied to clipboard
constructor(tools: List<McpTool>, serverName: String, toolCallListener: (String, Boolean, String?) -> Unit? = null)

Functions

Link copied to clipboard
fun route(request: JsonObject): JsonObject?

Routes a parsed JSON-RPC request and returns the response, or null for notifications.