Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathYes
recursiveNo

Implementation Reference

  • 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)
  • 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)
  • Pydantic schema for the 'rm' tool response.
    class RemoveResponse(BaseModel): """Response from rm operation""" success: bool path: str

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrishayuk/chuk-mcp-vfs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server