| 789 | } |
| 790 | |
| 791 | fn parse_tools_field(value: &serde_yaml::Value) -> Vec<String> { |
| 792 | match value { |
| 793 | serde_yaml::Value::String(raw) => raw |
| 794 | .split(',') |
| 795 | .map(str::trim) |
| 796 | .filter(|tool| !tool.is_empty()) |
| 797 | .map(str::to_string) |
| 798 | .collect(), |
| 799 | serde_yaml::Value::Sequence(items) => items |
| 800 | .iter() |
| 801 | .filter_map(|item| item.as_str()) |
| 802 | .map(str::trim) |
| 803 | .filter(|tool| !tool.is_empty()) |
| 804 | .map(str::to_string) |
| 805 | .collect(), |
| 806 | _ => Vec::new(), |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | fn tool_name_to_permission(tool: &str) -> String { |
| 811 | let normalized = tool.trim(); |