Skip to main content
Glama

restart_service

Restart services with automated health checks and rollback to maintain reliability during infrastructure updates on Last Rock MCP.

Instructions

Restart a service with pre/post health checks and automatic rollback. DO NOT use ssh_exec('docker restart') - always use this tool instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_nameYesService name (e.g., 'garza-home-mcp', 'nginx', 'postgres')
service_typeYesService type (fly_app/docker/systemd)
health_check_urlNoOptional URL to check service health

Implementation Reference

  • Schema definition for the 'restart_service' tool, specifying input parameters: service_name (required), service_type (required), and optional health_check_url.
    {
      name: "restart_service",
      description: "Restart a service with pre/post health checks and automatic rollback. DO NOT use ssh_exec('docker restart') - always use this tool instead.",
      inputSchema: {
        type: "object",
        properties: {
          service_name: {
            type: "string",
            description: "Service name (e.g., 'garza-home-mcp', 'nginx', 'postgres')"
          },
          service_type: {
            type: "string",
            description: "Service type (fly_app/docker/systemd)"
          },
          health_check_url: {
            type: "string",
            description: "Optional URL to check service health"
          }
        },
        required: ["service_name", "service_type"]
      }
    },
  • Handler logic for 'restart_service' tool within the CallToolRequestSchema switch statement. Extracts parameters and calls executeOrchestrator with operation 'maintain/restart-service'.
    case "restart_service": {
      const { service_name, service_type, health_check_url } = args as {
        service_name: string;
        service_type: string;
        health_check_url?: string;
      };
      
      const params: Record<string, string> = {
        service_name,
        service_type
      };
      
      if (health_check_url) {
        params.health_check_url = health_check_url;
      }
      
      result = executeOrchestrator("maintain/restart-service", params);
      break;
    }
  • Helper function executeOrchestrator that runs the orchestrator.py Python script with the given operation and parameters, handling JSON parsing and errors. Used by restart_service handler.
    function executeOrchestrator(operation: string, params: Record<string, string> = {}): any {
      const paramStr = Object.entries(params)
        .map(([key, value]) => `${key}="${value}"`)
        .join(" ");
      
      const cmd = `cd ${ORCHESTRATOR_PATH} && python orchestrator.py ${operation} ${paramStr}`;
      
      try {
        const output = execSync(cmd, {
          encoding: "utf-8",
          maxBuffer: 10 * 1024 * 1024
        });
        
        // Try to parse as JSON, fallback to plain text
        try {
          return JSON.parse(output);
        } catch {
          return { output: output.trim() };
        }
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
          stderr: error.stderr?.toString() || "",
          stdout: error.stdout?.toString() || ""
        };
      }
    }
  • src/index.ts:46-166 (registration)
    The tools array registers the 'restart_service' tool (among others) which is returned by the ListToolsRequestSchema handler.
    const tools: Tool[] = [
      {
        name: "deploy_mcp_server",
        description: "Deploy MCP server to Fly.io with state tracking, locks, and health checks. DO NOT use ssh_exec for deployments - always use this tool instead.",
        inputSchema: {
          type: "object",
          properties: {
            app_name: {
              type: "string",
              description: "Fly.io app name (e.g., 'garza-home-mcp')"
            },
            source_dir: {
              type: "string",
              description: "Source directory containing the MCP server code"
            },
            region: {
              type: "string",
              description: "Fly.io region (default: dfw)"
            }
          },
          required: ["app_name"]
        }
      },
      {
        name: "deploy_cloudflare_worker",
        description: "Deploy Cloudflare Worker with state tracking and health checks. DO NOT use ssh_exec('wrangler deploy') - always use this tool instead.",
        inputSchema: {
          type: "object",
          properties: {
            worker_name: {
              type: "string",
              description: "Worker name (e.g., 'voicenotes-webhook')"
            },
            source_dir: {
              type: "string",
              description: "Source directory containing wrangler.toml"
            },
            env: {
              type: "string",
              description: "Environment (production/staging, default: production)"
            }
          },
          required: ["worker_name"]
        }
      },
      {
        name: "restart_service",
        description: "Restart a service with pre/post health checks and automatic rollback. DO NOT use ssh_exec('docker restart') - always use this tool instead.",
        inputSchema: {
          type: "object",
          properties: {
            service_name: {
              type: "string",
              description: "Service name (e.g., 'garza-home-mcp', 'nginx', 'postgres')"
            },
            service_type: {
              type: "string",
              description: "Service type (fly_app/docker/systemd)"
            },
            health_check_url: {
              type: "string",
              description: "Optional URL to check service health"
            }
          },
          required: ["service_name", "service_type"]
        }
      },
      {
        name: "check_services_health",
        description: "Check health of one or more services. Safe read-only operation.",
        inputSchema: {
          type: "object",
          properties: {
            service_group: {
              type: "string",
              description: "Service group: 'all', 'mcp_servers', 'workers', 'infrastructure'"
            },
            service_names: {
              type: "array",
              items: { type: "string" },
              description: "Optional specific service names to check"
            }
          }
        }
      },
      {
        name: "trigger_auto_recovery",
        description: "Trigger automatic recovery for a failed service using predefined playbooks.",
        inputSchema: {
          type: "object",
          properties: {
            service_name: {
              type: "string",
              description: "Service that failed"
            },
            failure_type: {
              type: "string",
              description: "Type of failure: 'crash', 'health_check_failed', 'deployment_failed'"
            }
          },
          required: ["service_name", "failure_type"]
        }
      },
      {
        name: "get_infrastructure_status",
        description: "Get comprehensive overview of entire infrastructure. Safe read-only operation.",
        inputSchema: {
          type: "object",
          properties: {
            include_history: {
              type: "boolean",
              description: "Include recent operation history (default: true)"
            },
            include_locks: {
              type: "boolean",
              description: "Include active locks (default: true)"
            }
          }
        }
      }
    ];
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the tool performs a restart operation (implying mutation), includes 'pre/post health checks' (safety mechanisms), and has 'automatic rollback' (error handling). However, it doesn't specify permission requirements, rate limits, or what constitutes successful health checks.

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 extremely concise with just two sentences that each serve clear purposes: the first states the core functionality with key behavioral details, and the second provides critical usage guidance. There's no wasted language or 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 mutation tool with no annotations and no output schema, the description does well by explaining the restart operation, safety features (health checks, rollback), and usage rules. However, it doesn't specify what the tool returns or error conditions, leaving some gaps in completeness for an agent invoking this tool.

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 description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 for adequate but not enhanced parameter documentation.

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 distinguishes it from a prohibited alternative ('DO NOT use ssh_exec('docker restart')'), making the purpose explicit and differentiated from potential siblings. It goes beyond just naming the action by specifying the method includes 'pre/post health checks and automatic rollback'.

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 ('always use this tool instead') and when not to use alternatives ('DO NOT use ssh_exec('docker restart')'), with a clear directive that establishes this as the preferred method for service restarts in this 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/itsablabla/lastrock-mcp'

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