Skip to main content
Glama

list_modal_volumes

Retrieve a list of all Modal volumes with JSON output for managing cloud storage in serverless applications.

Instructions

List all Modal volumes using the Modal CLI with JSON output.

Returns:
    A dictionary containing the parsed JSON output of the Modal volumes list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_modal_volumes' tool. It executes the Modal CLI command 'modal volume list --json', processes the JSON output using helper functions, and returns a standardized dictionary with volumes list or error details.
    @mcp.tool()
    async def list_modal_volumes() -> dict[str, Any]:
        """
        List all Modal volumes using the Modal CLI with JSON output.
    
        Returns:
            A dictionary containing the parsed JSON output of the Modal volumes list.
        """
        try:
            result = run_modal_command(["modal", "volume", "list", "--json"])
            response = handle_json_response(result, "Failed to list volumes")
            if response["success"]:
                return {"success": True, "volumes": response["data"]}
            return response
        except Exception as e:
            logger.error(f"Failed to list Modal volumes: {e}")
            raise
  • Core helper function used by list_modal_volumes to execute shell commands via subprocess, capturing stdout/stderr and handling errors.
    def run_modal_command(command: list[str], uv_directory: str = None) -> dict[str, Any]:
        """Run a Modal CLI command and return the result"""
        try:
            # uv_directory is necessary for modal deploy, since deploying the app requires the app to use the uv venv
            command = (["uv", "run", f"--directory={uv_directory}"] if uv_directory else []) + command
            logger.info(f"Running command: {' '.join(command)}")
            result = subprocess.run(
                command,
                capture_output=True,
                text=True,
                check=True
            )
            return {
                "success": True,
                "stdout": result.stdout,
                "stderr": result.stderr,
                "command": ' '.join(command)
            }
        except subprocess.CalledProcessError as e:
            return {
                "success": False,
                "error": str(e),
                "stdout": e.stdout,
                "stderr": e.stderr,
                "command": ' '.join(command)
            }
  • Helper function called by list_modal_volumes to parse JSON from command stdout and standardize the response format with success/error handling.
    def handle_json_response(result: Dict[str, Any], error_prefix: str) -> Dict[str, Any]:
        """
        Handle JSON parsing of command output and return a standardized response.
        
        Args:
            result: The result from run_modal_command
            error_prefix: Prefix to use in error messages
            
        Returns:
            A dictionary with standardized success/error format
        """
        if not result["success"]:
            response = {"success": False, "error": f"{error_prefix}: {result.get('error', 'Unknown error')}"}
            if result.get("stdout"):
                response["stdout"] = result["stdout"]
            if result.get("stderr"):
                response["stderr"] = result["stderr"]
            return response
        
        try:
            data = json.loads(result["stdout"])
            return {"success": True, "data": data}
        except json.JSONDecodeError as e:
            response = {"success": False, "error": f"Failed to parse JSON output: {str(e)}"}
            if result.get("stdout"):
                response["stdout"] = result["stdout"]
            if result.get("stderr"):
                response["stderr"] = result["stderr"]
            return response
  • The @mcp.tool() decorator registers the list_modal_volumes function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions JSON output format but lacks critical details: whether this requires authentication, has rate limits, returns paginated results, or what happens on errors. For a list operation with zero annotation coverage, this leaves significant behavioral gaps.

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 appropriately concise with two focused sentences. The first sentence states the core action and implementation, while the second describes the return format. There's no wasted text, though it could be slightly more structured with clearer separation of concerns.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description provides adequate but minimal context. It covers what the tool does and the return format, but lacks behavioral details that would be helpful for an agent. For a read-only list operation, this is minimally viable but leaves room for improvement.

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 tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the empty parameter set. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose and output. This meets the baseline expectation for parameterless tools.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('Modal volumes') with specific implementation details ('using the Modal CLI with JSON output'). It distinguishes from siblings like 'list_modal_volume_contents' by focusing on volumes themselves rather than contents. However, it doesn't explicitly contrast with other volume-related tools like 'copy_modal_volume_files'.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites, appropriate contexts, or compare it to sibling tools like 'list_modal_volume_contents' for different use cases. The agent receives no usage direction beyond the basic function.

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

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