Skip to main content
Glama

list_modal_volume_contents

Retrieve files and directories within a specified Modal volume by providing the volume name and optional path. Returns a JSON-formatted output of the volume's contents.

Instructions

List files and directories in a Modal volume. Args: volume_name: Name of the Modal volume to list contents from. path: Path within the volume to list contents from. Defaults to root ("/"). Returns: A dictionary containing the parsed JSON output of the volume contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo/
volume_nameYes

Implementation Reference

  • The handler function for the 'list_modal_volume_contents' tool. It is registered via the @mcp.tool() decorator and implements listing volume contents using Modal CLI 'volume ls --json' command, with helper functions for command execution and JSON response handling.
    @mcp.tool() async def list_modal_volume_contents(volume_name: str, path: str = "/") -> dict[str, Any]: """ List files and directories in a Modal volume. Args: volume_name: Name of the Modal volume to list contents from. path: Path within the volume to list contents from. Defaults to root ("/"). Returns: A dictionary containing the parsed JSON output of the volume contents. """ try: result = run_modal_command(["modal", "volume", "ls", "--json", volume_name, path]) response = handle_json_response(result, "Failed to list volume contents") if response["success"]: return {"success": True, "contents": response["data"]} return response except Exception as e: logger.error(f"Failed to list Modal volume contents: {e}") raise

Other Tools

Related 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