Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_dns_add_forward

Add a DNS-over-TLS forwarding server for a specific domain to redirect DNS queries to a defined server and port.

Instructions

Add a DNS forwarding server (DNS-over-TLS). Run opnsense_dns_apply afterwards to activate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to forward (e.g. 'example.com')
serverYesDNS server IP address
portNoDNS server port (default: 53)

Implementation Reference

  • The handler function case for opnsense_dns_add_forward. Parses args with AddForwardSchema, then POSTs to /unbound/settings/addDot with domain, server, and port.
    case "opnsense_dns_add_forward": {
      const parsed = AddForwardSchema.parse(args);
      const result = await client.post("/unbound/settings/addDot", {
        dot: {
          enabled: "1",
          domain: parsed.domain,
          server: parsed.server,
          port: String(parsed.port),
        },
      });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • AddForwardSchema defines Zod validation for the tool: domain (DomainSchema), server (IP), and optional port (default 53).
    const AddForwardSchema = z.object({
      domain: DomainSchema,
      server: z.string().ip({ message: "Invalid server IP address" }),
      port: z.number().int().min(1).max(65535).optional().default(53),
    });
  • Tool definition registration in dnsToolDefinitions array: name, description, and inputSchema for opnsense_dns_add_forward.
    {
      name: "opnsense_dns_add_forward",
      description:
        "Add a DNS forwarding server (DNS-over-TLS). Run opnsense_dns_apply afterwards to activate.",
      inputSchema: {
        type: "object" as const,
        properties: {
          domain: { type: "string", description: "Domain to forward (e.g. 'example.com')" },
          server: { type: "string", description: "DNS server IP address" },
          port: {
            type: "number",
            description: "DNS server port (default: 53)",
          },
        },
        required: ["domain", "server"],
      },
    },
  • src/index.ts:59-70 (registration)
    Registration of handleDnsTool as the handler for all dnsToolDefinitions, including opnsense_dns_add_forward.
    for (const def of dnsToolDefinitions) toolHandlers.set(def.name, handleDnsTool);
    for (const def of firewallToolDefinitions) toolHandlers.set(def.name, handleFirewallTool);
    for (const def of diagnosticsToolDefinitions) toolHandlers.set(def.name, handleDiagnosticsTool);
    for (const def of interfacesToolDefinitions) toolHandlers.set(def.name, handleInterfacesTool);
    for (const def of dhcpToolDefinitions) toolHandlers.set(def.name, handleDhcpTool);
    for (const def of systemToolDefinitions) toolHandlers.set(def.name, handleSystemTool);
    for (const def of acmeToolDefinitions) toolHandlers.set(def.name, handleAcmeTool);
    for (const def of firmwareToolDefinitions) toolHandlers.set(def.name, handleFirmwareTool);
    for (const def of routingToolDefinitions) toolHandlers.set(def.name, handleRoutingTool);
    for (const def of vlanToolDefinitions) toolHandlers.set(def.name, handleVlanTool);
    for (const def of tailscaleToolDefinitions) toolHandlers.set(def.name, handleTailscaleTool);
    for (const def of natToolDefinitions) toolHandlers.set(def.name, handleNatTool);
  • DomainSchema used by AddForwardSchema to validate the 'domain' field.
    export const DomainSchema = z
      .string()
      .regex(
        /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-))*\.[a-zA-Z]{2,}$/,
        "Invalid domain name",
      );
Behavior3/5

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

With no annotations, the description carries full burden. It notes the need for an activation step, but omits other behavioral details like whether it overwrites existing forwards, permission requirements, or idempotency. Minimal but not misleading.

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?

Two sentences, no filler. First sentence states purpose, second provides critical follow-up action. Extremely efficient and well-structured for quick comprehension.

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 simple 3-parameter tool with no output schema, the description covers primary action, protocol, and post-step. Lacks edge case handling (e.g., duplicate entries) but sufficient for standard usage given sibling context.

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?

Input schema covers all three parameters with descriptions. The tool description adds no additional parameter meaning beyond 'port' default (53) implied in schema; baseline score of 3 is appropriate due to full schema coverage.

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?

Description clearly states the action ('Add a DNS forwarding server'), specifies protocol (DNS-over-TLS), and distinguishes from sibling tools like opnsense_dns_delete_forward and opnsense_dns_list_forwards. The verb-resource combination is specific and unambiguous.

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?

Explicitly instructs to run opnsense_dns_apply afterwards to activate, which is a key post-step. However, it does not compare with alternative add tools (e.g., opnsense_dns_add_override) or specify when not to use this tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/itunified-io/mcp-opnsense'

If you have feedback or need assistance with the MCP directory API, please join our Discord server