Skip to main content
Glama

unifi_block_ip

DestructiveIdempotent

Block an IPv4 address or CIDR in both inbound and outbound directions on a UniFi network. Adds traffic matching rules so external and internal traffic to or from that address is denied.

Instructions

Block an IPv4 address or CIDR in both directions: adds it to the IPv4 traffic matching list "unifi-mcp blocklist", which "unifi-mcp blocklist inbound" (External → Internal) and "unifi-mcp blocklist outbound" (Internal → External) BLOCK. The first call creates whichever of the three is missing and needs confirm: true once (it previews the creates). After that a block is easy, unless it overlaps a protected network's subnet (UNIFI_MCP_PROTECTED_NETWORKS, pi-cluster by default) or is a wide range (a prefix shorter than /16); those need confirm. An address already listed (x and x/32 are one address) is a no-op.

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": {
      "ip": "<ip>"
    },
    "name": "unifi_block_ip"
  }
}

Input Schema

NameRequiredDescriptionDefault
ipYesIPv4 address or CIDR
siteNoSite name, id or reference; optional while the console has a single site
reasonNoWhy (echoed back; traffic matching lists have no place to keep it)
confirmNoMust be true to carry out a guarded change; without it the tool only previews it

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 well past the annotations (destructiveHint=true, idempotentHint=true): it discloses the exact side effects (creation of three named objects), the preview-then-apply flow for guarded changes, the protected-network guard, the wide-prefix guard, and the x == x/32 equivalence that makes repeat calls no-ops. It also warns that traffic matching lists cannot retain the reason. This is the kind of context the annotations cannot carry.

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 with the core action, then layered guards and no-op behavior in a logical order; no sentence is filler. The nested quoting of list names is slightly clunky and slows scanning, but the density is justified by genuinely non-obvious mechanics.

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 destructive, no-output-schema mutation tool the description covers side effects, required confirmation, idempotency, and refusal conditions well enough to call it safely. It omits what the preview response looks like and how to reverse the block (the unblock_ip sibling), which are the only notable gaps.

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?

Schema coverage is 100%, so the baseline is 3; the description adds real meaning by explaining what confirm actually gates (preview vs. execution for creates, protected subnets, and short prefixes) and by clarifying that an address and its /32 form are treated as one entry. It doesn't elaborate on the site or reason parameters beyond the schema text.

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?

States a specific verb and resource up front: "Block an IPv4 address or CIDR in both directions," then names the exact mechanism (the "unifi-mcp blocklist" traffic matching list plus inbound/outbound rules). It doesn't explicitly differentiate itself from the sibling unifi_block_client (blocking by client vs. by address), so an agent must infer that distinction.

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?

Gives concrete conditional guidance: the first call needs confirm: true because it previews list creation, subsequent blocks need it only for protected subnets (UNIFI_MCP_PROTECTED_NETWORKS, pi-cluster default) or prefixes shorter than /16, and already-listed addresses are a no-op. It never routes the agent to alternatives such as unblock_ip or block_client, leaving that comparison implicit.

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