trigger_auto_recovery
Automatically recover failed services by executing predefined playbooks based on specific failure types like crashes or health check failures.
Instructions
Trigger automatic recovery for a failed service using predefined playbooks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service_name | Yes | Service that failed | |
| failure_type | Yes | Type of failure: 'crash', 'health_check_failed', 'deployment_failed' |
Implementation Reference
- src/index.ts:264-275 (handler)Handler implementation for the 'trigger_auto_recovery' tool. Extracts input arguments and invokes the executeOrchestrator helper with the 'recovery/auto-recovery' operation.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; }
- src/index.ts:131-148 (schema)Input schema definition for the 'trigger_auto_recovery' tool, specifying required parameters service_name and failure_type.{ 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"] } },
- src/index.ts:16-43 (helper)Shared helper function executeOrchestrator that all tools use to run external python orchestrator.py scripts, handling execution, JSON parsing, and error management.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:182-184 (registration)Registration of the ListToolsRequestSchema handler, which returns the tools array containing 'trigger_auto_recovery'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });