register_domain
Register a new domain name with Dynadot for 1-10 years, optionally applying coupon codes and specifying registrant contacts.
Instructions
Register a new domain name. Duration is in years (1-10). Optionally specify a registrant contact ID and coupon code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to register (e.g., 'example.com') | |
| duration | Yes | Registration duration in years | |
| registrant_contact | No | Contact ID to use as registrant | |
| currency | No | Currency for payment (e.g., 'USD') | |
| coupon | No | Coupon code for discount |
Implementation Reference
- src/tools/domain.ts:73-117 (handler)The 'register_domain' tool is defined and implemented here using `server.tool`. It uses the Zod schema for input validation and calls the `client.register` method to perform the domain registration.
server.tool( "register_domain", "Register a new domain name. Duration is in years (1-10). " + "Optionally specify a registrant contact ID and coupon code.", { domain: z.string().describe("Domain name to register (e.g., 'example.com')"), duration: z .number() .int() .min(1) .max(10) .describe("Registration duration in years"), registrant_contact: z .string() .optional() .describe("Contact ID to use as registrant"), currency: z .string() .optional() .describe("Currency for payment (e.g., 'USD')"), coupon: z.string().optional().describe("Coupon code for discount"), }, async ({ domain, duration, registrant_contact, currency, coupon }) => { try { const result = await client.register(domain, duration, { registrantContact: registrant_contact, currency, coupon, }); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2) }, ], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [ { type: "text" as const, text: `Domain registration failed: ${msg}` }, ], isError: true, }; } } );