Skip to main content
Glama

service_restart

Restart a service to apply configuration changes, clear 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 restartService method in ServiceService class - core handler that calls the API to restart a service and waits 5 seconds before returning success.
    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)}`);
      }
    }
  • The 'service_restart' tool definition with Zod schema for serviceId and environmentId parameters, and formatToolDescription for metadata.
    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 registerAllTools function that registers all tools (including service_restart via serviceTools) 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
        );
      });
    } 
  • The restartService method in ServiceRepository that makes the actual GraphQL mutation 'serviceInstanceRedeploy' to the Railway API.
    async restartService(serviceId: string, environmentId: string): Promise<void> {
      await this.client.request<{ serviceInstanceRedeploy: boolean }>(`
        mutation serviceInstanceRedeploy($serviceId: String!, $environmentId: String!) {
          serviceInstanceRedeploy(serviceId: $serviceId, environmentId: $environmentId)
        }
      `, { serviceId, environmentId });
    }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It mentions 'Restart' which implies a state change but does not specify whether it's destructive, required permissions, impact on connected clients, or rollback capabilities. It only describes high-level purpose without behavioral details.

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 concise and well-structured using emojis and clear sections (Best for, Not for, Prerequisites, Alternatives, Related). Every sentence adds value without redundancy.

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?

For a simple restart tool with two parameters and no output schema, the description covers purpose, usage guidelines, and context well. It could benefit from behavioral details like idempotency or side effects, but given the tool's simplicity, it is fairly complete.

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 coverage is 100% with both parameters described. The description adds no additional meaning beyond the schema for these parameters. Baseline 3 is appropriate as the schema already documents them adequately.

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 tool restarts a service in a specific environment. It distinguishes from siblings by providing explicit use cases and exclusions (e.g., not for deploying new code, use deployment_trigger instead).

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 provides explicit when-to-use (applying config changes, clearing state, resolving runtime issues) and when-not-to-use (deploying code, updating config, long-term stoppage). It also lists prerequisites (service_list), alternatives (deployment_trigger), and related tools (service_info, deployment_logs).

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

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