(
name: &str,
args: &serde_json::Value,
ctx: &ToolContext,
)
| 331 | } |
| 332 | |
| 333 | fn check_workspace_boundary( |
| 334 | name: &str, |
| 335 | args: &serde_json::Value, |
| 336 | ctx: &ToolContext, |
| 337 | ) -> Result<()> { |
| 338 | let path_field = match name { |
| 339 | "read" | "write" | "edit" | "patch" => Some("file_path"), |
| 340 | "ls" | "grep" | "glob" => Some("path"), |
| 341 | _ => None, |
| 342 | }; |
| 343 | |
| 344 | if let Some(field) = path_field { |
| 345 | if let Some(path_str) = args.get(field).and_then(|v| v.as_str()) { |
| 346 | ctx.resolve_workspace_path(path_str).map_err(|e| { |
| 347 | anyhow::anyhow!( |
| 348 | "Workspace boundary check failed for tool '{}' path '{}': {}", |
| 349 | name, |
| 350 | path_str, |
| 351 | e |
| 352 | ) |
| 353 | })?; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | Ok(()) |
| 358 | } |
| 359 | |
| 360 | pub fn workspace(&self) -> &PathBuf { |
| 361 | &self.workspace |
nothing calls this directly
no test coverage detected