Skip to main content
Glama

unifi_create_firewall_policy

Destructive

Create a zone-based firewall policy to allow, block, or reject traffic between zones; changes reaching protected networks only preview until you confirm.

Instructions

Create a zone-based firewall policy (official POST /firewall/policies), zones by name. Easy unless it can reach a protected network; then it needs confirm: true and previews first. A side that is a zone alone reaches every network in it, and UniFi's Internal zone holds every LAN. So a policy on a zone holding a protected network (UNIFI_MCP_PROTECTED_NETWORKS, pi-cluster by default) is confirm-level unless its filters provably exclude it: a NETWORK filter naming only other networks the console has, or IPv4 addresses, ranges or subnets (directly or through an IPv4 traffic matching list) outside the protected subnets. Addresses that overlap a protected subnet are confirm-level in any zone. Anything the guard cannot place leans to confirm: an unknown zone, list or network id, an IPv6 address, an opposite match, or a MAC, port or other filter, which counts as the whole zone.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "action": "<action>",
      "source": "<source>",
      "destination": "<destination>"
    },
    "name": "unifi_create_firewall_policy"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesPolicy name
siteNoSite name, id or reference; optional while the console has a single site
actionYesWhat matched traffic gets
sourceYesWhere the traffic comes from
confirmNoMust be true to carry out a guarded change; without it the tool only previews it
enabledNoWhether the policy is active
scheduleNoOfficial schedule, e.g. {mode: EVERY_DAY, ...}; absent: always
ipVersionNoIP versions matchedIPV4_AND_IPV6
descriptionNoDescription
destinationYesWhere the traffic goes
ipsecFilterNoIPsec match
loggingEnabledNoSend matches to syslog
protocolFilterNoOfficial protocol filter, e.g. {type: NAMED_PROTOCOL, protocol: {name: TCP}, matchOpposite: false} or {type: PRESET, preset: {name: TCP_UDP}}
allowReturnTrafficNoALLOW only: also allow the return traffic (default false)
connectionStateFilterNoConnection states matched (absent: all)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations say destructive=true and idempotent=false, but the description adds genuine behavioral detail beyond them: without confirm the call only previews, and the guard's decision rule is spelled out (zone-alone reaches every network, Internal zone holds every LAN, NETWORK filters or IPv4 sets outside protected subnets count as exclusions). It also states the fail-safe posture — anything the guard cannot classify (unknown zone/list/network id, IPv6, opposite match, MAC/port filters) leans to confirm-level.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the create action and the confirm precondition before the dense guard rules, and nearly every sentence carries operative information. It is one long run-on paragraph with heavy nesting, though, so the guard criteria would be faster to parse as a list.

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 15-parameter destructive mutation with nested source/destination objects and no output schema, the definition covers the highest-risk unknown — when confirmation is required and how it is decided — very thoroughly. It does not describe what a preview returns or what the success response looks like, but reading the preview is largely self-evident and annotations already flag the destructive profile.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds interpretive meaning the schema doesn't: it explains how the guard reads trafficFilter values (which filter shapes count as provably excluding a protected network, how overlapping addresses are treated, that an absent filter means the whole zone). It says nothing extra about the many other parameters (schedule, protocolFilter, ipsecFilter, connectionStateFilter), which the schema already covers.

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?

Names a specific verb and resource ('Create a zone-based firewall policy') and anchors it to the official endpoint (POST /firewall/policies) plus the 'zones by name' convention. That distinguishes it cleanly from siblings like unifi_update_firewall_policy, unifi_create_acl_rule, and unifi_create_firewall_zone without the reader needing a schema.

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?

Gives a clear operating rule: easy in the general case, but if the policy can reach a protected network it requires confirm: true and previews first. It does not explicitly route between siblings (e.g. when to use this versus unifi_create_acl_rule or unifi_update_firewall_policy), so it stops short of full alternative guidance.

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