Skip to main content
Glama

remove_modal_volume_file

Delete files or directories from a Modal volume. Specify the volume name, remote path, and optional recursive flag for directory removal. Returns the outcome of the operation.

Instructions

Delete a file or directory from a Modal volume. Args: volume_name: Name of the Modal volume to delete from. remote_path: Path to the file or directory to delete. recursive: If True, delete directories recursively. Required for deleting directories. Returns: A dictionary containing the result of the delete operation. Raises: Exception: If the delete operation fails for any reason.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recursiveNo
remote_pathYes
volume_nameYes

Implementation Reference

  • The handler function for the 'remove_modal_volume_file' tool, including the @mcp.tool() decorator for automatic registration and schema generation from type hints and docstring. It builds and executes a 'modal volume rm' command (with optional -r flag) using the shared run_modal_command helper, formats the response with success/error details.
    @mcp.tool() async def remove_modal_volume_file(volume_name: str, remote_path: str, recursive: bool = False) -> dict[str, Any]: """ Delete a file or directory from a Modal volume. Args: volume_name: Name of the Modal volume to delete from. remote_path: Path to the file or directory to delete. recursive: If True, delete directories recursively. Required for deleting directories. Returns: A dictionary containing the result of the delete operation. Raises: Exception: If the delete operation fails for any reason. """ try: command = ["modal", "volume", "rm"] if recursive: command.append("-r") command.extend([volume_name, remote_path]) result = run_modal_command(command) response = { "success": result["success"], "command": result["command"] } if not result["success"]: response["error"] = f"Failed to delete {remote_path}: {result.get('error', 'Unknown error')}" else: response["message"] = f"Successfully deleted {remote_path} from volume {volume_name}" if result.get("stdout"): response["stdout"] = result["stdout"] if result.get("stderr"): response["stderr"] = result["stderr"] return response except Exception as e: logger.error(f"Failed to delete from Modal volume: {e}") raise

Other Tools

Related Tools

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/smehmood/modal-mcp-server'

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