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

Function tool_name_to_permission

core/src/subagent.rs:810–826  ·  view source on GitHub ↗
(tool: &str)

Source from the content-addressed store, hash-verified

808}
809
810fn tool_name_to_permission(tool: &str) -> String {
811 let normalized = tool.trim();
812 match normalized.to_ascii_lowercase().as_str() {
813 "*" => "*".to_string(),
814 "read" => "read(*)".to_string(),
815 "write" => "write(*)".to_string(),
816 "edit" => "edit(*)".to_string(),
817 "grep" => "grep(*)".to_string(),
818 "glob" => "glob(*)".to_string(),
819 "ls" => "ls(*)".to_string(),
820 "bash" => "bash(*)".to_string(),
821 "task" => "task(*)".to_string(),
822 "parallel_task" | "parallel-task" => "parallel_task(*)".to_string(),
823 _ if normalized.contains('(') => normalized.to_string(),
824 _ => format!("{normalized}(*)"),
825 }
826}
827
828fn permission_policy_from_tools(tools: &[String]) -> PermissionPolicy {
829 tools.iter().fold(PermissionPolicy::new(), |policy, tool| {

Callers 2

add_denied_toolsFunction · 0.85

Calls 2

containsMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected