Skip to main content
Glama

create_firewall_policy

Create a zone-based firewall policy to allow, block, or reject traffic between source and destination zones, applied immediately and persisted on the UniFi console.

Instructions

Create a zone-based firewall policy (UniFi Network 9+).

Mutating operation: applied immediately and persisted on the UniFi console. Action is ALLOW, BLOCK, or REJECT across the src_zone_id to dst_zone_id pair. Lower index evaluates earlier. A controller-generated "(Return)" companion rule is typically added. Requires zone ids from get_firewall_policies; review there first.

Args: name: Policy name (used for display and zone inference). action: Packet decision — "ALLOW", "BLOCK", or "REJECT". src_zone_id: Source zone id (from get_firewall_policies). dst_zone_id: Destination zone id (from get_firewall_policies). protocol: Protocol selector — "all", "tcp", "udp", "tcp_udp", "icmp", "igmp", or "icmpv6". description: Optional human-readable description. client_macs: Restrict the source to these client MAC addresses. index: Rule order index; lower values evaluate earlier. Omit for auto-order. enabled: Create the policy enabled. Defaults to True. site: Site to operate on. Defaults to "default". device: Optional console name to target a specific UniFi device; omit for default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesPolicy name (used for display and zone inference).
siteNoSite to operate on. Defaults to "default".default
indexNoRule order index; lower values evaluate earlier. Omit for auto-order.
actionYesPacket decision — "ALLOW", "BLOCK", or "REJECT".
deviceNoOptional console name to target a specific UniFi device; omit for default.
enabledNoCreate the policy enabled. Defaults to True.
protocolNoProtocol selector — "all", "tcp", "udp", "tcp_udp", "icmp", "igmp", or "icmpv6".all
client_macsNoRestrict the source to these client MAC addresses.
descriptionNoOptional human-readable description.
dst_zone_idYesDestination zone id (from get_firewall_policies).
src_zone_idYesSource zone id (from get_firewall_policies).
Install Server

TDQS

A4.5/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It explicitly states that the operation is mutating, applied immediately, persisted on the UniFi console, that lower index values evaluate earlier, and that a controller-generated '(Return)' companion rule is typically added. These are meaningful side-effect disclosures beyond 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.

Conciseness5/5

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

The description is front-loaded with purpose and mutation status, then covers side effects, prerequisites, and an Args list. Every sentence contributes necessary information for safe invocation, and the structure makes the 11-parameter tool understandable without bloat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 11 parameters, no annotations, and no output schema, the description is complete: it covers all required inputs, defaults, protocol values, ordering semantics, prerequisite lookups, device/site targeting, and side effects. An agent has enough context to invoke it correctly and anticipate the outcome.

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?

Schema description coverage is 100%, so the baseline is 3. The description repeats most parameter semantics already present in the schema, such as defaults, protocol choices, and the source of zone IDs. It adds useful grouping and emphasis for required parameters, but does not materially expand beyond the structured schema.

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 opens with a specific verb and resource: 'Create a zone-based firewall policy (UniFi Network 9+)'. It further clarifies the policy model (ALLOW/BLOCK/REJECT across a src_zone_id to dst_zone_id pair), which clearly distinguishes it from sibling tools like create_firewall_rule or set_firewall_policy_enabled.

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 gives clear context and explicit prerequisites: 'Requires zone ids from get_firewall_policies; review there first.' It also warns that the operation is mutating and applied immediately. It does not explicitly state when-not-to-use or name alternatives, but the zone-based framing and prerequisite guidance are strong.

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

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/mikeholownych/unifi-mcp'

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