dns_disable_zone
Disable a DNS zone to stop it from responding to queries while preserving all its records and settings.
Instructions
Disable a DNS zone. The zone will stop responding to queries but its records are preserved.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zone | Yes | Zone domain name to disable |
Implementation Reference
- src/tools/zones.ts:149-175 (handler)The handler function that executes the dns_disable_zone tool logic. Validates the zone input, calls the /api/zones/disable API endpoint, and returns the result.
{ definition: { name: "dns_disable_zone", description: "Disable a DNS zone. The zone will stop responding to queries but its records are preserved.", inputSchema: { type: "object", properties: { zone: { type: "string", description: "Zone domain name to disable", }, }, required: ["zone"], }, }, readonly: false, handler: async (args) => { const zone = validateDomain(args.zone as string); const data = await client.callOrThrow("/api/zones/disable", { zone }); return JSON.stringify( { success: true, disabled: zone, ...data }, null, 2 ); }, }, - src/tools/zones.ts:149-175 (schema)The input schema definition for dns_disable_zone, specifying a required 'zone' string parameter with a description.
{ definition: { name: "dns_disable_zone", description: "Disable a DNS zone. The zone will stop responding to queries but its records are preserved.", inputSchema: { type: "object", properties: { zone: { type: "string", description: "Zone domain name to disable", }, }, required: ["zone"], }, }, readonly: false, handler: async (args) => { const zone = validateDomain(args.zone as string); const data = await client.callOrThrow("/api/zones/disable", { zone }); return JSON.stringify( { success: true, disabled: zone, ...data }, null, 2 ); }, }, - src/rate-limit.ts:25-40 (registration)Rate limit registration for dns_disable_zone, placing it in the 'mutateLimits' category (non-destructive write operations).
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); } for (const tool of [ "dns_create_zone", "dns_add_record", "dns_update_record", "dns_block_domain", "dns_allow_domain", "dns_remove_allowed", "dns_remove_blocked", "dns_delete_cached", "dns_enable_zone", "dns_disable_zone", "dns_set_zone_options", "dns_set_settings", "dns_install_app", ]) { this.toolLimits.set(tool, mutateLimits); } - src/index.ts:43-101 (registration)Main MCP server registration: tools are listed via ListToolsRequestSchema and invoked via CallToolRequestSchema, which maps tool names (including dns_disable_zone) to their handlers.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools.map((t) => t.definition), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const tool = toolMap.get(name); if (!tool) { return { content: [ { type: "text" as const, text: JSON.stringify({ error: `Unknown tool: ${name}` }) }, ], isError: true, }; } // Rate limit check const rateCheck = rateLimiter.check(name); if (!rateCheck.allowed) { audit.logSecurity("rate_limited", `Tool ${name} rate limited`); return { content: [ { type: "text" as const, text: JSON.stringify({ error: "Rate limited", retryAfterMs: rateCheck.retryAfterMs, }), }, ], isError: true, }; } const startTime = Date.now(); try { const rawResult = await tool.handler((args || {}) as Record<string, unknown>); // Sanitize the response let sanitized: string; try { const parsed = JSON.parse(rawResult); sanitized = JSON.stringify(sanitizeResponse(parsed), null, 2); } catch { sanitized = rawResult; } audit.logToolCall( name, (args || {}) as Record<string, unknown>, "success", Date.now() - startTime ); return { content: [{ type: "text" as const, text: sanitized }], }; - src/validate.ts:5-15 (helper)The validateDomain helper function used by the handler to validate and normalize the zone domain string.
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"); }