Skip to main content
Glama

service_restart

Restart a specific service in a designated environment to apply configuration changes, clear service state, or resolve runtime issues. Use within railway-mcp for efficient service management.

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
environmentIdYesID of the environment where the service should be restarted (usually obtained from service_info)
serviceIdYesID of the service to restart

Implementation Reference

  • Registration of the 'service_restart' MCP tool using createTool, including description, input schema, and handler function that delegates to serviceService.
    createTool( "service_restart", formatToolDescription({ type: 'API', description: "Restart a service in a specific environment", bestFor: [ "Applying configuration changes", "Clearing service state", "Resolving runtime issues" ], notFor: [ "Deploying new code (use deployment_trigger)", "Updating service config (use service_update)", "Long-term service stoppage (use service_delete)" ], relations: { prerequisites: ["service_list"], alternatives: ["deployment_trigger"], related: ["service_info", "deployment_logs"] } }), { 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)") }, async ({ serviceId, environmentId }) => { return serviceService.restartService(serviceId, environmentId); } )
  • The execution handler for the service_restart tool.
    async ({ serviceId, environmentId }) => { return serviceService.restartService(serviceId, environmentId); }
  • Zod input schema defining serviceId and environmentId parameters.
    { 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)")
  • Core helper method implementing the service restart logic via the client API, with temporary delay and response formatting.
    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)}`); } }
  • Global registration of all MCP tools, including service_restart from serviceTools, using server.tool() calls.
    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/jason-tan-swe/railway-mcp'

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