Skip to main content
Glama
owine

UniFi Protect MCP

by owine

Subscribe devices

protect_subscribe_devices
Read-only

Connect to the UniFi Protect device update WebSocket and collect messages for 1-30 seconds to detect state changes or newly adopted devices.

Instructions

Connect to the device update 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, item} where item is a device resource carrying id and modelKey (camera, light, sensor, nvr, …). The 7.3.70 docs show type 'add' with the full device object as item; other message types and whether updates carry only changed fields are not documented — inspect the captured messages. Use to detect device state changes or newly adopted devices. Not available over Cloud Connector (api.ui.com).

Input Schema

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

Output Schema

TableJSON 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?

Beyond the readOnly/destructive/openWorld annotations, the description discloses the truncation limits (200 messages or 100,000 chars), the early-stop flag, the error-on-connect-failure case, the message envelope shape, and even documentation gaps. This is unusually rich behavioral context for a streaming tool.

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 behavior and return shape, and every sentence carries information (return contract, truncation, error mode, message envelope, doc caveat, use, availability). It is dense and long, but little of it is filler.

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 one-parameter WebSocket subscription tool, the description covers the return contract, truncation, error behavior, message format, intended use, and platform availability. Even though an output schema exists, nothing an agent needs to invoke or interpret this call is missing.

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% and there is a single optional parameter. The description's '(1-30s)' merely restates the schema's minimum/maximum/default, adding no syntax or semantic detail beyond what the schema already provides. Baseline 3 applies.

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?

The description gives a precise verb+resource: 'Connect to the device update WebSocket and collect messages for a specified duration', and clarifies scope with 'Use to detect device state changes or newly adopted devices'. It is clearly a streaming/subscription tool, but it never names the obvious sibling protect_subscribe_events, so the agent must infer the distinction from the word 'device'.

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?

It states a concrete use case ('detect device state changes or newly adopted devices') and a hard environment exclusion ('Not available over Cloud Connector (api.ui.com)'). However, it never routes the agent away from polling alternatives such as protect_list_cameras / protect_get_camera, so no explicit alternative is given.

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