dns_delete_record
Delete a specific DNS record from a zone. Requires confirm=true to execute, preventing accidental removals.
Instructions
Delete a specific DNS record from a zone. Requires confirm=true to execute.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zone | Yes | Zone domain name | |
| domain | Yes | Domain name of the record | |
| type | Yes | Record type | |
| value | Yes | Record value to delete (IP for A/AAAA, etc) | |
| confirm | No | Must be true to confirm deletion. Without this, returns a warning instead of deleting. |
Implementation Reference
- src/tools/records.ts:328-375 (handler)The main handler function for dns_delete_record. Validates inputs (zone, domain, type, value), requires confirm=true to proceed, constructs the API params based on record type, then calls /api/zones/records/delete on the Technitium DNS server.
handler: async (args) => { const zone = validateDomain(args.zone as string); const domain = validateDomain(args.domain as string); const recType = validateRecordType(args.type as string); const value = args.value as string; if (args.confirm !== true) { return JSON.stringify( { warning: `This will delete the ${recType} record for '${domain}' (value: ${value}). Set confirm=true to proceed.`, }, null, 2 ); } const params: Record<string, string> = { zone, domain, type: recType, }; if (recType === "A" || recType === "AAAA") { params.ipAddress = validateIp(value); } else if (recType === "CNAME") { params.cname = value; } else if (recType === "MX") { params.exchange = value; } else if (recType === "TXT") { params.text = value; } else if (recType === "NS") { params.nameServer = value; } const data = await client.callOrThrow( "/api/zones/records/delete", params ); return JSON.stringify( { success: true, deleted: `${recType} ${domain} -> ${value}`, ...data, }, null, 2 ); }, - src/tools/records.ts:288-325 (schema)The input schema definition for dns_delete_record, specifying required parameters: zone, domain, type (enum of A/AAAA/CNAME/MX/NS/PTR/TXT/SRV/CAA), value, and optional confirm boolean.
name: "dns_delete_record", description: "Delete a specific DNS record from a zone. Requires confirm=true to execute.", inputSchema: { type: "object", properties: { zone: { type: "string", description: "Zone domain name" }, domain: { type: "string", description: "Domain name of the record", }, type: { type: "string", enum: [ "A", "AAAA", "CNAME", "MX", "NS", "PTR", "TXT", "SRV", "CAA", ], description: "Record type", }, value: { type: "string", description: "Record value to delete (IP for A/AAAA, etc)", }, confirm: { type: "boolean", description: "Must be true to confirm deletion. Without this, returns a warning instead of deleting.", }, }, required: ["zone", "domain", "type", "value"], }, - src/tools/records.ts:286-377 (registration)Registration of dns_delete_record as a ToolEntry with its definition, handler, and readonly=false flag. Exported via recordTools() -> getAllTools() in src/tools/index.ts -> used in src/index.ts server setup.
{ definition: { name: "dns_delete_record", description: "Delete a specific DNS record from a zone. Requires confirm=true to execute.", inputSchema: { type: "object", properties: { zone: { type: "string", description: "Zone domain name" }, domain: { type: "string", description: "Domain name of the record", }, type: { type: "string", enum: [ "A", "AAAA", "CNAME", "MX", "NS", "PTR", "TXT", "SRV", "CAA", ], description: "Record type", }, value: { type: "string", description: "Record value to delete (IP for A/AAAA, etc)", }, confirm: { type: "boolean", description: "Must be true to confirm deletion. Without this, returns a warning instead of deleting.", }, }, required: ["zone", "domain", "type", "value"], }, }, readonly: false, handler: async (args) => { const zone = validateDomain(args.zone as string); const domain = validateDomain(args.domain as string); const recType = validateRecordType(args.type as string); const value = args.value as string; if (args.confirm !== true) { return JSON.stringify( { warning: `This will delete the ${recType} record for '${domain}' (value: ${value}). Set confirm=true to proceed.`, }, null, 2 ); } const params: Record<string, string> = { zone, domain, type: recType, }; if (recType === "A" || recType === "AAAA") { params.ipAddress = validateIp(value); } else if (recType === "CNAME") { params.cname = value; } else if (recType === "MX") { params.exchange = value; } else if (recType === "TXT") { params.text = value; } else if (recType === "NS") { params.nameServer = value; } const data = await client.callOrThrow( "/api/zones/records/delete", params ); return JSON.stringify( { success: true, deleted: `${recType} ${domain} -> ${value}`, ...data, }, null, 2 ); }, }, ]; - src/validate.ts:51-60 (helper)validateRecordType helper used by the handler to validate and normalize the DNS record type.
export function validateRecordType(type: string): string { if (!type || typeof type !== "string") { throw new Error("Record type is required"); } const upper = type.trim().toUpperCase(); if (!VALID_RECORD_TYPES.has(upper)) { throw new Error(`Invalid record type: ${upper}`); } return upper; } - src/rate-limit.ts:25-31 (helper)Rate limiting registration classifying dns_delete_record as a destructive operation (5 requests per 60s window).
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); }