Skip to main content
Glama

create_firewall_rule

Destructive

Create a new firewall rule to accept, drop, or reject traffic by protocol, port, and source/destination zone. Applies immediately and persists on the UniFi controller.

Instructions

Create a legacy firewall rule (UniFi Network <9 or traditional API).

Mutating operation: applied immediately and persisted on the controller. For zone-based policies (Network 9+), prefer create_firewall_policy. Review existing rules with get_firewall_rules first.

Args: name: Unique rule name action: Action — "accept", "drop", or "reject" protocol: Protocol — "tcp", "udp", "icmp", "all", or IANA number dst_port: Destination port or range (e.g., "80", "80-443") src_zone: Source zone ID (from get_firewall_policies) dst_zone: Destination zone ID src_port: Source port or range logging: Enable logging for matches enabled: Whether rule is active on creation. Defaults to True. site: Site to operate on. Defaults to "default". device: Optional console name to target a specific console; omit for default.

Returns: Created firewall rule configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesUnique rule name
siteNoSite to operate on. Defaults to "default".default
actionYesAction — "accept", "drop", or "reject"
deviceNoOptional console name to target a specific UniFi device; omit for default.
enabledNoWhether rule is active on creation. Defaults to True.
loggingNoEnable logging for matches.
dst_portNoDestination port or range (e.g., '80', '80-443').
dst_zoneNoDestination zone ID.
protocolYesProtocol — "tcp", "udp", "icmp", "all", or IANA number
src_portNoSource port or range.
src_zoneNoSource zone ID (from get_firewall_policies).
Install Server

TDQS

A4.2/5.0
Behavior4/5

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

Annotations provide destructiveHint=true, and the description adds valuable context on top: it is a 'Mutating operation: applied immediately and persisted on the controller.' This reveals immediacy and persistence behaviors not present in the annotation. It could also mention rollback or failure implications, but the existing disclosure is strong for a legacy API mutation.

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

Conciseness3/5

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

The opening sentences are useful and front-loaded with purpose and usage guidance. However, the Args section duplicates the input schema content one-for-one, which adds length without earning its place. The Returns line adds value since there is no output schema, but the overall structure could be tighter by omitting the redundant parameter 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 complex 11-parameter mutating tool with destructiveHint and no output schema, the description covers the essential context: legacy scope, mutation semantics, persistence, the preferred alternative for newer APIs, and a prerequisite to review existing rules. It mentions a return value, though vaguely. Missing details like error behavior or uniqueness handling for rule names keep it just short of a 5.

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 schema already documents every parameter. The description repeats the Args list verbatim without adding new semantic meaning. It does not explain relationships between parameters or edge cases, but given full schema coverage, the baseline of 3 is appropriate; the description simply does not add extra value.

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 verb and resource: 'Create a legacy firewall rule', and specifies the scope (UniFi Network <9 or traditional API). It explicitly distinguishes itself from the sibling create_firewall_policy by saying zone-based policies should use that tool. This is a specific, well-scoped purpose statement.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit usage guidance: use create_firewall_policy for Network 9+ zone-based policies, and review existing rules with get_firewall_rules first. This tells the agent both when to use this tool and when to prefer an alternative, which is exactly what usage guidance should do.

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