variable_bulk_set
Create or update multiple environment variables in bulk for Railway infrastructure. Ideal for migrating configurations, initial service setup, or batch updates. Requires project ID, environment ID, and variable mapping.
Instructions
[WORKFLOW] Create or update multiple environment variables at once
⚡️ Best for: ✓ Migrating configuration between services ✓ Initial service setup ✓ Bulk configuration updates
⚠️ Not for: × Single variable updates (use variable_set) × Temporary configuration changes
→ Prerequisites: service_list
→ Alternatives: variable_set
→ Next steps: deployment_trigger, service_restart
→ Related: variable_list, service_update
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environmentId | Yes | ID of the environment for the variables (usually obtained from service_list) | |
| projectId | Yes | ID of the project containing the service | |
| serviceId | No | Optional: ID of the service for the variables, if omitted updates shared variables) | |
| variables | Yes | Object mapping variable names to values |
Input Schema (JSON Schema)
Implementation Reference
- src/services/variable.service.ts:74-93 (handler)Core handler logic for bulk setting environment variables: transforms the variables record into an array of input objects and calls the API client to upsert them, with success/error responses.async bulkUpsertVariables(projectId: string, environmentId: string, variables: Record<string, string>, serviceId?: string) { try { const inputs = Object.entries(variables).map(([name, value]) => ({ projectId, environmentId, name, value, serviceId })); await this.client.variables.upsertVariables(inputs); const variableType = serviceId ? "service variables" : "shared environment variables"; return createSuccessResponse({ text: `Successfully updated ${inputs.length} ${variableType}` }); } catch (error) { return createErrorResponse(`Error updating variables: ${formatError(error)}`); } }
- src/tools/variable.tool.ts:118-123 (schema)Zod input schema defining parameters for the variable_bulk_set tool.{ projectId: z.string().describe("ID of the project containing the service"), environmentId: z.string().describe("ID of the environment for the variables (usually obtained from service_list)"), variables: z.record(z.string()).describe("Object mapping variable names to values"), serviceId: z.string().optional().describe("Optional: ID of the service for the variables, if omitted updates shared variables)") },
- src/tools/variable.tool.ts:97-127 (registration)Registers the 'variable_bulk_set' MCP tool using createTool, including formatted description, Zod schema, and handler lambda delegating to VariableService.bulkUpsertVariables.createTool( "variable_bulk_set", formatToolDescription({ type: 'WORKFLOW', description: "Create or update multiple environment variables at once", bestFor: [ "Migrating configuration between services", "Initial service setup", "Bulk configuration updates" ], notFor: [ "Single variable updates (use variable_set)", "Temporary configuration changes" ], relations: { prerequisites: ["service_list"], nextSteps: ["deployment_trigger", "service_restart"], alternatives: ["variable_set"], related: ["variable_list", "service_update"] } }), { projectId: z.string().describe("ID of the project containing the service"), environmentId: z.string().describe("ID of the environment for the variables (usually obtained from service_list)"), variables: z.record(z.string()).describe("Object mapping variable names to values"), serviceId: z.string().optional().describe("Optional: ID of the service for the variables, if omitted updates shared variables)") }, async ({ projectId, environmentId, variables, serviceId }) => { return variableService.bulkUpsertVariables(projectId, environmentId, variables, serviceId); } ),