MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / flatten_param_matchers

Function flatten_param_matchers

crates/openshell-policy/src/lib.rs:391–399  ·  view source on GitHub ↗

Convert MCP params maps into the flat proto/Rego keyspace. Only `name` is currently enforced for tools/call, but this keeps the YAML shape compatible with any future MCP-owned params selectors.

(
    params: BTreeMap<String, ParamMatcherDef>,
)

Source from the content-addressed store, hash-verified

389// currently enforced for tools/call, but this keeps the YAML shape compatible
390// with any future MCP-owned params selectors.
391fn flatten_param_matchers(
392 params: BTreeMap<String, ParamMatcherDef>,
393) -> BTreeMap<String, QueryMatcherDef> {
394 let mut flattened = BTreeMap::new();
395 for (key, matcher) in params {
396 flatten_param_matcher(&key, matcher, &mut flattened);
397 }
398 flattened
399}
400
401// Walk one params subtree, carrying the flattened dot-path key accumulated so
402// far. Leaf matchers are inserted into the map consumed by the runtime policy.

Callers 2

allow_def_to_protoFunction · 0.85
deny_def_to_protoFunction · 0.85

Calls 1

flatten_param_matcherFunction · 0.85

Tested by

no test coverage detected