Skip to main content
Glama

variable_delete

Delete environment variables from Railway.app services to remove unused configurations and enhance security through cleanup.

Instructions

[API] Delete a variable for a service in a specific environment

⚡️ Best for: ✓ Removing unused configuration ✓ Security cleanup ✓ Configuration management

⚠️ Not for: × Temporary variable disabling × Bulk variable removal

→ Prerequisites: service_list

→ Next steps: deployment_trigger, service_restart

→ Related: variable_list, variable_set

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project
environmentIdYesID of the environment to delete the variable from (usually obtained from service_list)
nameYesName of the variable to delete
serviceIdNoID of the service (optional, if omitted deletes a shared variable)

Implementation Reference

  • Registers the 'variable_delete' MCP tool using createTool, including Zod input schema, tool description, and thin handler delegating to variableService.deleteVariable
    createTool(
      "variable_delete",
      formatToolDescription({
        type: 'API',
        description: "Delete a variable for a service in a specific environment",
        bestFor: [
          "Removing unused configuration",
          "Security cleanup",
          "Configuration management"
        ],
        notFor: [
          "Temporary variable disabling",
          "Bulk variable removal"
        ],
        relations: {
          prerequisites: ["service_list"],
          nextSteps: ["deployment_trigger", "service_restart"],
          related: ["variable_list", "variable_set"]
        }
      }),
      {
        projectId: z.string().describe("ID of the project"),
        environmentId: z.string().describe("ID of the environment to delete the variable from (usually obtained from service_list)"),
        name: z.string().describe("Name of the variable to delete"),
        serviceId: z.string().optional().describe("ID of the service (optional, if omitted deletes a shared variable)")
      },
      async ({ projectId, environmentId, name, serviceId }) => {
        return variableService.deleteVariable(projectId, environmentId, name, serviceId);
      }
    ),
  • Service layer handler that calls the repository to delete the variable and formats the response
    async deleteVariable(projectId: string, environmentId: string, name: string, serviceId?: string) {
      try {
        await this.client.variables.deleteVariable({
          projectId,
          environmentId,
          name,
          serviceId
        });
    
        const variableType = serviceId ? "service variable" : "shared environment variable";
        return createSuccessResponse({
          text: `Successfully deleted ${variableType} "${name}"`
        });
      } catch (error) {
        return createErrorResponse(`Error deleting variable: ${formatError(error)}`);
      }
    }
  • Repository helper that executes the GraphQL mutation to delete the variable using the Railway API client
    async deleteVariable(input: VariableDeleteInput): Promise<void> {
      const { projectId, environmentId, serviceId, name } = input;
      await this.client.request<{ variableDelete: boolean }>(`
        mutation variableDelete(
          $projectId: String!,
          $environmentId: String!,
          $serviceId: String,
          $name: String!
        ) {
          variableDelete(
            input: {
              projectId: $projectId,
              environmentId: $environmentId,
              serviceId: $serviceId,
              name: $name
            }
          )
        }
      `, { projectId, environmentId, serviceId, name });
    }
  • TypeScript interface defining the input shape for variable deletion, used by the repository
    export interface VariableDeleteInput {
      projectId: string;
      environmentId: string;
      serviceId?: string;
      name: string;
    }
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 communicates this is a destructive operation ('Delete', 'Security cleanup'), mentions prerequisites, and hints at side effects through 'Next steps' (suggesting deployments or restarts may be needed). However, it doesn't explicitly state permission requirements, rate limits, or whether deletion is permanent/reversible.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, best for, not for, prerequisites, next steps, related tools) and uses bullet points/emojis for readability. While slightly longer than minimal, every section adds value. The core purpose is stated upfront, making it front-loaded.

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?

For a destructive tool with no annotations and no output schema, the description provides good context: clear purpose, usage guidelines, prerequisites, and related tools. It adequately covers the mutation nature and hints at side effects. The main gap is lack of explicit information about return values or error conditions.

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?

Schema description coverage is 100%, so the schema already documents all 4 parameters. The description adds minimal parameter-specific semantics beyond the schema - it mentions 'shared variable' context for the optional serviceId parameter, but doesn't provide additional format details, examples, or constraints. This meets the baseline for high schema coverage.

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 action ('Delete a variable'), specifies the resource ('for a service in a specific environment'), and distinguishes from siblings like 'variable_set' (create/update) and 'variable_list' (read). It provides specific context about configuration management rather than just restating the tool name.

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 includes explicit 'Best for' and 'Not for' sections with concrete use cases (removing unused configuration, security cleanup) and exclusions (temporary disabling, bulk removal). It also lists prerequisites ('service_list'), next steps ('deployment_trigger', 'service_restart'), and related tools ('variable_list', 'variable_set'), providing comprehensive guidance on when and how to use this tool.

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