add_nameserver
Create a nameserver entry by specifying a hostname and IP address to manage DNS records for your domains.
Instructions
Add (create) a new nameserver entry with a hostname and IP address.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Nameserver hostname (e.g., 'ns1.example.com') | |
| ip | Yes | IP address for the nameserver |
Implementation Reference
- src/tools/dns.ts:276-294 (handler)Handler function for the 'add_nameserver' tool. Calls client.addNameserver(host, ip) and returns the JSON-stringified result, or an error message on failure.
async ({ host, ip }) => { try { const result = await client.addNameserver(host, ip); 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 add nameserver: ${msg}` }, ], isError: true, }; } } ); - src/tools/dns.ts:272-275 (schema)Input schema for the 'add_nameserver' tool using Zod: host (string) and ip (string).
{ host: z.string().describe("Nameserver hostname (e.g., 'ns1.example.com')"), ip: z.string().describe("IP address for the nameserver"), }, - src/tools/dns.ts:269-294 (registration)Registration of the 'add_nameserver' tool via server.tool() with description 'Add (create) a new nameserver entry with a hostname and IP address.'
server.tool( "add_nameserver", "Add (create) a new nameserver entry with a hostname and IP address.", { host: z.string().describe("Nameserver hostname (e.g., 'ns1.example.com')"), ip: z.string().describe("IP address for the nameserver"), }, async ({ host, ip }) => { try { const result = await client.addNameserver(host, ip); 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 add nameserver: ${msg}` }, ], isError: true, }; } } ); - Helper method addNameserver() in DynadotClient that calls the Dynadot API with command 'add_ns' and params { host, ip }.
async addNameserver(host: string, ip: string): Promise<DynadotResponse> { return this.call("add_ns", { host, ip }); }