Skip to main content
Glama
hostinger

hostinger-api-mcp

Official

VPS_setRootPasswordV1

Set the root password for a specified VPS virtual machine to update administrator credentials.

Instructions

Set root password for a specified virtual machine.

Requirements for password are same as in the recreate virtual machine endpoint.

Use this endpoint to update administrator credentials for VPS instances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
virtualMachineIdYesVirtual Machine ID
passwordYesRoot password for the virtual machine

Implementation Reference

  • Schema definition for VPS_setRootPasswordV1 tool. Defines the tool name, description, HTTP method (PUT), API path (/api/vps/v1/virtual-machines/{virtualMachineId}/root-password), and input schema requiring virtualMachineId (integer) and password (string).
      "name": "VPS_setRootPasswordV1",
      "description": "Set root password for a specified virtual machine.\n\nRequirements for password are same as in the [recreate virtual machine\nendpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).\n\nUse this endpoint to update administrator credentials for VPS instances.",
      "method": "PUT",
      "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/root-password",
      "inputSchema": {
        "type": "object",
        "properties": {
          "virtualMachineId": {
            "type": "integer",
            "description": "Virtual Machine ID"
          },
          "password": {
            "type": "string",
            "description": "Root password for the virtual machine"
          }
        },
        "required": [
          "virtualMachineId",
          "password"
        ]
      },
      "security": [
        {
          "apiToken": []
        }
      ],
      "group": "vps"
    },
  • src/servers/vps.ts:3-6 (registration)
    Server entry point that registers all VPS tools (including VPS_setRootPasswordV1) by loading the tool definitions from src/core/tools/vps.ts and starting the MCP server.
    import { startServer } from '../core/runtime.js';
    import tools from '../core/tools/vps.js';
    
    startServer({ name: 'hostinger-vps-mcp', version: '0.1.41', tools });
  • Generic API execution handler. VPS_setRootPasswordV1 is not a custom tool, so it's executed via executeApiCall(). This method takes the tool's method (PUT), path (/api/vps/v1/virtual-machines/{virtualMachineId}/root-password), replaces path params, and sends a PUT request with the password in the JSON body.
    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;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description bears full burden. It mentions password requirements via a link but does not disclose behaviors like validation, synchronization, reboot, or required permissions. The agent gets minimal insight into side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concisely crafted with two sentences and a link. It front-loads the core purpose and provides a usage hint without extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 2-parameter tool with no output schema and no annotations, the description is adequate but incomplete. It lacks details on return values, errors, prerequisites, and whether the operation is destructive or reversible.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no additional semantic value beyond the schema's parameter descriptions. The link to requirements is tangential to parameter meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it sets the root password for a VM, specifying the resource and action. It distinguishes from sibling tools like VPS_setPanelPasswordV1 by focusing on 'root password' and 'administrator credentials', but does not explicitly contrast with alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives (e.g., VPS_recreateVirtualMachineV1 which also sets password). It merely says 'use this endpoint' without conditions or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/hostinger/api-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server