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

Function params_with_tool

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

MCP `tool` is a policy convenience for the standard `tools/call` params.name field. When the endpoint method profile is enabled, authored tool selectors can omit method and are normalized to tools/call internally. Tool arguments intentionally have no policy matcher yet, so every allowed tool call permits all argument payloads by default.

(
    mut params: BTreeMap<String, ParamMatcherDef>,
    tool: Option<QueryMatcherDef>,
)

Source from the content-addressed store, hash-verified

485// intentionally have no policy matcher yet, so every allowed tool call permits
486// all argument payloads by default.
487fn params_with_tool(
488 mut params: BTreeMap<String, ParamMatcherDef>,
489 tool: Option<QueryMatcherDef>,
490) -> BTreeMap<String, ParamMatcherDef> {
491 if let Some(tool) = tool {
492 params
493 .entry("name".to_string())
494 .or_insert_with(|| ParamMatcherDef::Matcher(tool));
495 }
496 params
497}
498
499fn allow_def_to_proto(_protocol: &str, allow: L7AllowDef) -> L7Allow {
500 let params = flatten_param_matchers(params_with_tool(allow.params, allow.tool));

Callers 2

allow_def_to_protoFunction · 0.85
deny_def_to_protoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected