domains_checkDomainAvailabilityV1
Check domain name availability across multiple TLDs. Verify if a domain is available for purchase and get alternative suggestions.
Instructions
Check availability of domain names across multiple TLDs.
Multiple TLDs can be checked at once.
If you want alternative domains with response, provide only one TLD and set with_alternatives to true.
TLDs should be provided without leading dot (e.g. com, net, org).
Endpoint has rate limit of 10 requests per minute.
Use this endpoint to verify domain availability before purchase.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name (without TLD) | |
| tlds | Yes | TLDs list | |
| with_alternatives | No | Should response include alternatives |
Implementation Reference
- src/core/tools/domains.ts:30-66 (schema)Tool definition and input schema for domains_checkDomainAvailabilityV1, defining the tool's name, description, method (POST), path (/api/domains/v1/availability), and input schema with required parameters: domain (string), tlds (array of strings), and optional with_alternatives (boolean).
{ "name": "domains_checkDomainAvailabilityV1", "description": "Check availability of domain names across multiple TLDs.\n\nMultiple TLDs can be checked at once.\nIf you want alternative domains with response, provide only one TLD and set `with_alternatives` to `true`.\nTLDs should be provided without leading dot (e.g. `com`, `net`, `org`).\n\nEndpoint has rate limit of 10 requests per minute.\n\nUse this endpoint to verify domain availability before purchase.", "method": "POST", "path": "/api/domains/v1/availability", "inputSchema": { "type": "object", "properties": { "domain": { "type": "string", "description": "Domain name (without TLD)" }, "tlds": { "type": "array", "description": "TLDs list", "items": { "type": "string", "description": "TLD without leading dot" } }, "with_alternatives": { "type": "boolean", "description": "Should response include alternatives" } }, "required": [ "domain", "tlds" ] }, "security": [ { "apiToken": [] } ], "group": "domains" }, - src/core/tools/domains.js:20-66 (registration)Same tool registration in the compiled JavaScript version. This file is imported by src/servers/domains.js which passes the tools array to startServer().
{ "name": "domains_checkDomainAvailabilityV1", "description": "Check availability of domain names across multiple TLDs.\n\nMultiple TLDs can be checked at once.\nIf you want alternative domains with response, provide only one TLD and set `with_alternatives` to `true`.\nTLDs should be provided without leading dot (e.g. `com`, `net`, `org`).\n\nEndpoint has rate limit of 10 requests per minute.\n\nUse this endpoint to verify domain availability before purchase.", "method": "POST", "path": "/api/domains/v1/availability", "inputSchema": { "type": "object", "properties": { "domain": { "type": "string", "description": "Domain name (without TLD)" }, "tlds": { "type": "array", "description": "TLDs list", "items": { "type": "string", "description": "TLD without leading dot" } }, "with_alternatives": { "type": "boolean", "description": "Should response include alternatives" } }, "required": [ "domain", "tlds" ] }, "security": [ { "apiToken": [] } ], "group": "domains" }, { "name": "domains_getDomainForwardingV1", "description": "Retrieve domain forwarding data.\n\nUse this endpoint to view current redirect configuration for domains.", "method": "GET", "path": "/api/domains/v1/forwarding/{domain}", "inputSchema": { "type": "object", "properties": { "domain": { "type": "string", - src/servers/domains.js:1-6 (registration)Server entry point for the domains group. Imports the tools list (including domains_checkDomainAvailabilityV1) and starts the MCP server with them.
#!/usr/bin/env node // Auto-generated entry for group: domains import { startServer } from '../core/runtime.js'; import tools from '../core/tools/domains.js'; startServer({ name: 'hostinger-domains-mcp', version: '0.1.41', tools }); - src/core/runtime.ts:1909-1998 (handler)The executeApiCall method in the runtime handles all API-based tools (non-custom). For domains_checkDomainAvailabilityV1 (which is not a custom tool), this method sends a POST request to /api/domains/v1/availability with the domain, tlds, and with_alternatives parameters as JSON body, then returns the API response.
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; } - src/core/runtime.js:1879-1966 (handler)The compiled JS version of executeApiCall which handles the HTTP request for domains_checkDomainAvailabilityV1. It sends a POST to /api/domains/v1/availability with body parameters (domain, tlds, with_alternatives).
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; } }