Skip to main content
Glama

unifi_update_firewall_policy

DestructiveIdempotent

Update fields of a user-defined UniFi firewall policy by merging changes; previews the result unless confirm is true and rejects system-managed policies.

Instructions

Change fields of a user-defined firewall policy. Give only what changes; source/destination merge (a null trafficFilter removes it). The tool reads the policy, merges and PUTs the whole object. Always needs confirm: true; without it the tool previews the changed fields. System-defined policies and the IPS auto-blocks are refused: UniFi manages them. 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": {
      "policy": "<policy>"
    },
    "name": "unifi_update_firewall_policy"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoPolicy name
siteNoSite name, id or reference; optional while the console has a single site
actionNoWhat matched traffic gets
policyYesPolicy id or exact name
sourceNo
confirmNoMust be true to carry out a guarded change; without it the tool only previews it
enabledNoWhether the policy is active
scheduleNo
ipVersionNoIP versions matched
descriptionNoDescription
destinationNo
ipsecFilterNoIPsec match
loggingEnabledNoSend matches to syslog
protocolFilterNo
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.2/5.0
Behavior5/5

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

Goes far beyond the destructive/idempotent annotations: it discloses merge semantics, that a null trafficFilter removes a side, that the tool reads-merge-PUTs the whole object, the preview-vs-apply behavior of confirm, and exactly which policies are refused and why. The guard rules (protected networks, zone scope, IPv4 filter proof, fail-safe leaning to confirm) are precisely the behavioral context an agent cannot infer from the schema.

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 correctly: purpose, then update mechanics, then confirm, then refusals, then the guard. No filler, but the final guard paragraph is a long, dense run-on of nested conditions that is harder to parse than it needs to be for the value it carries.

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 16-parameter, destructive mutation with no output schema, the definition covers the mutation model, safety gating, refusal cases and the zone/address guard. It does not say what the preview response looks like or how nested object merges behave for fields other than source/destination, which is the main remaining gap.

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?

With 75% schema coverage the baseline is 3, and the description earns above it by explaining partial-update semantics for source/destination and the null-removal convention for trafficFilter, plus the meaning of confirm. It does not add meaning for the other fields (action, schedule, protocolFilter, schedule absence), which remain schema-only.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Change fields of a user-defined firewall policy" names a specific verb and resource and scopes it to user-defined policies, which implicitly separates it from the create/delete siblings. It never names an alternative tool (e.g. unifi_set_firewall_policy_enabled, which overlaps with the 'enabled' field), so sibling differentiation is implied rather than stated.

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?

Strong conditional guidance: confirm:true is mandatory, otherwise the call only previews; system-defined policies and IPS auto-blocks are refused; zone-only sides and overlapping addresses are confirm-level. What is missing is routing advice toward the adjacent tools (create, delete, enable/disable, reorder) when the intent is not a field change.

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