Skip to main content
Glama

restart_service

Restart infrastructure services with automated health checks and rollback capabilities to maintain system reliability during deployments.

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

  • Handler logic for the 'restart_service' tool: parses input arguments, constructs parameters, and delegates to executeOrchestrator('maintain/restart-service', params).
    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; }
  • src/index.ts:91-112 (registration)
    Registration of the 'restart_service' tool in the tools array, including name, description, and input schema. Returned by ListToolsRequestSchema handler.
    { 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"] } },
  • Input schema definition for the 'restart_service' tool, specifying required parameters service_name and service_type, and optional health_check_url.
    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"]
  • Helper function executeOrchestrator that constructs and executes a shell command to run the external Python orchestrator script for operations like 'maintain/restart-service'.
    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() || "" }; } }

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