Skip to main content
Glama

volume_create

Create persistent storage volumes for Railway services to manage database files, application data, and other storage needs that require data retention across deployments.

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
projectIdYesID of the project containing the service
environmentIdYesID of the environment for the volume (usually obtained from service_info)
serviceIdYesID of the service to attach volume to
mountPathYesPath where the volume should be mounted in the container

Implementation Reference

  • The handler function for the 'volume_create' tool, which delegates to volumeService.createVolume.
    async ({ projectId, environmentId, serviceId, mountPath }) => { return volumeService.createVolume(projectId, serviceId, environmentId, mountPath); }
  • Zod input schema defining parameters 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") },
  • Local registration of the volume_create tool within the volumeTools array using createTool.
    createTool( "volume_create", formatToolDescription({ type: 'API', description: "Create a new persistent volume for a service", bestFor: [ "Setting up database storage", "Configuring persistent data", "Adding file storage" ], notFor: [ "Temporary storage needs", "Static file hosting", "Memory caching" ], relations: { prerequisites: ["service_list"], nextSteps: ["volume_list"], related: ["service_update", "database_deploy"] } }), { 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") }, async ({ projectId, environmentId, serviceId, mountPath }) => { return volumeService.createVolume(projectId, serviceId, environmentId, mountPath); } ),
  • Global registration of all tools, including volumeTools which contains volume_create, to 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 ); }); }
  • Service layer implementation that handles volume creation logic, error handling, and response formatting by calling the client.
    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)}`); } }

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/epitaphe360/railway-mcp'

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