VPS_getActionsV1
Retrieve VPS action history to troubleshoot issues. View details like action name, timestamp, and status for past start, stop, or modification operations.
Instructions
Retrieve actions performed on a specified virtual machine.
Actions are operations or events that have been executed on the virtual machine, such as starting, stopping, or modifying the machine. This endpoint allows you to view the history of these actions, providing details about each action, such as the action name, timestamp, and status.
Use this endpoint to view VPS operation history and troubleshoot issues.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| virtualMachineId | Yes | Virtual Machine ID | |
| page | No | Page number |
Implementation Reference
- src/core/tools/vps.js:967-1003 (schema)Tool definition/schema for VPS_getActionsV1 – defines the OpenAPI-based metadata, input schema, HTTP method, and path for listing actions on a virtual machine.
"name": "VPS_getActionsV1", "description": "Retrieve actions performed on a specified virtual machine.\n\nActions are operations or events that have been executed on the virtual\nmachine, such as starting, stopping, or modifying the machine. This endpoint\nallows you to view the history of these actions, providing details about\neach action, such as the action name, timestamp, and status.\n\nUse this endpoint to view VPS operation history and troubleshoot issues.", "method": "GET", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/actions", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", "description": "Virtual Machine ID" }, "page": { "type": "integer", "description": "Page number" } }, "required": [ "virtualMachineId" ] }, "security": [ { "apiToken": [] } ], "group": "vps" }, { "name": "VPS_getAttachedPublicKeysV1", "description": "Retrieve public keys attached to a specified virtual machine.\n\nUse this endpoint to view SSH keys configured for specific VPS instances.", "method": "GET", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/public-keys", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", - src/core/tools/vps.ts:977-1003 (schema)TypeScript version of the tool definition/schema for VPS_getActionsV1.
"name": "VPS_getActionsV1", "description": "Retrieve actions performed on a specified virtual machine.\n\nActions are operations or events that have been executed on the virtual\nmachine, such as starting, stopping, or modifying the machine. This endpoint\nallows you to view the history of these actions, providing details about\neach action, such as the action name, timestamp, and status.\n\nUse this endpoint to view VPS operation history and troubleshoot issues.", "method": "GET", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/actions", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", "description": "Virtual Machine ID" }, "page": { "type": "integer", "description": "Page number" } }, "required": [ "virtualMachineId" ] }, "security": [ { "apiToken": [] } ], "group": "vps" }, - src/servers/vps.js:4-6 (registration)Registration: VPS tools (including VPS_getActionsV1) are imported from src/core/tools/vps.js and passed to startServer for the hostinger-vps-mcp server.
import tools from '../core/tools/vps.js'; startServer({ name: 'hostinger-vps-mcp', version: '0.1.41', tools }); - src/core/runtime.js:1879-1966 (handler)Handler logic: executeApiCall in the MCPServer class handles all non-custom (OpenAPI-based) tool executions including VPS_getActionsV1. It replaces path parameters, builds the URL, and makes the HTTP request.
async executeApiCall(tool, params) { // 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 = { method: method.toLowerCase(), url, headers: { ...this.headers }, timeout: 60000, // 60s validateStatus: function (status) { 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['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; config.headers["Content-Type"] = "application/json"; } this.log('debug', "Request config:", { url: config.url, method: config.method, params: config.params, 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 responseData = error.response?.data; const responseStatus = error.response?.status; this.log('error', 'API Error Details:', { status: responseStatus, data: typeof responseData === 'object' ? JSON.stringify(responseData) : responseData }); // Rethrow with more context for better error handling const detailedError = new Error(`API request failed with status ${responseStatus}: ${errorMessage}`); detailedError.response = error.response; throw detailedError; } throw error; } }