Skip to main content
Glama
rosschurchill

Technitium MCP Secure

dns_query_logs

Retrieve DNS query logs with optional filters for domain, client IP, query type, and response code to analyze server activity.

Instructions

Query DNS server logs with optional filters. Returns recent DNS queries and their responses. Requires the Query Logs app to be installed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNumberNoPage number (default: 1)
entriesPerPageNoEntries per page (default: 25, max: 100)
domainNoFilter by domain name (exact match, e.g. github.com)
clientIpNoFilter by client IP address
queryTypeNoFilter by DNS query type
responseCodeNoFilter by response code

Implementation Reference

  • The handler function that executes the dns_query_logs tool logic. It builds query parameters with optional filters (domain, clientIp, queryType, responseCode) and calls the /api/logs/query endpoint via the TechnitiumClient.
    handler: async (args) => {
      const params: Record<string, string> = {
        name: "Query Logs (Sqlite)",
        classPath: "QueryLogsSqlite.App",
        pageNumber: String(args.pageNumber || 1),
        entriesPerPage: String(
          Math.min(Number(args.entriesPerPage) || 25, 100)
        ),
      };
    
      if (args.domain) {
        // API uses 'qname' (exact match on the DNS question name column)
        params.qname = validateStringLength(
          args.domain as string,
          253,
          "domain"
        );
      }
      if (args.clientIp) {
        params.clientIpAddress = validateIp(args.clientIp as string);
      }
      if (args.queryType) {
        params.type = validateRecordType(args.queryType as string);
      }
      if (args.responseCode) {
        const valid = new Set([
          "NoError",
          "ServerFailure",
          "NxDomain",
          "Refused",
          "FormatError",
        ]);
        const code = args.responseCode as string;
        if (!valid.has(code)) {
          throw new Error(`Invalid response code: ${code}`);
        }
        params.rcode = code;
      }
    
      const data = await client.callOrThrow("/api/logs/query", params);
      return JSON.stringify(data, null, 2);
    },
  • The input schema definition for dns_query_logs. Defines optional parameters: pageNumber, entriesPerPage, domain, clientIp, queryType (with enum of DNS record types), and responseCode (with enum of error codes).
    definition: {
      name: "dns_query_logs",
      description:
        "Query DNS server logs with optional filters. Returns recent DNS queries and their responses. Requires the Query Logs app to be installed.",
      inputSchema: {
        type: "object",
        properties: {
          pageNumber: {
            type: "number",
            description: "Page number (default: 1)",
          },
          entriesPerPage: {
            type: "number",
            description: "Entries per page (default: 25, max: 100)",
          },
          domain: {
            type: "string",
            description: "Filter by domain name (exact match, e.g. github.com)",
          },
          clientIp: {
            type: "string",
            description: "Filter by client IP address",
          },
          queryType: {
            type: "string",
            enum: [
              "A",
              "AAAA",
              "CNAME",
              "MX",
              "NS",
              "PTR",
              "SOA",
              "TXT",
              "ANY",
            ],
            description: "Filter by DNS query type",
          },
          responseCode: {
            type: "string",
            enum: [
              "NoError",
              "ServerFailure",
              "NxDomain",
              "Refused",
              "FormatError",
            ],
            description: "Filter by response code",
          },
        },
      },
    },
  • The tool is registered via the logTools function, imported from './logs.js' and included in the getAllTools array as ...logTools(client).
    import { logTools } from "./logs.js";
    import { appTools } from "./apps.js";
    import { dnssecTools } from "./dnssec.js";
    
    export function getAllTools(client: TechnitiumClient): ToolEntry[] {
      return [
        ...dashboardTools(client),
        ...dnsClientTools(client),
        ...zoneTools(client),
        ...recordTools(client),
        ...blockingTools(client),
        ...cacheTools(client),
        ...settingsTools(client),
        ...logTools(client),
  • src/index.ts:35-35 (registration)
    The tool is registered in the MCP server's toolMap (line 35) and dispatched via CallToolRequestSchema (line 47-124). The definition (name, description, inputSchema) is sent via ListToolsRequestSchema (line 43-45).
    const toolMap = new Map(tools.map((t) => [t.definition.name, t]));
  • The validateStringLength helper used to validate the domain filter length (max 253 chars). Also validateIp (line 19-28) and validateRecordType (line 51-60) are used for clientIp and queryType filters.
    export function validateStringLength(value: string, maxLength: number, fieldName: string): string {
      if (typeof value !== "string") {
        throw new Error(`${fieldName} must be a string`);
      }
      if (value.length > maxLength) {
        throw new Error(`${fieldName} exceeds maximum length of ${maxLength}`);
      }
      return value;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.0
    • changedInput schema / properties / domain / description
      Previous value: -"Filter by domain name (partial match)"New value: +"Filter by domain name (exact match, e.g. github.com)"
  2. First observedv1.1.0

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior itself. It mentions that the tool returns recent queries and responses and requires an app installation, but it does not state whether the operation is read-only, how errors are handled, or any rate limits. The 'recent' qualifier adds some temporal context but is not fully detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is exactly two sentences, front-loaded with the verb 'Query' and the resource, and contains no redundant information. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the six-parameter schema with no output schema and no annotations, the description provides a high-level purpose and prerequisite but lacks details on return structure, the exact time window for 'recent', and filter combination behavior. It is adequate but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All six parameters are fully described in the schema (100% coverage), so the description adds minimal value beyond that. The phrase 'optional filters' is only a generic summary and does not clarify parameter usage or relationships beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Query DNS server logs' and 'Returns recent DNS queries and their responses', identifying the specific action and resource. This distinguishes it from sibling tools like dns_get_stats or dns_list_records.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool (when querying DNS logs) and includes a prerequisite ('Requires the Query Logs app to be installed'). It does not explicitly mention alternatives or exclusions, but the context is sufficiently clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.