Skip to main content
Glama
rosschurchill

Technitium MCP Secure

dns_export_zone

Export a DNS zone file in standard BIND format for backup or transfer. Returns zone contents as text.

Instructions

Export a DNS zone file in standard BIND format. Returns the zone file as text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zoneYesZone domain name to export

Implementation Reference

  • Handler function for dns_export_zone tool. Validates the zone domain, calls the Technitium DNS API /api/zones/export endpoint to get the BIND zone file, and returns the result as JSON.
    handler: async (args) => {
      const zone = validateDomain(args.zone as string);
      const text = await client.callRawTextGet("/api/zones/export", { zone });
      return JSON.stringify({ zone, zoneFile: text }, null, 2);
    },
  • Schema/definition for dns_export_zone tool. Defines the tool name, description, and input schema requiring a 'zone' string parameter (the domain name to export).
    {
      definition: {
        name: "dns_export_zone",
        description:
          "Export a DNS zone file in standard BIND format. Returns the zone file as text.",
        inputSchema: {
          type: "object",
          properties: {
            zone: {
              type: "string",
              description: "Zone domain name to export",
            },
          },
          required: ["zone"],
        },
      },
  • Registration of dns_export_zone as a tool entry inside the zoneTools() function, which is exported and included via getAllTools() in src/tools/index.ts.
      {
        definition: {
          name: "dns_export_zone",
          description:
            "Export a DNS zone file in standard BIND format. Returns the zone file as text.",
          inputSchema: {
            type: "object",
            properties: {
              zone: {
                type: "string",
                description: "Zone domain name to export",
              },
            },
            required: ["zone"],
          },
        },
        readonly: true,
        handler: async (args) => {
          const zone = validateDomain(args.zone as string);
          const text = await client.callRawTextGet("/api/zones/export", { zone });
          return JSON.stringify({ zone, zoneFile: text }, null, 2);
        },
      },
    ];
  • validateDomain helper function used in the handler to normalize and validate the zone domain name.
    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;
    }
  • callRawTextGet method on TechnitiumClient used to make the GET request to the /api/zones/export endpoint and return raw text (the BIND zone file).
    async callRawTextGet(
      endpoint: string,
      params: Record<string, string> = {}
    ): Promise<string> {
      await this.ensureAuth();
    
      const qs = new URLSearchParams({
        ...params,
        token: this.sessionToken!,
      });
    
      const resp = await fetch(`${this.config.url}${endpoint}?${qs.toString()}`, {
        method: "GET",
      });
    
      const text = await resp.text();
    
      try {
        const json = JSON.parse(text) as TechnitiumResponse;
        if (json.status === "invalid-token") {
          this.sessionToken = null;
          audit.logAuth("token_expired", false);
          await this.ensureAuth();
          const retryQs = new URLSearchParams({
            ...params,
            token: this.sessionToken!,
          });
          const retryResp = await fetch(
            `${this.config.url}${endpoint}?${retryQs.toString()}`,
            { method: "GET" }
          );
          return retryResp.text();
        }
        if (json.status !== "ok") {
          throw new Error(json.errorMessage || `API error: ${json.status}`);
        }
      } catch (e) {
        if (e instanceof SyntaxError) {
          return text;
        }
        throw e;
      }
    
      return text;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.2.0

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are provided, so the description carries the burden. It discloses the return format ('text') and the output type ('zone file'), but it does not explicitly state whether the operation is read-only or whether any side effects occur. Although 'export' implies non-destructive, explicit disclosure would be stronger.

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 two concise sentences, front-loaded with the action and resource, and contains no filler. Every word contributes meaning.

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

Completeness4/5

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

For a one-parameter tool with no output schema and no annotations, the description covers the primary purpose and return value adequately. However, it lacks explicit side-effect disclosure and usage guidance, leaving a small gap but not a major one given the tool's simplicity.

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?

Schema coverage is 100% with a clear description for the 'zone' parameter ('Zone domain name to export'). The description adds no additional parameter semantics beyond what the schema already provides, so it falls at the baseline.

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 the action ('Export') and the specific resource ('DNS zone file') with format ('standard BIND format'). It also clarifies the return type ('text'), and the verb+resource combination distinguishes it from sibling tools like dns_list_records or dns_list_zones.

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

Usage Guidelines3/5

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

The description implies when to use the tool (to obtain a zone file in BIND format) but does not explicitly state alternatives or when not to use it. For example, it does not mention that users should use dns_list_records for individual records or dns_list_zones for zone summaries. With multiple DNS tools present, this is a clear gap.

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