const NON_MUTATING_TOOLS: &[&str] = &[
"echo",
"time_now",
"file_read",
"search",
"ls",
"rollback", ];
const MUTATING_TOOLS: &[&str] = &["shell", "shell_write", "patch", "plan"];
pub fn is_mutating_tool(tool_name: &str) -> bool {
if MUTATING_TOOLS.contains(&tool_name) {
return true;
}
if NON_MUTATING_TOOLS.contains(&tool_name) {
return false;
}
true
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_mutating_tool() {
assert!(!is_mutating_tool("file_read"));
assert!(!is_mutating_tool("search"));
assert!(!is_mutating_tool("ls"));
assert!(!is_mutating_tool("echo"));
assert!(is_mutating_tool("shell"));
assert!(is_mutating_tool("shell_write"));
assert!(is_mutating_tool("patch"));
assert!(is_mutating_tool("plan"));
assert!(is_mutating_tool("unknown_tool"));
}
}