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

Function deny_proto_to_def

crates/openshell-policy/src/lib.rs:622–655  ·  view source on GitHub ↗
(
    protocol: &str,
    deny: &L7DenyRule,
    mcp_allow_all_known_mcp_methods: bool,
)

Source from the content-addressed store, hash-verified

620}
621
622fn deny_proto_to_def(
623 protocol: &str,
624 deny: &L7DenyRule,
625 mcp_allow_all_known_mcp_methods: bool,
626) -> L7DenyRuleDef {
627 let params: BTreeMap<String, QueryMatcherDef> = deny
628 .params
629 .iter()
630 .map(|(key, matcher)| (key.clone(), matcher_proto_to_def(matcher.clone())))
631 .collect();
632 let (tool, params) = split_tool_param(protocol, params);
633 let params = flat_params_to_def(protocol, params);
634 let method = yaml_mcp_method(
635 protocol,
636 &deny.method,
637 tool.is_some(),
638 mcp_allow_all_known_mcp_methods,
639 );
640 L7DenyRuleDef {
641 method,
642 path: deny.path.clone(),
643 command: deny.command.clone(),
644 query: deny
645 .query
646 .iter()
647 .map(|(key, matcher)| (key.clone(), matcher_proto_to_def(matcher.clone())))
648 .collect(),
649 operation_type: deny.operation_type.clone(),
650 operation_name: deny.operation_name.clone(),
651 fields: deny.fields.clone(),
652 tool,
653 params,
654 }
655}
656
657fn yaml_mcp_method(
658 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