set_nameservers
Configure nameservers for a domain by providing a list of up to 13 hostnames.
Instructions
Set nameservers for a domain. Accepts up to 13 nameserver hostnames.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to configure | |
| nameservers | Yes | List of nameserver hostnames (e.g., ['ns1.example.com', 'ns2.example.com']) |
Implementation Reference
- src/tools/dns.ts:92-123 (handler)MCP tool handler for 'set_nameservers'. Defines the tool with Zod schema for domain (string) and nameservers (array of strings, 1-13). The handler calls client.setNameservers(domain, nameservers) and returns the JSON result or an error message.
// ─── set_nameservers ────────────────────────────────────────── server.tool( "set_nameservers", "Set nameservers for a domain. Accepts up to 13 nameserver hostnames.", { domain: z.string().describe("Domain name to configure"), nameservers: z .array(z.string()) .min(1) .max(13) .describe("List of nameserver hostnames (e.g., ['ns1.example.com', 'ns2.example.com'])"), }, async ({ domain, nameservers }) => { try { const result = await client.setNameservers(domain, nameservers); 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: `Failed to set nameservers: ${msg}` }, ], isError: true, }; } } ); - src/tools/dns.ts:94-104 (schema)Zod input schema for the set_nameservers tool: 'domain' (required string) and 'nameservers' (required array of strings, min 1, max 13).
server.tool( "set_nameservers", "Set nameservers for a domain. Accepts up to 13 nameserver hostnames.", { domain: z.string().describe("Domain name to configure"), nameservers: z .array(z.string()) .min(1) .max(13) .describe("List of nameserver hostnames (e.g., ['ns1.example.com', 'ns2.example.com'])"), }, - src/tools/dns.ts:94-123 (registration)The tool is registered on the McpServer instance via server.tool('set_nameservers', ...) inside the registerDnsTools function in src/tools/dns.ts. The registration is called from src/index.ts line 51.
server.tool( "set_nameservers", "Set nameservers for a domain. Accepts up to 13 nameserver hostnames.", { domain: z.string().describe("Domain name to configure"), nameservers: z .array(z.string()) .min(1) .max(13) .describe("List of nameserver hostnames (e.g., ['ns1.example.com', 'ns2.example.com'])"), }, async ({ domain, nameservers }) => { try { const result = await client.setNameservers(domain, nameservers); 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: `Failed to set nameservers: ${msg}` }, ], isError: true, }; } } ); - Helper method in DynadotClient that executes the API call. setNameservers() maps the nameservers array to ns0, ns1, ... parameters and calls the Dynadot API with 'set_ns' command.
async setNameservers(domain: string, nameservers: string[]): Promise<DynadotResponse> { const params: Record<string, string> = { domain }; nameservers.forEach((ns, i) => { params[`ns${i}`] = ns; }); return this.call("set_ns", params); }