dns_delete_cached
Remove a specific domain from the DNS cache to clear stale entries without affecting other cached domains.
Instructions
Delete a specific domain from the DNS cache. Unlike flush, this only removes the specified domain.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to delete from cache (e.g. example.com) |
Implementation Reference
- src/tools/cache.ts:67-93 (handler)Handler for dns_delete_cached: validates domain input, calls /api/cache/delete endpoint on the Technitium DNS server, and returns success response with the deleted domain.
{ definition: { name: "dns_delete_cached", description: "Delete a specific domain from the DNS cache. Unlike flush, this only removes the specified domain.", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Domain name to delete from cache (e.g. example.com)", }, }, required: ["domain"], }, }, readonly: false, handler: async (args) => { const domain = validateDomain(args.domain as string); const data = await client.callOrThrow("/api/cache/delete", { domain }); return JSON.stringify( { success: true, deleted: domain, ...data }, null, 2 ); }, }, - src/tools/cache.ts:68-82 (schema)Input schema for dns_delete_cached: requires a 'domain' string parameter describing the domain to remove from the DNS cache.
definition: { name: "dns_delete_cached", description: "Delete a specific domain from the DNS cache. Unlike flush, this only removes the specified domain.", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Domain name to delete from cache (e.g. example.com)", }, }, required: ["domain"], }, }, - src/tools/cache.ts:5-21 (registration)The cacheTools() function in cache.ts registers the dns_delete_cached tool as part of the array of cache-related tools, which are then collected by getAllTools() in index.ts.
export function cacheTools(client: TechnitiumClient): ToolEntry[] { return [ { definition: { name: "dns_flush_cache", description: "Flush the entire DNS cache. Forces all subsequent queries to be resolved fresh from upstream. Requires confirm=true to execute.", inputSchema: { type: "object", properties: { confirm: { type: "boolean", description: "Must be true to confirm cache flush. Without this, returns a warning instead.", }, }, }, - src/tools/index.ts:14-27 (registration)getAllTools() aggregates all tool arrays including cacheTools (which contains dns_delete_cached) and exposes them to the MCP server.
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)Helper function validateDomain() used by dns_delete_cached to validate and sanitize the domain input before making the API call.
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; }