Skip to main content
Glama

variable_delete

Remove unused or sensitive environment variables from Railway.app services to manage configurations and maintain security.

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

  • Defines and registers the 'variable_delete' tool within the variableTools array using createTool, including description, schema, and handler.
    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 executor function of the 'variable_delete' tool, which delegates to the variableService.deleteVariable method.
    async ({ projectId, environmentId, name, serviceId }) => { return variableService.deleteVariable(projectId, environmentId, name, serviceId); }
  • VariableService.deleteVariable method providing the core deletion logic, API call, 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)}`); } }
  • VariableRepository.deleteVariable executes the GraphQL mutation for deleting a variable.
    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 }); }
  • Final MCP server registration of all tools, including variableTools containing 'variable_delete' via server.tool(...tool).
    export function registerAllTools(server: McpServer) { // Collect all tools const allTools = [ ...databaseTools, ...deploymentTools, ...domainTools, ...projectTools, ...serviceTools, ...tcpProxyTools, ...variableTools, ...configTools, ...volumeTools, ...templateTools, ] as Tool[]; // Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); }

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