get_whois_contact
Retrieve WHOIS contact information for domain names to identify registrants and administrative details during domain management workflows.
Instructions
Get domain WHOIS contact
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | ||
| provider | No |
Implementation Reference
- src/tools/contacts.ts:5-9 (handler)Main handler function that executes get_whois_contact tool logic: resolves the provider (either specified or auto-detected), validates provider supports WHOIS contact feature, and returns contact information for the domain
export async function handleGetWhoisContact(input: { domain: string; provider?: string }, registry: ProviderRegistry) { const provider = input.provider ? registry.get(input.provider) : await registry.resolveProviderForDomain(input.domain); assertWhoisContact(provider.name(), (f) => provider.supports(f)); return provider.getWhoisContact(input.domain); } - src/providers/types.ts:61-71 (schema)Contact interface defining the structure of WHOIS contact data returned by the tool (firstName, lastName, email, phone, address1, city, state, postalCode, country)
export interface Contact { firstName: string; lastName: string; email: string; phone: string; address1: string; city: string; state: string; postalCode: string; country: string; // ISO 3166-1 alpha-2 } - src/server.ts:320-331 (registration)Tool registration with MCP server using server.tool(), defining input schema with domain (required) and provider (optional) parameters, and wiring up the handler
server.tool('get_whois_contact', 'Get domain WHOIS contact', { domain: domainSchema, provider: z.string().optional(), }, async (input) => { try { const { handleGetWhoisContact } = await import('./tools/contacts.js'); const result = await handleGetWhoisContact(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:10-15 (schema)Domain schema validation using Zod regex pattern to validate fully-qualified domain names per RFC 1123
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/tools/guards.ts:37-46 (helper)Validation helper that checks if the selected provider supports the WhoisContact feature, throwing AgentError if not supported
export function assertWhoisContact(providerName: string, supports: (f: Feature) => boolean): void { if (!supports(Feature.WhoisContact)) { throw new AgentError( 'FEATURE_NOT_SUPPORTED', `Provider '${providerName}' does not support WHOIS contact management via API.`, 'Use Namecheap or GoDaddy for WHOIS contact management, or update contacts via the provider web interface.', providerName, ); } }