- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nsmcp::ToolRegistry
::nsmcp::ToolRegistrycreate ... \
[ -providerContext (default "") ] \
[ -providers (default "") ] \
[ -stateStore (default "") ] \
[ -tools (default "") ]
Defined in /usr/local/ns/tcl/nsmcp/01-tools.tcl
Class Relations
Methods (to be applied on the object)
providerConfig (scripted, public)
nsmcp::ToolRegistryproviderConfig context parameter default
Read a provider setting from the configured sections. Try the primary and fallback sections in order, using the supplied default when neither supplies the parameter.
- Parameters:
- context (required)
- Provider configuration dictionary with primary and fallback section names.
- parameter (required)
- NaviServer configuration parameter name.
- default (required)
- Value used when the requested configuration entry is absent.
- Returns:
- The configured setting, or the default.
- Testcases:
- No testcase defined.
Methods (to be applied on instances)
call (scripted, public)
<instance of nsmcp::ToolRegistry> call context authorizer name \ arguments
Authorize, validate and invoke a registered tool. Check enable state, permissions and question pins before handing arguments to the tool.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- authorizer (required)
- Authorizer used to enforce the request context's permissions and targets.
- name (required)
- Name of the configured or registered item to resolve.
- arguments (required)
- Rooted ns_json typed triples for the tool's JSON argument object.
- Returns:
- The tool's rooted JSON result; policy and validation failures raise RPC errors.
- Testcases:
- No testcase defined.
controlsAvailable (scripted, public)
<instance of nsmcp::ToolRegistry> controlsAvailable
Report whether runtime tool enable controls are configured. The state store determines availability of administrative overrides.
- Returns:
- True when a runtime state store is present, otherwise false.
- Testcases:
- No testcase defined.
describe (scripted, public)
<instance of nsmcp::ToolRegistry> describe
List administrative metadata for registered tools. Include permission and enable-state information without executing tools or applying a caller's permission filter.
- Returns:
- A list of tool metadata dictionaries.
- Testcases:
- No testcase defined.
enabled (scripted, public)
<instance of nsmcp::ToolRegistry> enabled name
Report whether a named tool is administratively enabled. Refresh provider registrations first; caller permissions are checked separately during listing and invocation.
- Parameters:
- name (required)
- Registered MCP tool name.
- Returns:
- The effective enabled flag, or false for an unknown tool.
- Testcases:
- No testcase defined.
fingerprint (scripted, public)
<instance of nsmcp::ToolRegistry> fingerprint name
Hash a registered tool's permission and descriptor. Question conversations use this bounded descriptor fingerprint to detect a changed tool definition.
- Parameters:
- name (required)
- Registered MCP tool name whose descriptor is pinned.
- Returns:
- The hexadecimal SHA-256 fingerprint; unknown tools raise an error.
- Testcases:
- No testcase defined.
list (scripted, public)
<instance of nsmcp::ToolRegistry> list context authorizer
List the tools available to an authenticated caller. Refresh providers and apply administrative enable flags and the supplied authorizer.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- authorizer (required)
- Authorizer used to enforce the request context's permissions and targets.
- Returns:
- A rooted JSON object containing the tools array.
- Testcases:
- No testcase defined.
questionSnapshot (scripted, public)
<instance of nsmcp::ToolRegistry> questionSnapshot context \ authorizer
Pin the permitted tool inventory for a new question. Apply request authorization and question allowlists; outbound upstream comparison additionally requires its configured provider and switches.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- authorizer (required)
- Authorizer used to enforce the request context's permissions and targets.
- Returns:
- A dictionary mapping allowed tool names to descriptor fingerprints.
- Testcases:
- No testcase defined.
refreshProviders (scripted, public)
<instance of nsmcp::ToolRegistry> refreshProviders
Refresh registrations supplied by configured tool providers. Reconcile provider descriptors with registry state; this is registration work, not a tool invocation.
- Returns:
- The provider dictionary when a provider context is configured, otherwise an empty result.
- Testcases:
- No testcase defined.
register (scripted, public)
<instance of nsmcp::ToolRegistry> register tool
Register a tool object under its configured name. Reject duplicate names so dispatch cannot silently replace an existing registration.
- Parameters:
- tool (required)
- Tool object to register.
- Returns:
- The updated internal registration dictionary.
- Testcases:
- No testcase defined.
setEnabled (scripted, public)
<instance of nsmcp::ToolRegistry> setEnabled name enabled
Change the administrative enable flag for a registered tool. This trusted interface affects new calls, not jobs already running or background collectors.
- Parameters:
- name (required)
- Registered MCP tool name.
- enabled (required, boolean)
- Boolean administrative enable flag.
- Returns:
- The enabled flag written to the state store.
- Testcases:
- No testcase defined.
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)