rm
Delete files or directories from virtual filesystem workspaces. Specify a path and optional recursive flag to remove content.
Instructions
Remove file or directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| recursive | No |
Implementation Reference
- src/chuk_mcp_vfs/vfs_tools.py:214-243 (handler)Main implementation of the 'rm' tool handler in VFSTools class, handling path resolution, validation, and delegation to VFS rm/rmdir methods.async def rm(self, path: str, recursive: bool = False) -> RemoveResponse: """ Remove file or directory. Args: path: Path to remove recursive: If True, remove directories recursively Returns: RemoveResponse with success status """ vfs = self.workspace_manager.get_current_vfs() resolved_path = self.workspace_manager.resolve_path(path) node = await vfs.get_node_info(resolved_path) if not node: raise ValueError(f"Path not found: {resolved_path}") if node.is_dir and not recursive: raise ValueError( "Cannot remove directory without recursive=True. " "Use recursive=True to remove directories." ) if node.is_dir: await vfs.rmdir(resolved_path) else: await vfs.rm(resolved_path) return RemoveResponse(success=True, path=resolved_path)
- src/chuk_mcp_vfs/server.py:112-116 (registration)Registration of the 'rm' tool on the MCP server, wrapping and delegating to VFSTools.rm.@server.tool async def rm(path: str, recursive: bool = False): """Remove file or directory.""" return await vfs_tools.rm(path, recursive)
- src/chuk_mcp_vfs/models.py:183-188 (schema)Pydantic schema for the 'rm' tool response.class RemoveResponse(BaseModel): """Response from rm operation""" success: bool path: str