Skip to main content
Glama
hostinger

hostinger-api-mcp

Official

VPS_setNameserversV1

Configure custom DNS resolvers for a VPS instance to manage domain name resolution. Specify up to three nameservers to control how the virtual machine resolves domain names.

Instructions

Set nameservers for a specified virtual machine.

Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.

Use this endpoint to configure custom DNS resolvers for VPS instances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
virtualMachineIdYesVirtual Machine ID
ns1Yesns1 parameter
ns2Nons2 parameter
ns3Nons3 parameter

Implementation Reference

  • The VPS_setNameserversV1 tool schema definition: defines the tool name, description, HTTP method (PUT), path (/api/vps/v1/virtual-machines/{virtualMachineId}/nameservers), input schema with required parameters (virtualMachineId, ns1) and optional parameters (ns2, ns3), and security configuration.
    {
      "name": "VPS_setNameserversV1",
      "description": "Set nameservers for a specified virtual machine.\n\nBe aware, that improper nameserver configuration can lead to the virtual\nmachine being unable to resolve domain names.\n\nUse this endpoint to configure custom DNS resolvers for VPS instances.",
      "method": "PUT",
      "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/nameservers",
      "inputSchema": {
        "type": "object",
        "properties": {
          "virtualMachineId": {
            "type": "integer",
            "description": "Virtual Machine ID"
          },
          "ns1": {
            "type": "string",
            "description": "ns1 parameter"
          },
          "ns2": {
            "type": "string",
            "description": "ns2 parameter"
          },
          "ns3": {
            "type": "string",
            "description": "ns3 parameter"
          }
        },
        "required": [
          "virtualMachineId",
          "ns1"
        ]
      },
      "security": [
        {
          "apiToken": []
        }
      ],
      "group": "vps"
    },
  • JavaScript version of the VPS_setNameserversV1 tool schema definition.
    {
      "name": "VPS_setNameserversV1",
      "description": "Set nameservers for a specified virtual machine.\n\nBe aware, that improper nameserver configuration can lead to the virtual\nmachine being unable to resolve domain names.\n\nUse this endpoint to configure custom DNS resolvers for VPS instances.",
      "method": "PUT",
      "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/nameservers",
      "inputSchema": {
        "type": "object",
        "properties": {
          "virtualMachineId": {
            "type": "integer",
            "description": "Virtual Machine ID"
          },
          "ns1": {
            "type": "string",
            "description": "ns1 parameter"
          },
          "ns2": {
            "type": "string",
            "description": "ns2 parameter"
          },
          "ns3": {
            "type": "string",
            "description": "ns3 parameter"
          }
        },
        "required": [
          "virtualMachineId",
          "ns1"
        ]
      },
      "security": [
        {
          "apiToken": []
        }
      ],
      "group": "vps"
    },
  • src/servers/vps.js:1-7 (registration)
    Server entry point that imports the tools list (including VPS_setNameserversV1) from src/core/tools/vps.js and starts the VPS MCP server.
    #!/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/servers/vps.ts:1-7 (registration)
    TypeScript server entry point that imports the tools list (including VPS_setNameserversV1) and starts the VPS MCP server.
    #!/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 });
  • The executeApiCall method in MCPServer handles all API-based tools including VPS_setNameserversV1. It performs path parameter substitution, sets up the HTTP request (PUT with path /api/vps/v1/virtual-machines/{virtualMachineId}/nameservers), and sends the request to the Hostinger API.
    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;
      }
    }
Behavior3/5

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

No annotations are provided, so description carries full burden. It warns of potential inability to resolve domain names if misconfigured, which is a behavioral consequence. But it lacks details on whether the change is immediate, reversible, or if it requires a reboot.

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

Conciseness4/5

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

Three sentences: clear purpose, a warning, and a restatement of use. No fluff, but the warning could be integrated more efficiently. Front-loads the action well.

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?

Given no annotations and no output schema, the description provides a warning but lacks information on reversibility, error handling, or whether existing nameservers are overwritten. It is minimally complete for a simple configuration tool but could be more thorough.

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

Parameters2/5

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

Input schema has 100% coverage but parameter descriptions are minimal and tautological (e.g., 'ns1 parameter'). The description does not add meaning beyond the schema; it does not specify expected format (e.g., IP addresses or hostnames) for ns1, ns2, ns3. Baseline 3 is reduced due to poor schema descriptions and no additional clarification.

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?

Description clearly states 'Set nameservers for a specified virtual machine', which is a specific verb and resource. It distinguishes from sibling VPS tools like setHostname or setRootPassword, but does not differentiate from domains_updateDomainNameserversV1 which also sets nameservers (though for domains).

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

Usage Guidelines3/5

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

Includes a warning about improper configuration causing resolution failure, implying cautious use. However, it does not explicitly state when to use this tool versus alternatives like domains_updateDomainNameserversV1, nor does it describe prerequisites or conditions.

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