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
            """
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing: 1) The 3-step process including verification, removal, and status return, 2) What gets removed (file or directory), 3) The return structure with success flag and message. It doesn't mention permission requirements or rate limits, but provides solid behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections (purpose, parameters, returns, usage, process). Some redundancy exists (parameters listed twice in description and schema), but overall efficient with every sentence adding value. Could be slightly more front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description provides good completeness: explains what it does, parameters, return structure, use cases, and process. Missing details about error conditions or specific limitations, but covers the essentials well given the context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by explaining all 3 parameters: sandbox_id (unique identifier), path (path to remove), and recursive (whether to remove recursively). It adds crucial meaning beyond the bare schema, especially clarifying what 'recursive' means in this context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Removes a file or directory from the sandbox' with specific verb (remove) and resource (file/directory in sandbox). It distinguishes from siblings like list_directory_contents (read-only) or terminate_sandbox (destroys entire sandbox).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'This tool is useful for' section provides clear context about when to use it (cleaning up temporary files, removing unwanted content, managing storage). However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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