Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_dns_block_domain

Block a domain by adding a domain override with an empty server, then apply DNS changes to activate.

Instructions

Block a domain by adding a domain override with an empty server. Run opnsense_dns_apply afterwards to activate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to block (e.g. 'ads.example.com')
serverNoServer to redirect to (empty string = block, default: empty)
descriptionNoOptional description

Implementation Reference

  • Registration of opnsense_dns_block_domain in the dnsToolDefinitions array, defining its name, description, and input schema.
    {
      name: "opnsense_dns_block_domain",
      description:
        "Block a domain by adding a domain override with an empty server. Run opnsense_dns_apply afterwards to activate.",
      inputSchema: {
        type: "object" as const,
        properties: {
          domain: { type: "string", description: "Domain to block (e.g. 'ads.example.com')" },
          server: {
            type: "string",
            description: "Server to redirect to (empty string = block, default: empty)",
          },
          description: { type: "string", description: "Optional description" },
        },
        required: ["domain"],
      },
    },
  • Zod schema for validating inputs to opnsense_dns_block_domain. domain is required; server and description are optional.
    const BlockDomainSchema = z.object({
      domain: DomainSchema,
      server: z.string().optional(),
      description: z.string().optional(),
    });
  • Handler implementation: validates input via BlockDomainSchema, then POSTs to /unbound/settings/addDot with server defaulting to 127.0.0.1 to block a domain.
    case "opnsense_dns_block_domain": {
      const parsed = BlockDomainSchema.parse(args);
      // OPNsense 24.7+: domain overrides merged into dots model (type: "forward")
      const result = await client.post("/unbound/settings/addDot", {
        dot: {
          enabled: "1",
          domain: parsed.domain,
          server: parsed.server || "127.0.0.1",
          port: "",
          verify: "",
          forward_tcp_upstream: "0",
          forward_first: "0",
          description: parsed.description ?? "",
        },
      });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • DomainSchema validation regex used by BlockDomainSchema to validate domain names.
    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",
      );
  • src/index.ts:59-59 (registration)
    Registration of handleDnsTool as the handler for all DNS tools, including opnsense_dns_block_domain.
    for (const def of dnsToolDefinitions) toolHandlers.set(def.name, handleDnsTool);
Behavior3/5

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

With no annotations, the description must fully disclose behavior. It correctly indicates a mutation (block) and the two-step process (add then apply). However, it does not discuss potential side effects like overwriting existing overrides, permission requirements, or rate limits. The transparency is adequate but not rich.

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: one sentence stating the action and mechanism, plus a short instruction. It is front-loaded and contains no superfluous information.

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 blocking tool, the description covers purpose, mechanism, and critical activation step. It lacks information on handling duplicates, confirmation, or return values (no output schema), so a minor gap exists. Overall, it is complete enough for the task.

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?

The input schema already provides full descriptions for all three parameters (100% coverage). The description reinforces that server defaults to empty (block) and description is optional, adding minimal value beyond the schema. Baseline of 3 is appropriate.

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 tool blocks a domain by adding a domain override with an empty server, and mentions the required follow-up action (apply). This verb+resource+mechanism clearly distinguishes it from siblings like opnsense_dns_add_override and opnsense_dns_unblock_domain.

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 instruction to run opnsense_dns_apply afterwards provides clear activation context. However, it does not explicitly state when to use this tool vs alternatives (e.g., unblocking or setting a non-empty server), leaving some implicit inference from the tool name and sibling list.

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