opnsense_dns_flush_zone
Flush all cached DNS entries for a specific domain to clear stale SERVFAIL or outdated records. Restarts Unbound for complete cache clearing.
Instructions
Flush all cached DNS entries for a specific domain/zone. Use this to clear stale SERVFAIL or outdated records for a domain. Restarts Unbound to ensure complete cache clearing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain/zone to flush (e.g. 'example.com') |
Implementation Reference
- src/tools/dns.ts:45-47 (schema)Zod schema for opnsense_dns_flush_zone input validation. Expects a 'domain' string conforming to DomainSchema (valid domain name format).
const DnsFlushZoneSchema = z.object({ domain: DomainSchema, }); - src/tools/dns.ts:199-210 (registration)Tool definition registration for 'opnsense_dns_flush_zone' in the dnsToolDefinitions array. Declares name, description, and inputSchema with required 'domain' property.
{ name: "opnsense_dns_flush_zone", description: "Flush all cached DNS entries for a specific domain/zone. Use this to clear stale SERVFAIL or outdated records for a domain. Restarts Unbound to ensure complete cache clearing.", inputSchema: { type: "object" as const, properties: { domain: { type: "string", description: "Domain/zone to flush (e.g. 'example.com')" }, }, required: ["domain"], }, }, - src/tools/dns.ts:389-403 (handler)Handler implementation for opnsense_dns_flush_zone. Parses domain from args via DnsFlushZoneSchema, then flushes the full Unbound cache and restarts Unbound (reconfigure) because OPNsense has no per-zone flush API.
case "opnsense_dns_flush_zone": { const { domain } = DnsFlushZoneSchema.parse(args); // OPNsense doesn't expose per-zone flush via API. // Flush full cache then restart Unbound to clear infra cache too. await client.post("/unbound/service/flushcache"); const result = await client.post("/unbound/service/reconfigure"); return { content: [ { type: "text", text: `Flushed DNS cache and restarted Unbound to clear all cached entries for ${domain}. Full cache and infrastructure cache cleared.`, }, ], }; } - src/index.ts:59-59 (registration)Maps the tool name 'opnsense_dns_flush_zone' to the handleDnsTool handler function for MCP call routing.
for (const def of dnsToolDefinitions) toolHandlers.set(def.name, handleDnsTool);