Extract the file path from tool arguments for file-modifying tools
(tool_name: &str, args: &serde_json::Value)
| 149 | |
| 150 | /// Extract the file path from tool arguments for file-modifying tools |
| 151 | pub fn extract_file_path(tool_name: &str, args: &serde_json::Value) -> Option<String> { |
| 152 | if is_file_modifying_tool(tool_name) { |
| 153 | args.get("file_path") |
| 154 | .and_then(|v| v.as_str()) |
| 155 | .map(|s| s.to_string()) |
| 156 | } else { |
| 157 | None |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | #[cfg(test)] |
| 162 | mod tests { |
no test coverage detected