Skip to main content
Glama
cfenzo
by cfenzo

check_domain

Check domain availability for registration using DNS and WHOIS lookups to verify if a specific domain name is free to register.

Instructions

Check if a single domain name is available for registration. Uses both DNS and WHOIS lookups for reliability.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesThe full domain to check (e.g., 'example.com')

Implementation Reference

  • Main implementation of checkDomain function that checks domain availability using both DNS and WHOIS lookups in parallel, returns confidence levels and detailed results.
    export async function checkDomain(domain: string): Promise<DomainCheckResult> {
      const { name, tld } = parseDomain(domain);
      const fullDomain = `${name}.${tld}`;
    
      // Run both checks in parallel
      const [dnsResult, whoisResult] = await Promise.all([
        checkDns(fullDomain),
        checkWhois(fullDomain),
      ]);
    
      // Determine availability based on combined results
      let available: boolean;
      let confidence: "high" | "medium" | "low";
      let method: "dns" | "whois" | "both";
      let details: string | undefined;
    
      if (dnsResult.error && whoisResult.error) {
        // Both methods failed
        return {
          domain: fullDomain,
          tld,
          available: false,
          method: "both",
          confidence: "low",
          details: "Both DNS and WHOIS checks failed",
          error: `DNS: ${dnsResult.error}, WHOIS: ${whoisResult.error}`,
        };
      }
    
      if (!dnsResult.error && !whoisResult.error) {
        // Both methods succeeded
        method = "both";
        if (!dnsResult.exists && whoisResult.available) {
          available = true;
          confidence = "high";
          details = "No DNS records and WHOIS shows available";
        } else if (dnsResult.exists && !whoisResult.available) {
          available = false;
          confidence = "high";
          details = "DNS records exist and WHOIS shows registered";
        } else if (dnsResult.exists) {
          available = false;
          confidence = "high";
          details = "DNS records exist (domain is active)";
        } else if (!whoisResult.available) {
          available = false;
          confidence = "medium";
          details = "No DNS but WHOIS shows registered (domain may be parked)";
        } else {
          available = true;
          confidence = "medium";
          details = whoisResult.details;
        }
      } else if (dnsResult.error) {
        // Only WHOIS worked
        method = "whois";
        available = whoisResult.available;
        confidence = "medium";
        details = whoisResult.details;
      } else {
        // Only DNS worked
        method = "dns";
        available = !dnsResult.exists;
        confidence = dnsResult.exists ? "high" : "medium";
        details = dnsResult.exists
          ? "DNS records exist"
          : "No DNS records found (may still be registered but inactive)";
      }
    
      return {
        domain: fullDomain,
        tld,
        available,
        method,
        confidence,
        details,
      };
    }
  • src/index.ts:23-37 (registration)
    Tool registration for 'check_domain' with name, description, and inputSchema defining the domain parameter.
    {
      name: "check_domain",
      description:
        "Check if a single domain name is available for registration. Uses both DNS and WHOIS lookups for reliability.",
      inputSchema: {
        type: "object" as const,
        properties: {
          domain: {
            type: "string",
            description: "The full domain to check (e.g., 'example.com')",
          },
        },
        required: ["domain"],
      },
    },
  • MCP tool handler that extracts the domain parameter, validates it, calls checkDomain, and returns formatted JSON response.
    case "check_domain": {
      const domain = args?.domain as string;
      if (!domain) {
        throw new Error("Domain is required");
      }
      const result = await checkDomain(domain);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Type definition for DomainCheckResult interface defining the structure of domain check responses including availability status, method, confidence, and details.
    export interface DomainCheckResult {
      domain: string;
      tld: string;
      available: boolean;
      method: "dns" | "whois" | "both";
      confidence: "high" | "medium" | "low";
      details?: string;
      error?: string;
    }
  • TypeScript type definitions for the 'whois' npm module used by the check_domain implementation for WHOIS lookups.
    declare module "whois" {
      interface WhoisOptions {
        server?: string;
        follow?: number;
        timeout?: number;
        verbose?: boolean;
        bind?: string;
        proxy?: {
          ipaddress: string;
          port: number;
          type?: number;
        };
      }
    
      type WhoisCallback = (err: Error | null, data: string) => void;
    
      function lookup(
        domain: string,
        callback: WhoisCallback
      ): void;
      function lookup(
        domain: string,
        options: WhoisOptions,
        callback: WhoisCallback
      ): void;
    
      export { lookup, WhoisOptions, WhoisCallback };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the methodology ('Uses both DNS and WHOIS lookups for reliability'), which adds useful context beyond basic functionality. However, it lacks details on behavioral traits like rate limits, error handling, or response format, which are important for a tool with no output schema.

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 two sentences with zero waste: the first states the purpose and scope, the second adds methodological context. It's front-loaded with the core functionality and appropriately sized for a simple tool with one parameter.

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 the tool's low complexity (1 parameter, no annotations, no output schema), the description is minimally complete. It covers purpose and methodology but lacks output details (e.g., what 'available' means or response structure) and behavioral context like reliability guarantees. This is adequate but leaves gaps for an agent to interpret results.

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?

The schema description coverage is 100%, with the single parameter 'domain' fully documented in the schema. The description doesn't add any parameter-specific details beyond what the schema provides (e.g., format examples or validation rules). Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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?

The description clearly states the specific action ('Check if... is available for registration'), the resource ('a single domain name'), and the methodology ('Uses both DNS and WHOIS lookups'). It distinguishes from siblings like 'check_alternative_tlds' (which checks multiple TLDs) and 'suggest_domains' (which generates suggestions) by focusing on availability verification for one domain.

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?

The description implies usage context ('Check if... is available for registration'), suggesting it's for domain availability verification before registration. However, it doesn't explicitly state when NOT to use it (e.g., for bulk checks or TLD suggestions) or name alternatives like 'check_alternative_tlds' for related tasks, leaving some ambiguity.

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/cfenzo/domain-mcp'

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