Skip to main content
Glama

service_restart

Restart a Railway service to apply configuration changes, clear service state, or resolve runtime issues in a specific environment.

Instructions

[API] Restart a service in a specific environment

⚡️ Best for: ✓ Applying configuration changes ✓ Clearing service state ✓ Resolving runtime issues

⚠️ Not for: × Deploying new code (use deployment_trigger) × Updating service config (use service_update) × Long-term service stoppage (use service_delete)

→ Prerequisites: service_list

→ Alternatives: deployment_trigger

→ Related: service_info, deployment_logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceIdYesID of the service to restart
environmentIdYesID of the environment where the service should be restarted (usually obtained from service_info)

Implementation Reference

  • The handler function for the 'service_restart' tool that delegates to the serviceService.restartService method.
    async ({ serviceId, environmentId }) => { return serviceService.restartService(serviceId, environmentId); }
  • Zod input schema defining parameters for the service_restart tool.
    { serviceId: z.string().describe("ID of the service to restart"), environmentId: z.string().describe("ID of the environment where the service should be restarted (usually obtained from service_info)") },
  • Registration of all tools including serviceTools (containing service_restart) with the MCP server.
    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 ); }); }
  • Supporting method in ServiceService that performs the actual service restart via the API client and handles response.
    async restartService(serviceId: string, environmentId: string) { try { await this.client.services.restartService(serviceId, environmentId); await new Promise(resolve => setTimeout(resolve, 5000)); // TEMPORARY UNTIL WEBHOOKS ARE IMPLEMENTED: Wait for 5 seconds to ensure the service is restarted return createSuccessResponse({ text: `Service restarted successfully` }); } catch (error) { return createErrorResponse(`Error restarting service: ${formatError(error)}`); } }

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