dynadot_nameserver
Manage custom nameservers (glue records) for domains: register new nameservers, update IP addresses, delete existing ones, or list all configured nameservers.
Instructions
Manage registered nameservers (glue records): register, update IP, delete, list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: list: List all registered nameservers | register: Register a custom nameserver | add: Add a nameserver | set_ip: Update nameserver IP | delete: Delete a nameserver | delete_by_domain: Delete all nameservers for a domain | |
| host | No | Nameserver hostname | |
| ip | No | IP address | |
| domain | No | Domain name (e.g., example.com) |
Implementation Reference
- src/schema.ts:539-573 (schema)Schema definition for the 'dynadot_nameserver' composite tool, specifying actions that map to Dynadot API commands for nameserver management (server_list, register_ns, add_ns, set_ns_ip, delete_ns, delete_ns_by_domain). Includes input schemas and transform functions.{ name: 'dynadot_nameserver', description: 'Manage registered nameservers (glue records): register, update IP, delete, list', actions: { list: { command: 'server_list', description: 'List all registered nameservers', }, register: { command: 'register_ns', description: 'Register a custom nameserver', params: z.object({ host: p.host, ip: p.ip }), }, add: { command: 'add_ns', description: 'Add a nameserver', params: z.object({ host: p.host }), }, set_ip: { command: 'set_ns_ip', description: 'Update nameserver IP', params: z.object({ host: p.host, ip: p.ip }), }, delete: { command: 'delete_ns', description: 'Delete a nameserver', params: z.object({ host: p.host }), }, delete_by_domain: { command: 'delete_ns_by_domain', description: 'Delete all nameservers for a domain', params: z.object({ domain: p.domain }), }, }, },
- src/register.ts:6-65 (handler)The registerAllTools function registers the 'dynadot_nameserver' tool (and others) with MCP server. It dynamically builds input schema from composite tool actions and provides a generic handler that: 1) validates action, 2) applies action-specific param transform, 3) calls Dynadot API via client.execute() with the mapped command, 4) returns JSON response.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 API execution helper in DynadotClient.execute(), used by the tool handler to send HTTP requests to Dynadot API endpoints with authentication, params, retries, and error handling.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; }
- src/index.ts:68-69 (registration)In the MCP server setup, registerAllTools(server) is called to register all tools including 'dynadot_nameserver'.registerAllTools(server);