get_domain
Retrieve domain details including availability, registration status, and configuration from providers like Porkbun, Namecheap, GoDaddy, or Cloudflare.
Instructions
Get details for a specific domain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name | |
| provider | No | Provider name, or omit to auto-detect |
Implementation Reference
- src/tools/domains.ts:28-31 (handler)The handleGetDomain function is the main handler for the get_domain tool. It resolves the provider (either specified by name or auto-detected) and calls provider.getDomain() to retrieve domain details.
export async function handleGetDomain(input: { domain: string; provider?: string }, registry: ProviderRegistry) { const provider = input.provider ? registry.get(input.provider) : await registry.resolveProviderForDomain(input.domain); return provider.getDomain(input.domain); } - src/server.ts:66-77 (registration)The get_domain tool is registered with the MCP server here. It defines the tool name, description, input schema (domain as required, provider as optional), and wires up the handler via dynamic import.
server.tool('get_domain', 'Get details for a specific domain', { domain: domainSchema.describe('Domain name'), provider: z.string().optional().describe('Provider name, or omit to auto-detect'), }, async (input) => { try { const { handleGetDomain } = await import('./tools/domains.js'); const result = await handleGetDomain(input as { domain: string; provider?: string }, registry); return { content: [{ type: 'text', text: JSON.stringify(result) }] }; } catch (err) { return { content: [{ type: 'text', text: formatErrorForAgent(err) }], isError: true }; } }); - src/server.ts:9-15 (schema)The domainSchema validates domain names using a regex pattern that enforces RFC 1123 compliant FQDNs (e.g., example.com). This schema is used for the domain parameter in get_domain and other domain tools.
/** Validates a fully-qualified domain name (labels separated by dots, RFC 1123 compliant) */ const domainSchema = z .string() .regex( /^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/, 'Must be a valid domain name (e.g. example.com)', ); - src/providers/types.ts:11-19 (schema)The Domain interface defines the return type for get_domain, containing name, provider, status, expiresAt, autoRenew, locked, and nameservers fields.
export interface Domain { name: string; provider: string; status: 'active' | 'expired' | 'pending' | 'locked'; expiresAt: string; // ISO 8601 autoRenew: boolean; locked: boolean; nameservers: string[]; } - src/providers/types.ts:81-88 (helper)The Provider interface defines the getDomain method signature that all provider implementations must follow: getDomain(domain: string): Promise<Domain>
export interface Provider { name(): string; // Domain operations checkAvailability(domain: string): Promise<AvailabilityResult>; listDomains(): Promise<Domain[]>; getDomain(domain: string): Promise<Domain>; registerDomain(req: RegisterRequest): Promise<Domain>;