Skip to main content
Glama

volume_create

Create persistent storage volumes for services on Railway platform, ideal for database storage and persistent data configuration. Requires project, environment, and service IDs for setup.

Instructions

[API] Create a new persistent volume for a service

⚡️ Best for: ✓ Setting up database storage ✓ Configuring persistent data ✓ Adding file storage

⚠️ Not for: × Temporary storage needs × Static file hosting × Memory caching

→ Prerequisites: service_list

→ Next steps: volume_list

→ Related: service_update, database_deploy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesID of the environment for the volume (usually obtained from service_info)
mountPathYesPath where the volume should be mounted in the container
projectIdYesID of the project containing the service
serviceIdYesID of the service to attach volume to

Implementation Reference

  • Executes the core logic of the volume_create tool by invoking volumeService.createVolume with the input parameters.
    async ({ projectId, environmentId, serviceId, mountPath }) => {
      return volumeService.createVolume(projectId, serviceId, environmentId, mountPath);
    }
  • Zod schema defining the input parameters and descriptions for the volume_create tool.
      projectId: z.string().describe("ID of the project containing the service"),
      environmentId: z.string().describe("ID of the environment for the volume (usually obtained from service_info)"),
      serviceId: z.string().describe("ID of the service to attach volume to"),
      mountPath: z.string().describe("Path where the volume should be mounted in the container")
    },
  • Registers all tools with the MCP server, including volumeTools which contains the volume_create tool.
    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
        );
      });
    } 
  • Helper service method that orchestrates volume creation: prepares input, calls repository, formats success/error responses.
    async createVolume(projectId: string, serviceId: string, environmentId: string, mountPath: string): Promise<CallToolResult> {
      try {
        const input = { projectId, serviceId, environmentId, mountPath };
    
        const volume = await this.client.volumes.createVolume(input);
        if (!volume) {
          return createErrorResponse(`Error creating volume: Failed to create volume for ${serviceId} in environment ${environmentId}`);
        }
        
        return createSuccessResponse({
          text: `✅ Volume "${volume.name}" created successfully (ID: ${volume.id})`,
          data: volume
        });
      } catch (error) {
        return createErrorResponse(`Error creating volume: ${formatError(error)}`);
      }
    }
  • Repository helper that executes the GraphQL mutation for creating a volume.
    async createVolume(input: VolumeCreateInput): Promise<Volume> {
      const data = await this.client.request<{ volumeCreate: Volume }>(`
        mutation volumeCreate($input: VolumeCreateInput!) {
          volumeCreate(input: $input) {
            createdAt
            id
            name
            projectId
          }
        }
      `, { input });
    
      return data.volumeCreate;
    }

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