Skip to main content
Glama

volume_list

Manage and audit persistent storage configurations by listing all volumes in a project. Use this tool to view data volumes, track storage usage, and prepare for volume creation.

Instructions

[API] List all volumes in a project

⚡️ Best for: ✓ Viewing persistent storage configurations ✓ Managing data volumes ✓ Auditing storage usage

→ Prerequisites: project_list

→ Next steps: volume_create

→ Related: service_info, database_deploy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project to list volumes for

Implementation Reference

  • The execution handler for the 'volume_list' tool, which invokes the volume service to list volumes for the given project.
    async ({ projectId }) => {
      return volumeService.listVolumes(projectId);
    }
  • Zod input schema defining the required 'projectId' parameter for the tool.
      projectId: z.string().describe("ID of the project to list volumes for")
    },
  • Registration of the 'volume_list' tool using createTool, including description, schema, and handler, added to volumeTools export.
    createTool(
      "volume_list",
      formatToolDescription({
        type: 'API',
        description: "List all volumes in a project",
        bestFor: [
          "Viewing persistent storage configurations",
          "Managing data volumes",
          "Auditing storage usage"
        ],
        relations: {
          prerequisites: ["project_list"],
          nextSteps: ["volume_create"],
          related: ["service_info", "database_deploy"]
        }
      }),
      {
        projectId: z.string().describe("ID of the project to list volumes for")
      },
      async ({ projectId }) => {
        return volumeService.listVolumes(projectId);
      }
    ),
  • Global registration function that includes volumeTools (containing volume_list) and registers all tools with the MCP server.
    export function registerAllTools(server: McpServer) {
      // Collect all tools
      const allTools = [
        ...databaseTools,
        ...deploymentTools,
        ...domainTools,
        ...projectTools,
        ...serviceTools,
        ...tcpProxyTools,
        ...variableTools,
        ...configTools,
        ...volumeTools,
        ...templateTools,
      ] as Tool[];
    
      // Register each tool with the server
      allTools.forEach((tool) => {
        server.tool(
          ...tool
        );
      });
    } 
  • Supporting service method that performs the actual volume listing, formatting, and error handling, called by the tool handler.
      async listVolumes(projectId: string): Promise<CallToolResult> {
        try {
          const volumes = await this.client.volumes.listVolumes(projectId);
    
          if (volumes.length === 0) {
            return createSuccessResponse({
              text: "No volumes found in this project.",
              data: []
            });
          }
    
          const volumeDetails = volumes.map(volume => 
            `📦 ${volume.name} (ID: ${volume.id})
    Created: ${new Date(volume.createdAt).toLocaleString()}`
          );
    
          return createSuccessResponse({
            text: `Volumes in project:\n\n${volumeDetails.join('\n\n')}`,
            data: volumes
          });
        } catch (error) {
          return createErrorResponse(`Error listing volumes: ${formatError(error)}`);
        }
      }

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/jason-tan-swe/railway-mcp'

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