Skip to main content
Glama
milkymap

MCP4Modal Sandbox

by milkymap

make_directory

Create directories in Modal sandbox environments to organize files and prepare for operations. Specify path and optional parent directory creation.

Instructions

        Creates a new directory in the sandbox.
        
        Parameters:
        - sandbox_id: The unique identifier of the sandbox
        - path: Directory path to create in the sandbox
        - parents: Whether to create parent directories if they don't exist
        
        Returns a SandboxMakeDirectoryResponse containing:
        - success: Boolean indicating if directory creation was successful
        - message: Descriptive message about the operation
        - path_created: The path that was created
       
        
        This tool is useful for:
        - Setting up directory structures
        - Preparing for file operations
        - Organizing sandbox content
        
        The tool will:
        1. Verify sandbox exists and is running
        2. Create directory at specified path
        3. Return status of the operation
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sandbox_idYes
pathYes
parentsNo

Implementation Reference

  • The asynchronous handler function that executes the make_directory tool logic: fetches the sandbox, checks if running, creates directory using modal_sandbox.mkdir.aio(), logs, and returns success response.
    async def make_directory(self, sandbox_id: str, path: str, parents: bool = False) -> SandboxMakeDirectoryResponse:
        # Get sandbox from Modal using from_id
        modal_sandbox = await modal.Sandbox.from_id.aio(sandbox_id)
    
        # Check if sandbox is running before creating directory
        sandbox_status = await modal_sandbox.poll.aio()
        if sandbox_status is not None:
            raise ToolError(f"Sandbox {sandbox_id} is not running")
        
        await modal_sandbox.mkdir.aio(path, parents=parents)
        logger.info(f"Created directory {path} in sandbox {sandbox_id}")
        
        return SandboxMakeDirectoryResponse(
            success=True,
            message=f"Directory {path} created successfully",
            path_created=path,
        )
  • Registration of the make_directory tool using FastMCP's mcp_app.tool decorator, specifying name, description from ToolDescriptions, bound to self.make_directory method.
    mcp_app.tool(
        name="make_directory",
        description=ToolDescriptions.MAKE_DIRECTORY,
    )(self.make_directory)
  • Pydantic BaseModel defining the output schema/response structure for the make_directory tool.
    class SandboxMakeDirectoryResponse(BaseModel):
        success: bool
        message: str
        path_created: str
  • Tool description string defining input parameters, output, and usage for the make_directory tool, used in registration.
    MAKE_DIRECTORY = """
            Creates a new directory in the sandbox.
            
            Parameters:
            - sandbox_id: The unique identifier of the sandbox
            - path: Directory path to create in the sandbox
            - parents: Whether to create parent directories if they don't exist
            
            Returns a SandboxMakeDirectoryResponse containing:
            - success: Boolean indicating if directory creation was successful
            - message: Descriptive message about the operation
            - path_created: The path that was created
           
            
            This tool is useful for:
            - Setting up directory structures
            - Preparing for file operations
            - Organizing sandbox content
            
            The tool will:
            1. Verify sandbox exists and is running
            2. Create directory at specified path
            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 the full burden and does so well by detailing behavioral traits: it outlines a three-step process (verifying sandbox, creating directory, returning status), specifies what gets returned (success, message, path_created), and implies mutation (creation). It does not mention rate limits or auth needs, but covers key operational aspects.

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?

The description is well-structured with sections for purpose, parameters, returns, usage contexts, and behavioral steps, making it easy to scan. It is appropriately sized, but could be slightly more concise by integrating the 'useful for' list into the main flow without redundancy.

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?

Given no annotations, no output schema, and 0% schema coverage, the description provides comprehensive context: it explains the tool's purpose, parameters, return values, usage scenarios, and behavioral steps. It adequately covers the complexity, though it could note potential errors or prerequisites more explicitly.

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?

Schema description coverage is 0%, so the description must compensate fully, which it does by listing all three parameters with clear explanations: sandbox_id as 'unique identifier', path as 'Directory path to create', and parents as 'Whether to create parent directories if they don't exist'. This adds essential meaning beyond the bare schema.

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 specific action ('Creates a new directory') and resource ('in the sandbox'), distinguishing it from siblings like list_directory_contents or remove_path. It provides a verb+resource combination that is precise and unambiguous.

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 description includes a 'useful for' section with explicit contexts (e.g., 'Setting up directory structures', 'Preparing for file operations'), which gives clear guidance on when to use this tool. However, it does not explicitly mention when not to use it or name alternatives among siblings, such as remove_path for deletion.

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