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

Function allow_proto_to_def

crates/openshell-policy/src/lib.rs:587–620  ·  view source on GitHub ↗
(
    protocol: &str,
    allow: L7Allow,
    mcp_allow_all_known_mcp_methods: bool,
)

Source from the content-addressed store, hash-verified

585}
586
587fn allow_proto_to_def(
588 protocol: &str,
589 allow: L7Allow,
590 mcp_allow_all_known_mcp_methods: bool,
591) -> L7AllowDef {
592 let params: BTreeMap<String, QueryMatcherDef> = allow
593 .params
594 .into_iter()
595 .map(|(key, matcher)| (key, matcher_proto_to_def(matcher)))
596 .collect();
597 let (tool, params) = split_tool_param(protocol, params);
598 let params = flat_params_to_def(protocol, params);
599 let method = yaml_mcp_method(
600 protocol,
601 &allow.method,
602 tool.is_some(),
603 mcp_allow_all_known_mcp_methods,
604 );
605 L7AllowDef {
606 method,
607 path: allow.path,
608 command: allow.command,
609 query: allow
610 .query
611 .into_iter()
612 .map(|(key, matcher)| (key, matcher_proto_to_def(matcher)))
613 .collect(),
614 operation_type: allow.operation_type,
615 operation_name: allow.operation_name,
616 fields: allow.fields,
617 tool,
618 params,
619 }
620}
621
622fn deny_proto_to_def(
623 protocol: &str,

Callers 1

from_protoFunction · 0.85

Calls 4

matcher_proto_to_defFunction · 0.85
split_tool_paramFunction · 0.85
flat_params_to_defFunction · 0.85
yaml_mcp_methodFunction · 0.85

Tested by

no test coverage detected