Skip to main content
Glama
owine

UniFi Protect MCP

by owine

Subscribe events

protect_subscribe_events
Read-only

Capture real-time event messages from UniFi Protect devices by listening to the event WebSocket for a set duration, returning structured data for monitoring and automation.

Instructions

Connect to the Protect event WebSocket and collect messages for a specified duration (1-30s). Returns {messages, duration, error?, truncated?}; stops early with truncated=true after 200 messages or 100,000 characters of JSON, whichever comes first. A connection that fails before any message arrives returns an error. Each message is an envelope {type: 'add' | 'update', item: {id, modelKey: 'event', type (event kind, e.g. 'ring'), start, end (epoch ms), device (ID of the camera/sensor that raised it)}} (7.3.70 docs). The full set of event kinds and any further event fields are not documented — inspect the captured messages. Not available over Cloud Connector (api.ui.com).

Input Schema

NameRequiredDescriptionDefault
durationNoSeconds to listen (1-30, default 5)

Output Schema

NameRequiredDescriptionDefault
errorNoConnection error, if any
durationNoSeconds actually spent listening, to 0.1s (number); shorter than requested when the message cap or an error ends the listen early
messagesNoCaptured WebSocket messages (add/update/remove or event envelopes)
truncatedNotrue when listening stopped early at the message cap (boolean, absent otherwise)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv2.15.0
    • changedOutput schema / additionalProperties
      Previous value: -falseNew value: +{}
    • changedOutput schema / properties / duration / description
      Previous value: -"Actual listen duration in seconds (number)"New value: +"Seconds actually spent listening, to 0.1s (number); shorter than requested when the message cap or an error ends the listen early"
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "true when listening stopped early at the message cap (boolean, absent otherwise)"
      +}
  2. Changed2 schema fields changedv2.11.5
    • removedOutput schema / properties / error / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / error / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  3. First observedv2.7.4

TDQS

A4.1/5.0
Behavior5/5

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

Goes well beyond the readOnly/openWorld annotations by disclosing truncation caps (200 messages or 100,000 chars), the early-stop behavior with truncated=true, the error-on-no-message failure mode, the exact return shape, and a known documentation gap for event kinds. These are behavioral traits the annotations cannot express.

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 and return contract, then progressively layers truncation, error, message shape, and availability. Dense but every clause carries operational information; no filler sentences.

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?

Even though an output schema exists, the description fully covers boundaries, failure modes, payload structure, and deployment constraints. An agent has everything needed to invoke it correctly and interpret the result without further inspection.

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% and the description repeats the 1-30s bound, but it adds real meaning by tying duration to the truncation caps — clarifying that listening may end early before duration elapses. That interplay is not derivable from the numeric bound alone, so it edges above the baseline 3.

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: connect to the Protect event WebSocket and collect messages, with the envelope explicitly defining the payload as modelKey 'event'. The 'events' scope distinguishes it from the many list/get siblings, but it never names protect_subscribe_devices, the closest alternative, so differentiation must be inferred.

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?

Usage context is implied by the WebSocket/events framing and the Cloud Connector exclusion ('Not available over Cloud Connector'), which is genuinely useful routing information. However there is no explicit 'use this instead of protect_subscribe_devices when...' guidance, so the agent must infer when this is preferred over the sibling subscription tool.

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