nsmcp::ToolRegistry method questionSnapshot (public)

 <instance of nsmcp::ToolRegistry[i]> questionSnapshot context \
    authorizer

Defined in /usr/local/ns/tcl/nsmcp/01-tools.tcl

Parameters:
context (required)
authorizer (required)

Testcases:
No testcase defined.
Source code:
set pins {}
set listed [:list $context $authorizer]
foreach {index type members} [ns_json triples getvalue -output triples -path tools -- $listed] {
    set metadata [ns_json parse [ns_json value -- [list {} object $members]]]
    if {![dict exists $metadata annotations readOnlyHint] || ![dict get $metadata annotations readOnlyHint]} continue
    set name [dict get $metadata name]
    if {$name ni [::nsmcp::questionAllowedTools]} continue
    if {![dict exists $metadata annotations destructiveHint] || [dict get $metadata annotations destructiveHint]
        || ![dict exists $metadata annotations openWorldHint] || [dict get $metadata annotations openWorldHint]} continue
    if {[dict size $pins]>=256 || [string bytelength $name]>128} {error "Question tool inventory exceeds limit"}
    dict set pins $name [:fingerprint $name]
}
if {$pins eq {}} {error "No permitted read-only question tools are available"}
return $pins
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: