MCPcopy Create free account
hub / github.com/AI45Lab/Code / get_matching_rules

Method get_matching_rules

core/src/permissions/policy.rs:167–189  ·  view source on GitHub ↗

Get matching rules for debugging/logging

(&self, tool_name: &str, args: &serde_json::Value)

Source from the content-addressed store, hash-verified

165
166 /// Get matching rules for debugging/logging
167 pub fn get_matching_rules(&self, tool_name: &str, args: &serde_json::Value) -> MatchingRules {
168 let mut result = MatchingRules::default();
169
170 for rule in &self.deny {
171 if rule.matches(tool_name, args) {
172 result.deny.push(rule.rule.clone());
173 }
174 }
175
176 for rule in &self.allow {
177 if rule.matches(tool_name, args) {
178 result.allow.push(rule.rule.clone());
179 }
180 }
181
182 for rule in &self.ask {
183 if rule.matches(tool_name, args) {
184 result.ask.push(rule.rule.clone());
185 }
186 }
187
188 result
189 }
190}
191
192impl PermissionChecker for PermissionPolicy {

Callers 1

Calls 2

matchesMethod · 0.45
cloneMethod · 0.45

Tested by 1