dns_list_cache
List cached DNS zones hierarchically. Omit domain to see top-level zones, or specify a domain like 'com' to drill into its cached subdomains.
Instructions
List zones in the DNS cache. Returns a hierarchical tree — call with no domain to see top-level zones, then pass a domain (e.g. 'com') to drill into cached subdomains.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | No | Optional parent domain to list children of (e.g. 'com' to see cached .com domains). Omit to see top-level zones. |
Implementation Reference
- src/tools/cache.ts:60-65 (handler)The handler function for dns_list_cache. Accepts an optional domain argument, validates it, calls the /api/cache/list endpoint, and returns the result as formatted JSON.
handler: async (args) => { const params: Record<string, string> = {}; if (args.domain) params.domain = validateDomain(args.domain as string); const data = await client.callOrThrow("/api/cache/list", params); return JSON.stringify(data, null, 2); }, - src/tools/cache.ts:44-58 (schema)The schema/definition for dns_list_cache. Declares the tool name, description, and inputSchema with an optional 'domain' string property.
definition: { name: "dns_list_cache", description: "List zones in the DNS cache. Returns a hierarchical tree — call with no domain to see top-level zones, then pass a domain (e.g. 'com') to drill into cached subdomains.", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Optional parent domain to list children of (e.g. 'com' to see cached .com domains). Omit to see top-level zones.", }, }, }, }, - src/tools/index.ts:8-8 (registration)Import of cacheTools (which includes dns_list_cache) into the tool index.
import { cacheTools } from "./cache.js"; - src/tools/index.ts:21-21 (registration)Registration of cacheTools (including dns_list_cache) into the getAllTools array.
...cacheTools(client), - src/validate.ts:5-17 (helper)The validateDomain helper used by the handler to validate and normalize the domain argument before passing it to the API.
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; }