dynadot_account
Manage Dynadot account settings, check balance, and configure default options for domains like WHOIS contacts, nameservers, DNS, and forwarding.
Instructions
Account info, balance, and default settings for new domains. Manage API keys: https://www.dynadot.com/account/domain/setting/api.html?s9F6L9F7U8Q9U8Z8v
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: info: Get account information | balance: Get account balance | set_default_whois: Set default WHOIS contact | set_default_ns: Set default nameservers | set_default_parking: Set default parking | set_default_forwarding: Set default forwarding | set_default_stealth: Set default stealth forwarding | set_default_hosting: Set default hosting | set_default_dns: Set default DNS | set_default_dns2: Set default DNS2 | set_default_email_forward: Set default email forwarding | set_default_renew_option: Set default renewal option | clear_defaults: Clear all default settings | |
| currency | No | Currency code (default: USD) | USD |
| contactId | No | Contact ID | |
| nameservers | No | List of nameservers | |
| forwardUrl | No | URL | |
| stealthUrl | No | URL | |
| options | No | ||
| mainRecords | No | ||
| subdomainRecords | No | ||
| No | Email address | ||
| renewOption | No |
Implementation Reference
- src/register.ts:42-62 (handler)Generic handler for the dynadot_account tool (and other composite tools). Extracts action from input, looks up action definition from schema, transforms parameters if needed, executes the corresponding Dynadot API command via client, and returns the JSON-formatted result.async (input) => { const action = input.action as string; const actionDef = tool.actions[action]; if (!actionDef) { throw new Error(`Unknown action: ${action}. Valid actions: ${actionKeys.join(', ')}`); } const client = getClient(); const params = actionDef.transform ? actionDef.transform(action, input as Record<string, unknown>) : (input as ApiParams); // Remove 'action' from params sent to API delete params.action; const result = await client.execute(actionDef.command, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/schema.ts:876-962 (schema)Schema definition for the 'dynadot_account' tool, specifying description, available actions (e.g., info, balance, set_default_*), their commands, parameters, and input transformation functions.name: 'dynadot_account', description: `Account info, balance, and default settings for new domains. Manage API keys: ${DYNADOT_URLS.apiKey}`, actions: { info: { command: 'account_info', description: 'Get account information', }, balance: { command: 'get_account_balance', description: 'Get account balance', params: z.object({ currency: p.currency.optional() }), }, set_default_whois: { command: 'set_default_whois', description: 'Set default WHOIS contact', params: z.object({ contactId: p.contactId }), transform: (_, input) => ({ contact_id: input.contactId as string }), }, set_default_ns: { command: 'set_default_ns', description: 'Set default nameservers', params: z.object({ nameservers: p.nameservers }), transform: (_, input) => tx.defaultNs(input), }, set_default_parking: { command: 'set_default_parking', description: 'Set default parking', }, set_default_forwarding: { command: 'set_default_forwarding', description: 'Set default forwarding', params: z.object({ forwardUrl: p.url }), transform: (_, input) => ({ forward_url: input.forwardUrl as string }), }, set_default_stealth: { command: 'set_default_stealth', description: 'Set default stealth forwarding', params: z.object({ stealthUrl: p.url }), transform: (_, input) => ({ stealth_url: input.stealthUrl as string }), }, set_default_hosting: { command: 'set_default_hosting', description: 'Set default hosting', params: z.object({ options: z.record(z.string(), z.string()) }), transform: (_, input) => { const params: ApiParams = {}; for (const [k, v] of Object.entries(input.options as Record<string, string>)) { params[k] = v; } return params; }, }, set_default_dns: { command: 'set_default_dns', description: 'Set default DNS', params: z.object({ mainRecords: z.array(dnsRecord).optional(), subdomainRecords: z.array(subdomainRecord).optional(), }), transform: (_, input) => tx.defaultDns(input), }, set_default_dns2: { command: 'set_default_dns2', description: 'Set default DNS2', params: z.object({ mainRecords: z.array(dnsRecord).optional(), subdomainRecords: z.array(subdomainRecord).optional(), }), transform: (_, input) => tx.defaultDns(input), }, set_default_email_forward: { command: 'set_default_email_forward', description: 'Set default email forwarding', params: z.object({ email: p.email }), }, set_default_renew_option: { command: 'set_default_renew_option', description: 'Set default renewal option', params: z.object({ renewOption: z.enum(['auto', 'donot']) }), transform: (_, input) => ({ renew_option: input.renewOption as string }), }, clear_defaults: { command: 'set_clear_default_setting', description: 'Clear all default settings', }, }, },
- src/register.ts:6-65 (registration)Registers the 'dynadot_account' tool (via loop over compositeTools) with the MCP server, dynamically generating input schema from actions and attaching the generic handler.export function registerAllTools(server: McpServer): void { for (const tool of compositeTools) { // Build action enum from keys const actionKeys = Object.keys(tool.actions) as [string, ...string[]]; // Build combined input schema with action + all possible params const actionDescriptions = actionKeys .map((k) => { const actionDef = tool.actions[k]; return actionDef ? `${k}: ${actionDef.description}` : k; }) .join(' | '); const inputSchema: Record<string, z.ZodTypeAny> = { action: z.enum(actionKeys).describe(`Action to perform: ${actionDescriptions}`), }; // Collect all unique params across actions for (const action of Object.values(tool.actions)) { if (action?.params) { const shape = action.params.shape; for (const [key, schema] of Object.entries(shape)) { if (!inputSchema[key]) { // Make optional since not all actions need all params inputSchema[key] = (schema as z.ZodTypeAny).optional(); } } } } server.registerTool( tool.name, { description: tool.description, inputSchema, }, async (input) => { const action = input.action as string; const actionDef = tool.actions[action]; if (!actionDef) { throw new Error(`Unknown action: ${action}. Valid actions: ${actionKeys.join(', ')}`); } const client = getClient(); const params = actionDef.transform ? actionDef.transform(action, input as Record<string, unknown>) : (input as ApiParams); // Remove 'action' from params sent to API delete params.action; const result = await client.execute(actionDef.command, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); } }
- src/client.ts:116-134 (helper)Core helper function execute() in DynadotClient, called by handlers to perform the actual API request to Dynadot, formats parameters, handles retries and errors.async execute(command: string, params: ApiParams = {}): Promise<ApiResponse> { const searchParams = new URLSearchParams(); searchParams.set('key', this.apiKey); searchParams.set('command', command); for (const [key, value] of Object.entries(params)) { if (value !== undefined) { searchParams.set(key, String(value)); } } const response = await this.client.get('api3.json', { searchParams }).json<ApiResponse>(); if (response.Status === 'error') { throw new Error(`Dynadot API error: ${response.Error || 'Unknown error'}`); } return response; }