Skip to main content
Glama

variable_delete

Removes specific environment variables in Railway services to manage configurations, enhance security, or clean up unused settings. Requires project, environment, and variable details for precise deletion.

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
environmentIdYesID of the environment to delete the variable from (usually obtained from service_list)
nameYesName of the variable to delete
projectIdYesID of the project
serviceIdNoID of the service (optional, if omitted deletes a shared variable)

Implementation Reference

  • Registration of the 'variable_delete' tool using createTool, including formatted description, Zod input schema, and handler function that delegates 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);
      }
    ),
  • The core handler function for the variable_delete tool, which invokes the variable service to perform the deletion
    async ({ projectId, environmentId, name, serviceId }) => {
      return variableService.deleteVariable(projectId, environmentId, name, serviceId);
    }
  • Zod schema defining the input parameters for the variable_delete tool
    {
      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)")
  • VariableService.deleteVariable method: wraps the repository call, handles errors, and formats success/error responses
    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 layer executes the GraphQL mutation to delete the variable via Railway API
    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 });
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It effectively discloses that this is a destructive operation (implied by 'Delete' and 'Security cleanup'), mentions prerequisites (service_list), and suggests next steps (deployment_trigger, service_restart) for post-deletion actions. However, it lacks details on permissions, error handling, or confirmation prompts, which would be helpful for a deletion tool.

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, front-loading the core purpose and efficiently organizing usage guidelines, prerequisites, and related tools. Every sentence earns its place without redundancy, making it easy to scan and understand quickly.

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 deletion tool with no annotations and no output schema, the description does a good job covering purpose, usage, and context. It mentions prerequisites and next steps, which adds valuable operational context. However, it could improve by detailing the deletion's impact (e.g., immediate vs. delayed, reversibility) or error cases, slightly reducing completeness.

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 parameters thoroughly. The description does not add any parameter-specific semantics beyond what the schema provides (e.g., it doesn't explain format constraints or provide examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Delete a variable'), the resource ('for a service in a specific environment'), and distinguishes it from siblings like variable_list (list), variable_set (set), and variable_bulk_set (bulk operations). It provides a precise verb+resource combination that avoids tautology.

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 includes 'Best for' scenarios (removing unused configuration, security cleanup, configuration management) and 'Not for' exclusions (temporary variable disabling, bulk variable removal), along with prerequisites (service_list) and related tools (variable_list, variable_set). This gives clear guidance on when to use this tool versus alternatives.

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

Related 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/jason-tan-swe/railway-mcp'

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