Skip to main content
Glama
milkymap

MCP4Modal Sandbox

by milkymap

remove_path

Remove files or directories from a Modal sandbox to clean up temporary data, manage storage, and delete unwanted content.

Instructions

Removes a file or directory from the sandbox. Parameters: - sandbox_id: The unique identifier of the sandbox - path: Path to remove from the sandbox - recursive: Whether to remove the path recursively Returns a SandboxRemovePathResponse containing: - success: Boolean indicating if removal was successful - message: Descriptive message about the operation - path_removed: The path that was removed This tool is useful for: - Cleaning up temporary files - Removing unwanted content - Managing sandbox storage The tool will: 1. Verify sandbox exists and is running 2. Remove specified path (file or directory) 3. Return status of the operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sandbox_idYes
pathYes
recursiveNo

Implementation Reference

  • The handler function that executes the remove_path tool. It retrieves the Modal sandbox by ID, calls the rm method with the given path and recursive flag, logs the action, and returns a success response using SandboxRemovePathResponse.
    async def remove_path(self, sandbox_id: str, path: str, recursive: bool = False) -> SandboxRemovePathResponse: # Get sandbox from Modal using from_id modal_sandbox = await modal.Sandbox.from_id.aio(sandbox_id) await modal_sandbox.rm.aio(path, recursive=recursive) logger.info(f"Removed path {path} in sandbox {sandbox_id}") return SandboxRemovePathResponse( success=True, message=f"Path {path} removed successfully", path_removed=path, )
  • The registration of the remove_path tool in the FastMCP app, specifying name and description, bound to the self.remove_path handler.
    mcp_app.tool( name="remove_path", description=ToolDescriptions.REMOVE_PATH, )(self.remove_path)
  • Pydantic schema for the SandboxRemovePathResponse returned by the remove_path handler.
    class SandboxRemovePathResponse(BaseModel): success: bool message: str path_removed: str
  • The tool description string used in the registration of remove_path, detailing parameters, returns, and usage.
    REMOVE_PATH = """ Removes a file or directory from the sandbox. Parameters: - sandbox_id: The unique identifier of the sandbox - path: Path to remove from the sandbox - recursive: Whether to remove the path recursively Returns a SandboxRemovePathResponse containing: - success: Boolean indicating if removal was successful - message: Descriptive message about the operation - path_removed: The path that was removed This tool is useful for: - Cleaning up temporary files - Removing unwanted content - Managing sandbox storage The tool will: 1. Verify sandbox exists and is running 2. Remove specified path (file or directory) 3. Return status of the operation """

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/milkymap/mcp4modal_sandbox'

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