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 core handler function for the 'service_restart' MCP tool. It takes serviceId and environmentId parameters and delegates to the serviceService to perform the restart.
    async ({ serviceId, environmentId }) => {
      return serviceService.restartService(serviceId, environmentId);
    }
  • Zod input schema defining the parameters for the service_restart tool: serviceId and environmentId.
    {
      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)")
    },
  • The createTool call that defines the service_restart tool, including name, description (with relations), input schema, and handler. This is added to serviceTools array which is later registered in src/tools/index.ts.
      "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);
      }
    )
  • Supporting service method called by the tool handler. Performs the actual API call to restart the service instance and handles response/error 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 MCP tool registration function that includes serviceTools (containing service_restart) and registers all tools with the MCP server via server.tool(name, description, inputSchema, handler).
    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
        );
      });
    } 
Behavior4/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It effectively communicates that this is a mutation tool (implied by 'Restart'), specifies use cases and exclusions, and mentions prerequisites and alternatives. However, it lacks details on potential side effects (e.g., downtime, data loss) or response behavior, which would be helpful for a mutation tool with no annotations.

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 well-structured and front-loaded with the core purpose, followed by organized sections (Best for, Not for, Prerequisites, Alternatives, Related). Each sentence earns its place by providing actionable guidance without redundancy, making it efficient and easy to parse.

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 mutation tool with no annotations and no output schema, the description does an excellent job covering usage context, exclusions, and relationships. It falls short only in not detailing behavioral aspects like potential impacts (e.g., service interruption) or response format, which would enhance completeness given the tool's complexity and lack of structured metadata.

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?

The input schema has 100% description coverage, with clear documentation for both parameters (serviceId and environmentId). The description does not add any parameter-specific information beyond what the schema provides, such as format examples or sourcing details. Given the high schema coverage, a baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

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 specific action ('Restart a service') and resource ('in a specific environment'), using a precise verb. It distinguishes this tool from sibling tools like deployment_trigger, service_update, and service_delete by explicitly stating what it is not for, making the purpose unambiguous and well-differentiated.

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 guidance on when to use this tool ('Best for: Applying configuration changes, Clearing service state, Resolving runtime issues') and when not to use it ('Not for: Deploying new code, Updating service config, Long-term service stoppage'), with named alternatives for each exclusion. It also lists prerequisites (service_list) and related tools, offering comprehensive usage context.

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/epitaphe360/railway-mcp'

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