Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_fw_manage_alias

Create, update, or delete firewall aliases in OPNsense. Then apply changes with opnsense_fw_apply.

Instructions

Create, update, or delete a firewall alias. Run opnsense_fw_apply afterwards to activate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
uuidNoUUID of alias (required for update/delete)
nameNoAlias name (required for create)
typeNoAlias type: host, network, port, url, etc. (required for create)
contentNoAlias content — newline-separated values (required for create)
descriptionNoAlias description

Implementation Reference

  • ManageAliasSchema: Zod validation schema for opnsense_fw_manage_alias. Defines a discriminated union on 'action' with three variants: create (requires name, type, content), update (requires uuid, optional name/type/content/description), and delete (requires uuid).
    const ManageAliasSchema = z.discriminatedUnion("action", [
      z.object({
        action: z.literal("create"),
        name: z.string().min(1, "Alias name is required"),
        type: z.string().min(1, "Alias type is required"),
        content: z.string().min(1, "Alias content is required"),
        description: z.string().optional(),
      }),
      z.object({
        action: z.literal("update"),
        uuid: UuidSchema,
        name: z.string().optional(),
        type: z.string().optional(),
        content: z.string().optional(),
        description: z.string().optional(),
      }),
      z.object({
        action: z.literal("delete"),
        uuid: UuidSchema,
      }),
    ]);
  • Tool definition for 'opnsense_fw_manage_alias' in firewallToolDefinitions array. Registers the tool name, description, and input JSON Schema listing action/uuid/name/type/content/description parameters with 'action' as required.
      name: "opnsense_fw_manage_alias",
      description:
        "Create, update, or delete a firewall alias. Run opnsense_fw_apply afterwards to activate.",
      inputSchema: {
        type: "object" as const,
        properties: {
          action: {
            type: "string",
            enum: ["create", "update", "delete"],
            description: "Action to perform",
          },
          uuid: {
            type: "string",
            description: "UUID of alias (required for update/delete)",
          },
          name: {
            type: "string",
            description: "Alias name (required for create)",
          },
          type: {
            type: "string",
            description: "Alias type: host, network, port, url, etc. (required for create)",
          },
          content: {
            type: "string",
            description: "Alias content — newline-separated values (required for create)",
          },
          description: { type: "string", description: "Alias description" },
        },
        required: ["action"],
      },
    },
  • Handler case 'opnsense_fw_manage_alias' inside handleFirewallTool(). Parses args with ManageAliasSchema, then dispatches by action: create (POST /firewall/alias/addItem), update (POST /firewall/alias/setItem/{uuid} with selective fields), or delete (POST /firewall/alias/delItem/{uuid}).
    case "opnsense_fw_manage_alias": {
      const parsed = ManageAliasSchema.parse(args);
    
      switch (parsed.action) {
        case "create": {
          const result = await client.post("/firewall/alias/addItem", {
            alias: {
              enabled: "1",
              name: parsed.name,
              type: parsed.type,
              content: parsed.content,
              description: parsed.description ?? "",
            },
          });
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        }
        case "update": {
          const payload: Record<string, string> = {};
          if (parsed.name !== undefined) payload["name"] = parsed.name;
          if (parsed.type !== undefined) payload["type"] = parsed.type;
          if (parsed.content !== undefined) payload["content"] = parsed.content;
          if (parsed.description !== undefined) payload["description"] = parsed.description;
    
          const result = await client.post(`/firewall/alias/setItem/${parsed.uuid}`, {
            alias: payload,
          });
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        }
        case "delete": {
          const result = await client.post(`/firewall/alias/delItem/${parsed.uuid}`);
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        }
      }
      break;
    }
  • src/index.ts:59-60 (registration)
    Registers the handler: iterates over firewallToolDefinitions and maps each tool name (including opnsense_fw_manage_alias) to the handleFirewallTool function.
    for (const def of dnsToolDefinitions) toolHandlers.set(def.name, handleDnsTool);
    for (const def of firewallToolDefinitions) toolHandlers.set(def.name, handleFirewallTool);
Behavior2/5

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

No annotations are provided, so the description must carry the burden of behavioral disclosure. It reveals that the tool modifies aliases and requires a separate apply step, but lacks details on permissions, side effects, or whether changes are reversible. For a modification tool with zero annotation coverage, this is a significant gap.

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—two sentences with no filler. It front-loads the action verbs and includes the critical activation hint. Every word earns its place.

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?

Given the tool has no output schema and the description does not mention return values or error handling, it lacks completeness for a CRUD tool with 6 parameters. The agent would benefit from knowing what the tool returns (e.g., UUID of created alias) and any validation behavior.

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 have descriptions in the schema (100% coverage), so the description adds no additional meaning beyond the schema. Baseline 3 is appropriate; it does not explain parameter relationships or conditional requirements across actions.

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's purpose: 'Create, update, or delete a firewall alias.' This verb+resource combination is specific and distinguishes it from sibling tools like opnsense_fw_list_aliases (list) and opnsense_fw_apply (apply).

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 explicitly instructs to 'Run opnsense_fw_apply afterwards to activate,' which guides the agent on the required post-action step. Although it does not explicitly contrast with list or rule management tools, the context of 'firewall alias' and the sibling tool names imply when 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