Skip to main content
Glama
milkymap

MCP4Modal Sandbox

by milkymap

list_sandboxes

View all Modal sandboxes and their status within a specific app namespace to monitor environments and identify running instances.

Instructions

        Lists all Modal sandboxes for a specific app namespace and their current status.
        
        Parameters:
        - app_name: Name of the Modal app namespace to list sandboxes for
        
        Returns a list of sandboxes containing:
        - sandbox_id: Unique identifier for each sandbox
        - sandbox_status: Current state of the sandbox (running/stopped)
        
        This tool is useful for:
        - Monitoring active Modal sandbox environments within an app namespace
        - Checking which sandboxes are currently running
        - Getting sandbox IDs for further management operations
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the list_sandboxes tool. It retrieves the list of Modal sandboxes for the associated app and constructs SandboxListItem objects with their IDs and statuses (running if poll returns None, stopped otherwise).
    async def list_sandboxes(self, ctx:Context) -> List[SandboxListItem]:
        await ctx.info(f"Listing sandboxes for app '{self.app_name}'...")
        app = modal.App.lookup(self.app_name, create_if_missing=True)
        sandbox_list: List[SandboxListItem] = []
        async for sandbox in modal.Sandbox.list.aio(app_id=app.app_id):
            sandbox_status = await sandbox.poll.aio()
            sandbox_list.append(SandboxListItem(
                sandbox_id=sandbox.object_id,
                sandbox_status=SandboxStatus.RUNNING if sandbox_status is None else SandboxStatus.STOPPED,
            ))
        await ctx.info(f"Found {len(sandbox_list)} sandboxes")
        return sandbox_list
  • Pydantic BaseModel defining the output schema for each item in the list returned by list_sandboxes tool, consisting of sandbox_id and sandbox_status.
    class SandboxListItem(BaseModel):
        sandbox_id: str
        sandbox_status: SandboxStatus
  • Registers the list_sandboxes tool with the FastMCP instance, linking the name, description from ToolDescriptions, and the handler method.
    mcp_app.tool(
        name="list_sandboxes",
        description=ToolDescriptions.LIST_SANDBOXES,
    )(self.list_sandboxes)
  • Enum used in SandboxListItem for the sandbox_status field, defining possible statuses returned by the tool.
    class SandboxStatus(str, Enum):
        RUNNING = "running"
        STOPPED = "stopped"
  • Tool description string used in the registration of list_sandboxes, providing usage instructions and parameter details.
    LIST_SANDBOXES = """
            Lists all Modal sandboxes for a specific app namespace and their current status.
            
            Parameters:
            - app_name: Name of the Modal app namespace to list sandboxes for
            
            Returns a list of sandboxes containing:
            - sandbox_id: Unique identifier for each sandbox
            - sandbox_status: Current state of the sandbox (running/stopped)
            
            This tool is useful for:
            - Monitoring active Modal sandbox environments within an app namespace
            - Checking which sandboxes are currently running
            - Getting sandbox IDs for further management operations
            """
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 of behavioral disclosure. It effectively describes the tool's behavior: it lists sandboxes, returns specific data (sandbox_id and sandbox_status), and implies it's a read-only operation for monitoring. It could improve by mentioning potential limitations like pagination or rate limits, but it provides good context beyond basic functionality.

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 clear sections (purpose, parameters, returns, use cases) and is appropriately sized. Every sentence adds value, such as explaining the return format and practical applications. It could be slightly more concise by integrating the 'useful for' points into the main description.

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 the tool's moderate complexity (listing resources), no annotations, no output schema, and 0 parameters with full schema coverage, the description is mostly complete. It explains what the tool does, what it returns, and when to use it. It could be improved by detailing error cases or authentication needs, but it adequately covers the core functionality.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the baseline is 4. The description mentions 'app_name' as a parameter, which adds meaning by specifying it's required for listing sandboxes, but this contradicts the schema (which has no parameters). However, since the schema coverage is high and parameters are zero, the description's extra detail is not penalized heavily.

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 ('Lists all Modal sandboxes') and resource ('for a specific app namespace'), distinguishing it from siblings like 'launch_sandbox' or 'terminate_sandbox' which perform different operations. It specifies the scope ('and their current status'), making the purpose 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 provides clear context for when to use this tool ('Monitoring active Modal sandbox environments within an app namespace', 'Checking which sandboxes are currently running', 'Getting sandbox IDs for further management operations'). However, it does not explicitly state when not to use it or name alternatives among the sibling tools.

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