Skip to main content
Glama

UniFi Protect: Export Video

unifi_protect_export_video
Read-only

Export recorded footage from one UniFi Protect camera over a time range to an MP4 file on disk, then receive the saved file path for local use.

Instructions

Export recorded footage from one camera over a time range as an MP4 file on disk. Always writes to a file and returns the path — video is never returned inline. Size grows quickly with the window: expect tens of megabytes per minute at full quality, and the call fails rather than exhausting memory if the export exceeds UNIFI_PROTECT_MAX_DOWNLOAD_BYTES. Footage only exists if the camera was recording at the time, so check the recording mode before concluding that nothing happened. The file starts on the keyframe before start, so it runs a little long at the front: startsAt is when its first frame was recorded, which is what to line exports from several cameras up on. audio gives the sound track's length and sample rate, or null when the export has no sound.

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": {
      "cameraId": "<cameraId>",
      "start": "<start>",
      "end": "<end>"
    },
    "name": "unifi_protect_export_video"
  }
}

Input Schema

NameRequiredDescriptionDefault
endYesEnd of the footage to export. Accepts ISO 8601 ("2026-08-29T22:00:00Z"), a relative expression ("2h ago", "30m", "7d"), or "now". Local times ("1am", "2026-08-30 01:00") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing.
startYesBeginning of the footage to export. Accepts ISO 8601 ("2026-08-29T22:00:00Z"), a relative expression ("2h ago", "30m", "7d"), or "now". Local times ("1am", "2026-08-30 01:00") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing.
channelNoEncoder channel: 0 is the high-quality stream, higher numbers are progressively lower bitrate. Use a higher channel to keep a long export manageable.
cameraIdYesCamera id — the `id` from unifi_protect_list_cameras, a 24-character hex string. Not the camera's name and not its MAC address.
savePathNoAbsolute path to write the MP4 to. Defaults to a timestamped file under UNIFI_PROTECT_SNAPSHOT_DIR. Parent directories are created.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.1.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / end / description
      Previous value: -"End of the footage to export. Accepts ISO 8601 (\"2026-08-29T22:00:00Z\"), a relative expression (\"2h ago\", \"30m\", \"7d\"), or \"now\". Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing."New value: +"End of the footage to export. Accepts ISO 8601 (\"2026-08-29T22:00:00Z\"), a relative expression (\"2h ago\", \"30m\", \"7d\"), or \"now\". Local times (\"1am\", \"2026-08-30 01:00\") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing."
    • changedInput schema / properties / start / description
      Previous value: -"Beginning of the footage to export. Accepts ISO 8601 (\"2026-08-29T22:00:00Z\"), a relative expression (\"2h ago\", \"30m\", \"7d\"), or \"now\". Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing."New value: +"Beginning of the footage to export. Accepts ISO 8601 (\"2026-08-29T22:00:00Z\"), a relative expression (\"2h ago\", \"30m\", \"7d\"), or \"now\". Local times (\"1am\", \"2026-08-30 01:00\") are read in the console's own time zone. Converted to the millisecond epoch the console requires — do not pass Unix seconds, which would silently query 1970 and return nothing."
  2. First observedv0.3.0

TDQS

A4.6/5.0
Behavior5/5

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

Discloses far more than the single readOnlyHint: the tool always writes to disk rather than returning bytes, output size grows to tens of MB per minute, the call FAILS rather than exhausting memory when it exceeds UNIFI_PROTECT_MAX_DOWNLOAD_BYTES, and memory/environment-variable limits are named. It also explains two non-obvious return traits (startsAt is the first recorded frame, backdated to a keyframe; audio is null when there is no sound), which matters because there is no output schema. Minor tension worth noting: readOnlyHint=true while the tool does create a file on disk — the description's explicit disclosure of the write is what saves this, since the annotation plausibly refers to not mutating Protect state.

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 delivery mechanism, then layered: size/limit behavior, recording-mode caveat, keyframe offset, audio. Every sentence carries a distinct operational fact, though the paragraph is dense enough that the keyframe/alignment guidance and the audio note compete for attention and could be split or trimmed.

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 mutation-of-filesystem export tool with no output schema and no annotations beyond readOnlyHint, the description covers everything an agent needs: where output goes, expected size, failure mode and its env-var cap, the recording-mode prerequisite, and the shape of the returned metadata. Nothing essential is left to inference.

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, but the description earns more by explaining semantics the schema does not: the export starts on the keyframe BEFORE `start` so it runs long at the front, and `startsAt` is the field to align multi-camera exports on. It also frames savePath's default behavior and channel's quality/bitrate tradeoff, adding intent rather than restating types.

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?

Opens with a specific verb + resource + scope: export recorded footage from ONE camera over a time range as an MP4 on disk. The second sentence disambiguates the delivery mechanism (file path, never inline video), which no sibling tool does. An agent can distinguish this from unifi_protect_get_camera_snapshot or unifi_protect_get_event_thumbnail without opening a schema.

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 real usage context: 'check the recording mode before concluding that nothing happened' tells the agent how to interpret an empty result, and 'use a higher channel to keep a long export manageable' (echoed in the schema) tells it how to cope with long windows. It stops short of naming an alternative sibling tool for a different need, so it is context-rich but not a full when/when-not/alternative tree.

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