Skip to main content
Glama

create_traffic_rule

Create a UniFi traffic rule to block, throttle, or route by application/IP group. Specify action, matching target, and target devices for QoS or security policies.

Instructions

Create a traffic matching rule (QoS, block, or route by application/IP group).

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

  • action: 'BLOCK'|'THROTTLE_RATE'|'QUEUE'

  • matching_target: 'INTERNET'|'LOCAL'|'ALL' or a traffic matching list ID

  • target_devices: the devices/networks the rule applies to (required by the API; previously undocumented) Optional (NOT required by the API): description (str), enabled (bool, controller defaults it), matching_target_type ('INTERNET'|'DOMAIN'|'IP_GROUP'|'APPLICATION_GROUP'), bandwidth_limit (dict with up_limit_kbps/down_limit_kbps for THROTTLE_RATE). Note: uses the Classic REST v2 API (/v2/api/site/{siteId}/trafficrules). May not exist on firmware 10.2.105 and below.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
siteYes
payloadYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Install Server

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses significant behavioral details: local validation raises ValueError, live controller verification, target_devices is required by the API though previously undocumented, and a firmware version limitation. These go beyond the basic create semantics and help an agent anticipate errors and compatibility issues.

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?

The description is relatively long but every sentence carries unique information: purpose, parameter formats, required/optional fields, validation behavior, API endpoint, and compatibility note. The section is well-organized with bullet-like separations, making it scannable despite its length.

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?

Given the tool's complexity (nested payload, many optional fields, validation behavior, firmware constraints), the description covers the essential knowledge needed to call it correctly. An output schema exists, so return values need not be described. Missing details like permission requirements or whether the rule is appended or replaces existing rules are minor given the richness present.

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?

Schema description coverage is 0%, so the description must fully explain parameters. It does: host (name/ID/composite ID), site (name/ID), and payload with a breakdown of required fields (action, matching_target, target_devices) and optional fields (description, enabled, matching_target_type, bandwidth_limit) including specific formats and API expectations. This completely compensates for the empty 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 precise verb-object pair: 'Create a traffic matching rule' and specifies the rule types (QoS, block, or route by application/IP group). This clearly distinguishes the tool from siblings like create_traffic_route or create_firewall_policy by focusing on traffic-matching rules.

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

Usage Guidelines3/5

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

The description provides context on when the tool is applicable by noting that it uses the Classic REST v2 API and may not exist on firmware 10.2.105 and below. However, it does not explicitly state when to prefer this tool over alternatives like update_traffic_rule or delete_traffic_rule, nor does it mention prerequisites beyond providing host/site/payload.

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