Skip to main content
Glama
rosschurchill

Technitium MCP Secure

dns_add_record

Add a DNS record to a zone, automatically creating the zone if it does not exist for primary type. Supports A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT, and CAA records.

Instructions

Add a DNS record to a zone. Creates the zone automatically if it doesn't exist for Primary type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zoneYesZone domain name
domainYesFull domain name for the record
typeYesRecord type
valueYesRecord value (IP for A/AAAA, hostname for CNAME/MX/NS, text for TXT)
ttlNoTTL in seconds (default: 3600)
overwriteNoOverwrite existing records of the same type (default: false)
priorityNoPriority for MX records

Implementation Reference

  • Handler function for dns_add_record. Validates zone, domain, record type, and value; builds API parameters based on record type (A/AAAA/CNAME/MX/NS/PTR/TXT/SRV/CAA); calls Technitium API /api/zones/records/add; returns the API response as JSON.
      readonly: false,
      handler: async (args) => {
        const zone = validateDomain(args.zone as string);
        const domain = validateDomain(args.domain as string);
        const recType = validateRecordType(args.type as string);
        const value = args.value as string;
    
        const params: Record<string, string> = {
          zone,
          domain,
          type: recType,
          overwrite: args.overwrite ? "true" : "false",
        };
    
        if (args.ttl) params.ttl = String(args.ttl);
    
        if (recType === "A" || recType === "AAAA") {
          params.ipAddress = validateIp(value);
        } else if (recType === "CNAME") {
          params.cname = validateDomain(value);
        } else if (recType === "NS") {
          params.nameServer = validateDomain(value);
        } else if (recType === "PTR") {
          params.ptrName = validateDomain(value);
        } else if (recType === "MX") {
          params.exchange = validateDomain(value);
          if (args.priority) params.preference = String(args.priority);
        } else if (recType === "TXT") {
          params.text = value;
        } else if (recType === "SRV") {
          params.target = value;
          if (args.priority) params.priority = String(args.priority);
        } else if (recType === "CAA") {
          params.value = value;
        }
    
        const data = await client.callOrThrow(
          "/api/zones/records/add",
          params
        );
        return JSON.stringify(data, null, 2);
      },
    },
  • Input schema for dns_add_record defining required fields (zone, domain, type, value) and optional fields (ttl, overwrite, priority) with enumerated record types (A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT, CAA).
    definition: {
      name: "dns_add_record",
      description:
        "Add a DNS record to a zone. Creates the zone automatically if it doesn't exist for Primary type.",
      inputSchema: {
        type: "object",
        properties: {
          zone: {
            type: "string",
            description: "Zone domain name",
          },
          domain: {
            type: "string",
            description: "Full domain name for the record",
          },
          type: {
            type: "string",
            enum: [
              "A",
              "AAAA",
              "CNAME",
              "MX",
              "NS",
              "PTR",
              "SOA",
              "SRV",
              "TXT",
              "CAA",
            ],
            description: "Record type",
          },
          value: {
            type: "string",
            description:
              "Record value (IP for A/AAAA, hostname for CNAME/MX/NS, text for TXT)",
          },
          ttl: {
            type: "number",
            description: "TTL in seconds (default: 3600)",
          },
          overwrite: {
            type: "boolean",
            description:
              "Overwrite existing records of the same type (default: false)",
          },
          priority: {
            type: "number",
            description: "Priority for MX records",
          },
        },
        required: ["zone", "domain", "type", "value"],
      },
  • Registration of all tools via getAllTools(), which includes recordTools(client) from records.ts where dns_add_record is defined as part of the returned array.
    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),
      ];
    }
  • Helper functions validateDomain, validateRecordType, and validateIp used by the dns_add_record handler to validate input parameters.
    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;
    }
    
    export function validateIp(ip: string): string {
      if (!ip || typeof ip !== "string") {
        throw new Error("IP address is required");
      }
      const trimmed = ip.trim();
      if (!IPV4_RE.test(trimmed) && !IPV6_RE.test(trimmed)) {
        throw new Error("Invalid IP address format");
      }
      return trimmed;
    }
    
    export function validateIpOrHostname(value: string): string {
      if (!value || typeof value !== "string") {
        throw new Error("Server address is required");
      }
      const trimmed = value.trim();
      if (IPV4_RE.test(trimmed) || IPV6_RE.test(trimmed)) {
        return trimmed;
      }
      if (trimmed.startsWith("https://")) {
        return trimmed;
      }
      if (DOMAIN_RE.test(trimmed) && trimmed.length <= 253) {
        return trimmed;
      }
      throw new Error("Invalid server address: must be IP, hostname, or https:// URL");
    }
    
    const VALID_RECORD_TYPES = new Set([
      "A", "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "CAA", "ANY",
    ]);
    
    export function validateRecordType(type: string): string {
      if (!type || typeof type !== "string") {
        throw new Error("Record type is required");
      }
      const upper = type.trim().toUpperCase();
      if (!VALID_RECORD_TYPES.has(upper)) {
        throw new Error(`Invalid record type: ${upper}`);
      }
      return upper;
    }
  • Rate limit registration for dns_add_record - it is configured with a mutate limit of 10 requests per 60-second window.
    for (const tool of [
      "dns_create_zone", "dns_add_record", "dns_update_record",
      "dns_block_domain", "dns_allow_domain",
      "dns_remove_allowed", "dns_remove_blocked", "dns_delete_cached",
      "dns_enable_zone", "dns_disable_zone", "dns_set_zone_options",
      "dns_set_settings", "dns_install_app",
    ]) {
      this.toolLimits.set(tool, mutateLimits);
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden of disclosing side effects. It does reveal that the zone is created automatically for Primary type, which is a useful behavioral trait. However, it omits other important behaviors, such as the overwrite parameter's effect, what happens when a zone doesn't exist for non-Primary types, or any permissions or rate limits.

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 extremely concise, using two short sentences to convey the core purpose and a key side effect. Every sentence earns its place, with the front-loaded action verb making the tool's function immediately clear.

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

Completeness2/5

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

Despite having 7 parameters and no output schema or annotations, the description remains minimal. It fails to cover essential contextual details like return values, overwrite behavior, or handling of non-Primary zones without existing zones. For a tool with this complexity, more context is needed to guide correct invocation.

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 description coverage is 100%, with each parameter having a description. The description itself adds no additional parameter-level meaning beyond the schema, so the baseline of 3 applies.

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 ('Add a DNS record to a zone') with a specific verb and resource, and adds a distinguishing behavioral note about automatic zone creation for Primary type. This effectively differentiates it from sibling tools like dns_update_record and dns_delete_record.

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 usage for adding DNS records, but provides no explicit guidance on when to use this tool versus alternatives like dns_update_record or when not to use it. The note about 'Primary type' hints at a condition but doesn't clarify behavior for non-Primary zones or recommend alternative tools.

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