Skip to main content
Glama
hostinger

hostinger-api-mcp

Official

VPS_getDataCenterListV1

Retrieve a list of available data centers to select location options when deploying VPS instances.

Instructions

Retrieve all available data centers.

Use this endpoint to view location options before deploying VPS instances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool definition/registration for VPS_getDataCenterListV1 in the VPS tool list. It defines the tool's name, description, HTTP method (GET), API path (/api/vps/v1/data-centers), empty input schema (no parameters required), and security scheme (apiToken).
    {
      "name": "VPS_getDataCenterListV1",
      "description": "Retrieve all available data centers.\n\nUse this endpoint to view location options before deploying VPS instances.",
      "method": "GET",
      "path": "/api/vps/v1/data-centers",
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": []
      },
      "security": [
        {
          "apiToken": []
        }
      ],
      "group": "vps"
    },
  • Generic API call handler (executeApiCall) in the MCPServer class. When VPS_getDataCenterListV1 is called, it uses this handler to make a GET request to /api/vps/v1/data-centers since the tool does not have the custom flag set.
    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;
      }
    }
  • Input schema for VPS_getDataCenterListV1. It specifies an empty object with no properties, meaning the tool requires no input parameters.
    "inputSchema": {
      "type": "object",
      "properties": {},
      "required": []
    },
  • JavaScript (compiled) version of the VPS_getDataCenterListV1 tool registration. Same definition as the TypeScript source but in JS format.
    export default [
      {
        "name": "VPS_getDataCenterListV1",
        "description": "Retrieve all available data centers.\n\nUse this endpoint to view location options before deploying VPS instances.",
        "method": "GET",
        "path": "/api/vps/v1/data-centers",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "required": []
        },
        "security": [
          {
            "apiToken": []
          }
        ],
        "group": "vps"
      },
Behavior3/5

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

No annotations provided, but description implies a read-only operation. Doesn't elaborate on auth or rate limits, which is acceptable for a simple listing tool.

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?

Two sentences, front-loaded with action and resource, no superfluous information.

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

Completeness4/5

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

Given no parameters and no output schema, description is adequate. Could mention return format but not critical.

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

Parameters4/5

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

Schema has 0 parameters with 100% coverage, so description doesn't need to explain parameters. It adds context by mentioning use in deployment decisions.

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

Purpose5/5

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

Description starts with a specific verb 'Retrieve' and clearly defines the resource 'all available data centers'. It distinguishes from other VPS tools like creation or management.

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

Usage Guidelines4/5

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

Explicitly states when to use: 'before deploying VPS instances'. No explicit alternatives mentioned, but no conflicting sibling tool exists for listing VPS datacenters.

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