- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nsmcp::ConfigurationTool
::nsmcp::ConfigurationToolcreate ... \
[ -adminExample (default "") ] \
[ -adminSummary (default "") ] \
[ -authorizer:required authorizer:required ] \
[ -description (default "Inspect live NaviServer configuration for configuration reviews, SMTP policy interpretation and scaling advice. scope=server (default) returns process-wide sections plus the authenticated virtual server's sections, excluding other virtual servers. scope=process returns every section across all virtual servers and requires diagnostics.configuration.process.read in addition to diagnostics.runtime.read. Includes driver, database-pool, connection-pool, limit, logging and module settings. Policy scripts are returned as data and are never executed. Named credential values and URI userinfo are redacted; referenced files are not read. Configuration reflects the current configuration table, including defaults published there by modules, not necessarily every compiled default or a historical policy. Use section to select an exact section and its descendants. Follow nextArguments to retrieve remaining sections. Pair with server_topology and server_runtime for actual installed components and utilization.") ] \
[ -inputSchema (default " { "type": "object", "properties": { "scope": { "type": "string", "enum": [ "server", "process" ], "default": "server" }, "section": { "type": "string", "description": "Exact section prefix, including descendants; defaults to all authorized sections." }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "offset": { "type": "integer", "minimum": 0, "default": 0 } }, "additionalProperties": false } ") ] \
[ -name (default "configuration") ] \
[ -outputSchema (default "") ] \
[ -permission (default "diagnostics.runtime.read") ] \
[ -redactor:required redactor:required ]
Defined in /usr/local/ns/tcl/nsmcp/config-tools.tcl
Class Relations
::nx::Class create ::nsmcp::ConfigurationTool \ -superclass ::nsmcp::ToolMethods (to be applied on instances)
execute (scripted, public)
<instance of nsmcp::ConfigurationTool> execute context arguments
Read bounded, redacted runtime configuration evidence. Apply the selected process/server/module scope and retain coverage and pagination limitations.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- arguments (required)
- Rooted ns_json typed triples for the tool's JSON argument object.
- Returns:
- A rooted JSON tool-result object, including availability or job metadata as appropriate.
- Testcases:
- No testcase defined.
set options [:options $arguments] set server [$context server] set scope [dict get $options scope] if {$scope eq "process"} { ${:authorizer} require $context diagnostics.configuration.process.read } set prefix [dict get $options section] set sections [:sections] set secrets {} dict for {section parameters} $sections { foreach {name value} $parameters { if {[:credentialParameter $name] && $value ne ""} { lappend secrets $value } } } set names {} set excluded 0 foreach section [lsort [dict keys $sections]] { if {$scope eq "server" && [string match ns/server/* $section] && $section ne "ns/server/$server" && [string first "ns/server/$server/" $section] != 0} { incr excluded continue } if {$prefix ne "" && $section ne $prefix && [string first $prefix/ $section] != 0} { continue } lappend names $section } set offset [dict get $options offset] set limit [dict get $options limit] set array {} set index 0 foreach section [lrange $names $offset [expr {$offset+$limit-1}]] { set parameters {} set parameterIndex 0 set seen {} foreach {name value} [dict get $sections $section] { set clean [:value $name $value $secrets] set folded [string tolower $name] lappend parameters $parameterIndex object [list name string $name value string $clean redacted boolean [expr {$clean ne $value}] firstOccurrence boolean [expr {$folded ni $seen}]] lappend seen $folded incr parameterIndex } set sectionScope [expr {[string first "ns/server/" $section] == 0 ? "server" : "process"}] lappend array $index object [list name string $section scope string $sectionScope parameters array $parameters] incr index } set more [expr {$offset+$index < [llength $names]}] set next {} if {$more} { set next [list scope string $scope section string $prefix limit number $limit offset number [expr {$offset+$index}]] } return [list {} object [list server string $server observedAt number [clock seconds] scope string $scope configurationFile string [ns_info config] sectionCount number [llength $names] excludedServerSections number $excluded sections array $array more boolean $more nextArguments object $next coverage object {historical boolean false referencedFilesRead boolean false compiledDefaultsComplete boolean false}]]validate (scripted, public)
<instance of nsmcp::ConfigurationTool> validate arguments
Validate runtime-configuration inspection options. Decode the rooted JSON argument object and enforce this tool's option, range and combination constraints.
- Parameters:
- arguments (required)
- Rooted ns_json typed triples for the tool's JSON argument object.
- Returns:
- An empty result on success; invalid input raises RPC error -32602.
- Testcases:
- No testcase defined.
if {[catch { :options $arguments } message]} { return -code error -errorcode {NSMCP RPC -32602} $message }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)