nsmcp::Protocol method dispatch (public)
<instance of nsmcp::Protocol> dispatch context method params
Defined in /usr/local/ns/tcl/nsmcp/protocol.tcl
Dispatch an authenticated MCP protocol method. Handle initialization and tool operations using the configured registry and request authorizer.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- method (required)
- MCP protocol method or HTTP method, depending on the adapter.
- params (required)
- Rooted typed JSON-RPC parameters.
- Returns:
- The rooted JSON protocol result or notification result.
- Testcases:
- No testcase defined.
Source code: switch -- $method { initialize { set requested [:parameter $params protocolVersion string] :parameter $params capabilities object set client [list {} object [:parameter $params clientInfo object]] :parameter $client name string :parameter $client version string set version [expr {[:supports $requested] ? $requested : [lindex ${:versions} end]}] return [list {} object [list protocolVersion string $version capabilities object {tools object {listChanged boolean false}} serverInfo object {name string nsmcp version string 0.1}]] } ping { return {{} object {}} } tools/list { if {![catch { ns_json triples gettype -path cursor -- $params }]} { return -code error -errorcode {NSMCP RPC -32602} "Pagination is not available" } return [${:registry} list $context ${:authorizer}] } tools/call { set name [:parameter $params name string] set arguments {{} object {}} if {![catch { ns_json triples gettype -path arguments -- $params }]} { set arguments [list {} object [:parameter $params arguments object]] } return [${:registry} call $context ${:authorizer} $name $arguments] } default { return -code error -errorcode {NSMCP RPC -32601} "Method not found" } }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)