Skip to main content
Glama

create_firewall_policy

Creates a new firewall policy on a UniFi site, defining source and destination zones with optional traffic filters for precise traffic control.

Instructions

Create a new firewall policy on a site.

host: console name, ID, or composite ID (MAC:numericId format). site: site name or ID. policy: required fields (all validated locally — a missing field raises ValueError naming it — and all verified against the live controller):

  • name (str)

  • enabled (bool)

  • action: {'type': 'ALLOW'|'DENY'|'REJECT', 'allowReturnTraffic': bool}

  • source: {'zoneId': str}

  • destination: {'zoneId': str}

  • ipProtocolScope: {'ipVersion': 'IPV4'|'IPV6'|'BOTH'}

  • loggingEnabled (bool) Note: there is NO 'index' field; use set_firewall_policy_ordering to manage rule order. Get zone IDs from list_firewall_zones_proxy. trafficFilter (optional; may appear on source and/or destination) narrows the match beyond the zone pair. Set trafficFilter.type plus the ONE matching nested object:

    • IP_ADDRESS -> ipAddressFilter.items[] (IP addresses / CIDRs)

    • NETWORK -> networkFilter.networkIds[] (network UUIDs)

    • PORT -> portFilter.items[] (ports / port ranges)

    • MAC_ADDRESS -> macAddressFilter.macAddresses[] (client MAC addresses) The controller may also support further types (e.g. region/identity-based); list_firewall_policies only reveals the types already in use on a site, so an unlisted type is not evidence it is unsupported. PORT-FILTER PLACEMENT FOOTGUN: a portFilter under source.trafficFilter filters SOURCE ports, which for outbound flows are ephemeral (random high ports) -> the rule silently matches nothing. A destination-port rule MUST use destination.trafficFilter with type PORT, never a source portFilter. (create/update_firewall_policy log a runtime warning when a source PORT filter is combined with an any-destination ALLOW.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
siteYes
policyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Install Server

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers exceptional behavioral detail: local validation with ValueError naming, live controller verification, absence of the index field, the source-port filter footgun, and a runtime warning condition. These are exactly the non-obvious behaviors an agent needs before invoking an API.

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?

Although lengthy, the description is tightly organized: a one-line purpose, parameter definitions, and a clearly labeled PORT-FILTER PLACEMENT FOOTGUN warning. Every sentence contributes necessary information for correctly constructing a firewall policy with a nested schema.

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 complex create operation with an opaque schema and no annotations, the description covers host/site resolution, required fields, optional trafficFilter types, ordering via a sibling tool, zone ID sourcing, and a dangerous port-filter placement caveat. The presence of an output schema covers return-value expectations, so nothing critical is missing.

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

Parameters5/5

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

The input schema is generic — policy is simply an 'additionalProperties: true' object — so the description supplies the entire semantic layer. It documents host formats, site addressing, required policy fields with types, the action/source/destination structure, and the trafficFilter one-of variants, fully compensating for 0% schema coverage.

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 new firewall policy on a site.' It also differentiates from related siblings by explicitly stating there is NO 'index' field and directing rule-order management to set_firewall_policy_ordering, removing any ambiguity about scope.

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 pointers to sibling tools for related tasks: use set_firewall_policy_ordering for rule order, list_firewall_zones_proxy for zone IDs, and list_firewall_policies for discovering in-use filter types. It does not explicitly state exclusions against update_firewall_policy or patch_firewall_policy, though 'Create a new' implies the distinction.

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/swkstudios/unifi-fabric-mcp-server'

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