Skip to main content
Glama

variable_bulk_set

Create or update multiple environment variables simultaneously for Railway.app services. Use this tool to migrate configurations, set up new services, or apply bulk updates efficiently.

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

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project containing the service
environmentIdYesID of the environment for the variables (usually obtained from service_list)
variablesYesObject mapping variable names to values
serviceIdNoOptional: ID of the service for the variables, if omitted updates shared variables)

Implementation Reference

  • Tool registration via createTool, including description, input schema, and handler function. The tool is exported as part of variableTools array.
    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);
      }
    ),
  • Core handler logic for bulk upserting variables: converts the variables record to an array of upsert inputs and calls the API client.
    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)}`);
      }
    }
  • 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)")
    },
  • Thin wrapper handler that delegates to the variableService.bulkUpsertVariables method.
    async ({ projectId, environmentId, variables, serviceId }) => {
      return variableService.bulkUpsertVariables(projectId, environmentId, variables, serviceId);
    }
  • Global registration of all tools (including variableTools containing variable_bulk_set) with the MCP server.
    allTools.forEach((tool) => {
      server.tool(
        ...tool
      );
    });
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by indicating it creates or updates variables, specifies bulk use cases, and notes prerequisites and related tools. However, it lacks details on permissions, rate limits, or error handling, which would enhance transparency further.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bullet points and icons, making it easy to scan. It is front-loaded with the core purpose and efficiently organized into sections like 'Best for' and 'Not for', with no wasted sentences—each part adds clear value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a bulk mutation tool with no annotations and no output schema, the description does a good job by covering purpose, usage, and related tools. However, it could improve by detailing output behavior or error cases, which would make it more complete for an agent's understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description does not add specific parameter semantics beyond what the schema provides, such as explaining 'variables' mapping or 'serviceId' optionality in more detail, resulting in a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create or update') and resource ('multiple environment variables at once'), making the purpose specific. It distinguishes from sibling 'variable_set' by emphasizing bulk operations versus single updates, providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly provides usage guidelines with 'Best for' and 'Not for' sections, naming specific scenarios like migration and setup. It lists prerequisites ('service_list'), alternatives ('variable_set'), and next steps ('deployment_trigger'), offering comprehensive guidance on when to use this tool versus others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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