VPS_startRecoveryModeV1
Initiate recovery mode for a VPS to perform system rescue operations, such as repairing file systems or recovering data, while mounting the original disk in /mnt.
Instructions
Initiate recovery mode for a specified virtual machine.
Recovery mode is a special state that allows users to perform system rescue operations, such as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine from booting normally.
Virtual machine will boot recovery disk image and original disk image will be mounted in /mnt directory.
Use this endpoint to enable system rescue operations on VPS instances.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| virtualMachineId | Yes | Virtual Machine ID | |
| root_password | Yes | Temporary root password for recovery mode |
Implementation Reference
- src/core/tools/vps.ts:1459-1487 (schema)Input schema definition for VPS_startRecoveryModeV1 tool. Defines the tool metadata: name, description, HTTP method (POST), API path (/api/vps/v1/virtual-machines/{virtualMachineId}/recovery), and input schema requiring virtualMachineId (integer) and root_password (string).
{ "name": "VPS_startRecoveryModeV1", "description": "Initiate recovery mode for a specified virtual machine.\n\nRecovery mode is a special state that allows users to perform system rescue operations, \nsuch as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine \nfrom booting normally. \n\nVirtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.\n\nUse this endpoint to enable system rescue operations on VPS instances.", "method": "POST", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/recovery", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", "description": "Virtual Machine ID" }, "root_password": { "type": "string", "description": "Temporary root password for recovery mode" } }, "required": [ "virtualMachineId", "root_password" ] }, "security": [ { "apiToken": [] } ], "group": "vps" }, - src/core/tools/vps.js:1450-1477 (schema)Input schema definition for VPS_startRecoveryModeV1 in JS version. Same definition as the TS file.
"name": "VPS_startRecoveryModeV1", "description": "Initiate recovery mode for a specified virtual machine.\n\nRecovery mode is a special state that allows users to perform system rescue operations, \nsuch as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine \nfrom booting normally. \n\nVirtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.\n\nUse this endpoint to enable system rescue operations on VPS instances.", "method": "POST", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/recovery", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", "description": "Virtual Machine ID" }, "root_password": { "type": "string", "description": "Temporary root password for recovery mode" } }, "required": [ "virtualMachineId", "root_password" ] }, "security": [ { "apiToken": [] } ], "group": "vps" }, - src/servers/vps.ts:1-6 (registration)Entry point that registers all VPS tools (including VPS_startRecoveryModeV1) by importing them from src/core/tools/vps.js and passing them to startServer().
#!/usr/bin/env node // Auto-generated entry for group: vps import { startServer } from '../core/runtime.js'; import tools from '../core/tools/vps.js'; startServer({ name: 'hostinger-vps-mcp', version: '0.1.41', tools }); - src/core/runtime.ts:1909-1999 (handler)Generic API handler (executeApiCall) that handles all non-custom tools including VPS_startRecoveryModeV1. Since VPS_startRecoveryModeV1 has custom=false, its execution is handled here by making an HTTP POST request to the API path with path parameters and body.
private async executeApiCall(tool: OpenApiTool, params: Record<string, any>): Promise<any> { // Get method and path from tool const method = tool.method; let path = tool.path; // Clone params to avoid modifying the original const requestParams = { ...params }; // Replace path parameters with values from params Object.entries(requestParams).forEach(([key, value]) => { const placeholder = `{${key}}`; if (path.includes(placeholder)) { path = path.replace(placeholder, encodeURIComponent(String(value))); delete requestParams[key]; // Remove used parameter } }); // Build the full URL const baseUrl = this.baseUrl.endsWith("/") ? this.baseUrl : `${this.baseUrl}/`; const cleanPath = path.startsWith("/") ? path.slice(1) : path; const url = new URL(cleanPath, baseUrl).toString(); this.log('debug', `API Request: ${method} ${url}`); try { // Configure the request const config: AxiosRequestConfig = { method: method.toLowerCase(), url, headers: { ...this.headers }, timeout: 60000, // 60s validateStatus: function (status: number): boolean { return status < 500; // Resolve only if the status code is less than 500 } }; const bearerToken = process.env['API_TOKEN'] || process.env['APITOKEN']; // APITOKEN for backwards compatibility if (bearerToken && config.headers) { config.headers['Authorization'] = `Bearer ${bearerToken}`; } else { this.log('error', `Bearer Token environment variable not found: API_TOKEN`); } // Add parameters based on request method if (["GET", "DELETE"].includes(method)) { // For GET/DELETE, send params as query string config.params = { ...(config.params || {}), ...requestParams }; } else { // For POST/PUT/PATCH, send params as JSON body config.data = requestParams; if (config.headers) { config.headers["Content-Type"] = "application/json"; } } this.log('debug', "Request config:", { url: config.url, method: config.method, params: config.params, headers: config.headers ? Object.keys(config.headers) : [] }); // Execute the request const response = await axios(config); this.log('debug', `Response status: ${response.status}`); return response.data; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.log('error', `API request failed: ${errorMessage}`); if (axios.isAxiosError(error)) { const axiosError = error as AxiosError; const responseData = axiosError.response?.data; const responseStatus = axiosError.response?.status; this.log('error', 'API Error Details:', { status: responseStatus, data: typeof responseData === 'object' ? JSON.stringify(responseData) : String(responseData) }); // Rethrow with more context for better error handling const detailedError = new Error(`API request failed with status ${responseStatus}: ${errorMessage}`); (detailedError as any).response = axiosError.response; throw detailedError; } throw error; } }