Skip to main content
Glama

Detect black bars in a file

detect_letterbox_in_file
Read-onlyIdempotent

Detects black bars (letterbox or pillarbox) baked into a video file by sampling frames, then returns the picture area, bar sizes, and scale needed to crop or fill the frame.

Instructions

Find black bars (letterbox or pillarbox) baked into a video file by sampling frames spread over the whole file (ffmpeg cropdetect). Returns source size, picture (the area without bars {width, height, x, y} in pixels), bars (bar size in pixels on each side), has_bars, picture_aspect_ratio and scale_percent_to_fill: the clip scale that makes the picture fill the frame. Use it to decide the scale (set_clip_scale) or crop (crop_clip) needed to remove the bars. Fails with FFMPEG_FAILED when every sampled frame is completely black. Works on the file on disk with ffmpeg, not on the timeline; Premiere Pro is not needed. ffmpeg and ffprobe must be installed (see check_ffmpeg), else FFMPEG_NOT_FOUND.

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": {
      "path": "<path>"
    },
    "name": "detect_letterbox_in_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path of the media file on this computer.
samplesNoHow many points spread over the file to sample (6 frames each), 1-20. Default 5. More is safer for footage with dark scenes.
black_thresholdNoLuminance (0-255) up to which a pixel counts as part of a black bar. Default 24.
timeout_secondsNoStop ffmpeg and fail with TIMEOUT after this many seconds. Default 120.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world behavior, and the description still adds real substance: the sampling strategy, the exact failure condition ('FFMPEG_FAILED when every sampled frame is completely black'), the FFMPEG_NOT_FOUND dependency state, and that it operates on disk rather than the timeline. These are failure and environment traits an agent cannot infer from the annotations.

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 purpose and the returned-field inventory are front-loaded, and the trailing sentences cover distinct, useful facts (failure mode, dependencies, on-disk scope) rather than padding. It is dense but slightly run-on, with the return-field list and the remediation advice packed into one long sentence.

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?

There is no output schema, and the description compensates by enumerating every returned field (source, picture with width/height/x/y, bars, has_bars, picture_aspect_ratio, scale_percent_to_fill) in enough detail to interpret the result without a second call. Combined with error states and prerequisites, nothing an agent needs in order to invoke or interpret this tool 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 each parameter (path, samples, black_threshold, timeout_seconds) is already documented with ranges and defaults in the schema. The description adds the rationale that sampling is spread across the whole file, which implicitly supports the 'samples' parameter, but gives no extra guidance on black_threshold or timeout tuning beyond the 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?

States a specific verb and resource ('Find black bars (letterbox or pillarbox) baked into a video file') plus the mechanism (sampling frames over the whole file via ffmpeg cropdetect). It also scopes itself against timeline-based work ('Works on the file on disk with ffmpeg, not on the timeline'), which separates it from editing-model siblings.

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?

Explicitly routes to the follow-up actions: 'Use it to decide the scale (set_clip_scale) or crop (crop_clip) needed to remove the bars.' It also clarifies the operating context (on-disk file, no Premiere Pro required) and the ffmpeg prerequisite with a pointer to check_ffmpeg. It does not state exclusions relative to other detect_* siblings, so it falls short of a full when/when-not statement.

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

Deploy Server

Other Tools