dns_health_check
Check DNS server health by retrieving version, uptime, forwarder configuration, blocking status, and last hour failure rate.
Instructions
Quick health check of the DNS server. Returns version, uptime, forwarder config, blocking status, and last hour failure rate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/dashboard.ts:60-95 (handler)The core handler function for dns_health_check. It concurrently fetches server settings and last-hour dashboard stats, computes the failure rate, and returns a JSON object with version, uptime, forwarder config, blocking status, and last-hour query stats.
handler: async () => { const [settings, stats] = await Promise.all([ client.callOrThrow("/api/settings/get"), client.callOrThrow("/api/dashboard/stats/get", { type: "LastHour", }), ]); const s = stats.stats as Record<string, number>; const totalQueries = s.totalQueries || 0; const failures = s.totalServerFailure || 0; const failureRate = totalQueries > 0 ? ((failures / totalQueries) * 100).toFixed(1) : "0.0"; return JSON.stringify( { version: settings.version, uptimestamp: settings.uptimestamp, dnsServerDomain: settings.dnsServerDomain, forwarders: settings.forwarders, forwarderProtocol: settings.forwarderProtocol, enableBlocking: settings.enableBlocking, lastHour: { totalQueries, serverFailures: failures, failureRate: `${failureRate}%`, blocked: s.totalBlocked || 0, cached: s.totalCached || 0, }, }, null, 2 ); }, - src/tools/dashboard.ts:49-58 (schema)Schema definition for dns_health_check tool. It has an empty input schema (no parameters) and a description explaining it returns version, uptime, forwarder config, blocking status, and failure rate.
{ definition: { name: "dns_health_check", description: "Quick health check of the DNS server. Returns version, uptime, forwarder config, blocking status, and last hour failure rate.", inputSchema: { type: "object", properties: {}, }, }, - src/tools/index.ts:14-26 (registration)The tool is registered via dashboardTools() in src/tools/index.ts, which is called by getAllTools() and aggregated into the toolMap in src/index.ts where it's served to the MCP client.
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:66-71 (helper)The validatePeriod helper is imported by dashboard.ts and used by dns_get_stats (the sibling tool in the same file). dns_health_check does not directly use it, but it's imported and available.
export function validatePeriod(period: string): string { if (!VALID_PERIODS.has(period)) { throw new Error(`Invalid period: ${period}. Valid: ${[...VALID_PERIODS].join(", ")}`); } return period; }