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

Method check_skill_restrictions

core/src/safety_gate.rs:104–128  ·  view source on GitHub ↗
(&self, tool_name: &str)

Source from the content-addressed store, hash-verified

102 }
103
104 pub(crate) fn check_skill_restrictions(&self, tool_name: &str) -> Option<ToolGateDecision> {
105 if !self.config.enforce_active_skill_tool_restrictions {
106 return None;
107 }
108
109 let registry = self.config.skill_registry.as_ref()?;
110 let restricting_skills = registry.global_tool_restricting_skills();
111 if restricting_skills.is_empty() {
112 return None;
113 }
114
115 let allowed = restricting_skills
116 .iter()
117 .any(|skill| skill.is_tool_allowed(tool_name));
118 if allowed {
119 return None;
120 }
121
122 let msg = format!("Tool '{}' is not allowed by any active skill.", tool_name);
123 Some(ToolGateDecision::Deny {
124 output: msg.clone(),
125 event_reason: msg,
126 reason: ToolGateDenial::SkillRestriction,
127 })
128 }
129
130 pub(crate) fn permission_decision(
131 &self,

Callers 2

decideMethod · 0.80

Calls 4

is_tool_allowedMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected