Skip to main content
Glama

trigger_auto_recovery

Initiate automatic recovery for failed services using predefined playbooks based on service name and failure type.

Instructions

Trigger automatic recovery for a failed service using predefined playbooks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_nameYesService that failed
failure_typeYesType of failure: 'crash', 'health_check_failed', 'deployment_failed'

Implementation Reference

  • Handler for the trigger_auto_recovery tool. Extracts service_name and failure_type arguments and invokes executeOrchestrator with operation 'recovery/auto-recovery'.
    case "trigger_auto_recovery": {
      const { service_name, failure_type } = args as {
        service_name: string;
        failure_type: string;
      };
      
      result = executeOrchestrator("recovery/auto-recovery", {
        service_name,
        failure_type
      });
      break;
    }
  • Input schema for trigger_auto_recovery tool, defining required string properties service_name and failure_type.
    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"]
    }
  • src/index.ts:131-148 (registration)
    Registration of the trigger_auto_recovery tool in the tools array, including name, description, and input schema.
    {
      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"]
      }
    },
  • Shared helper function executeOrchestrator used by all tools, including trigger_auto_recovery, to run orchestrator.py with given operation and parameters.
    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