dns_delete_zone
Deletes a DNS zone and all associated records. Requires explicit confirmation to prevent accidental removal.
Instructions
Delete a DNS zone and all its records. Requires confirm=true to execute.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zone | Yes | Zone domain name to delete | |
| confirm | No | Must be true to confirm deletion. Without this, returns a warning instead of deleting. |
Implementation Reference
- src/tools/zones.ts:79-97 (handler)The handler function for dns_delete_zone that validates the domain, checks for confirmation (safety gate), and calls the API to delete the zone.
handler: async (args) => { const zone = validateDomain(args.zone as string); if (args.confirm !== true) { return JSON.stringify( { warning: `This will permanently delete zone '${zone}' and ALL its records. Set confirm=true to proceed.`, }, null, 2 ); } const data = await client.callOrThrow("/api/zones/delete", { zone }); return JSON.stringify( { success: true, deleted: zone, ...data }, null, 2 ); }, }, - src/tools/zones.ts:58-76 (schema)The schema definition for dns_delete_zone including its name, description, and input parameters (zone required, confirm optional boolean).
definition: { name: "dns_delete_zone", description: "Delete a DNS zone and all its records. Requires confirm=true to execute.", inputSchema: { type: "object", properties: { zone: { type: "string", description: "Zone domain name to delete", }, confirm: { type: "boolean", description: "Must be true to confirm deletion. Without this, returns a warning instead of deleting.", }, }, required: ["zone"], }, - src/tools/index.ts:14-27 (registration)Registration of zoneTools (which includes dns_delete_zone) via the zoneTools(client) call aggregated into all tools.
export function getAllTools(client: TechnitiumClient): ToolEntry[] { return [ ...dashboardTools(client), ...dnsClientTools(client), ...zoneTools(client), ...recordTools(client), ...blockingTools(client), ...cacheTools(client), ...settingsTools(client), ...logTools(client), ...appTools(client), ...dnssecTools(client), ]; } - src/validate.ts:5-17 (helper)The validateDomain helper function used by dns_delete_zone handler to validate and sanitize the zone domain name.
export function validateDomain(domain: string): string { if (!domain || typeof domain !== "string") { throw new Error("Domain name is required"); } const trimmed = domain.trim().toLowerCase(); if (trimmed.length > 253) { throw new Error("Domain name exceeds maximum length of 253 characters"); } if (!DOMAIN_RE.test(trimmed)) { throw new Error("Invalid domain name format"); } return trimmed; } - src/rate-limit.ts:25-31 (registration)Rate limit registration for dns_delete_zone in the destructive operations category (5 requests per 60 seconds).
for (const tool of [ "dns_delete_zone", "dns_delete_record", "dns_flush_cache", "dns_flush_allowed", "dns_flush_blocked", "dns_uninstall_app", "dns_update_blocklists", "dns_temp_disable_blocking", ]) { this.toolLimits.set(tool, destructiveLimits); }