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; }

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