Skip to main content
Glama

trim_media

Cut a segment from a video or audio file by start and end time, using stream copy by default or re-encoding for accurate cuts. Preview the planned FFmpeg command before writing.

Instructions

Cut a segment from a video or audio file. Uses stream copy without re-encoding by default, or re-encodes when accurate cuts are needed. Supports dryRun plan inspection and post-flight verification.

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": {
      "inputPath": "<inputPath>",
      "outputPath": "<outputPath>",
      "startTime": "<startTime>"
    },
    "name": "trim_media"
  }
}

Input Schema

NameRequiredDescriptionDefault
dryRunNoPlan-before-encode: returns planned FFmpeg command, parameters, and target output without writing files.
endTimeNoOptional end timestamp formatted as 'HH:MM:SS' or seconds. Do not combine with duration.
durationNoOptional duration in seconds from startTime (e.g. '30'). If neither endTime nor duration is set, trims to end of file.
inputPathYesPath to the source media file to cut.
startTimeYesStart timestamp formatted as 'HH:MM:SS' (e.g. '00:01:30') or seconds (e.g. '90').
outputPathYesDestination path for the trimmed output file (e.g. './clip.mp4').
accurateReencodeNoRe-encode video for cuts between keyframes. Default: false (uses fast stream copy).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.1
    • addedInput schema / properties / dryRun
      Added value: +{
      +  "description": "Plan-before-encode: returns planned FFmpeg command, parameters, and target output without writing files.",
      +  "type": "boolean"
      +}
  2. Changed3 schema fields changedv0.5.1
    • addedInput schema / properties / duration / pattern
      Added value: +"^(\\d+(\\.\\d+)?)$"
    • addedInput schema / properties / endTime / pattern
      Added value: +"^((\\d{1,2}:)?\\d{1,2}:\\d{1,2}(\\.\\d+)?|\\d+(\\.\\d+)?)$"
    • addedInput schema / properties / startTime / pattern
      Added value: +"^((\\d{1,2}:)?\\d{1,2}:\\d{1,2}(\\.\\d+)?|\\d+(\\.\\d+)?)$"
  3. Changed6 schema fields changedv0.4.2
    • changedInput schema / properties / accurateReencode / description
      Previous value: -"If true, re-encodes video for frame-accurate cuts. If false (default), uses instantaneous lossless stream copy."New value: +"Re-encode video for cuts between keyframes. Default: false (uses fast stream copy)."
    • changedInput schema / properties / duration / description
      Previous value: -"Duration to cut from startTime, e.g. '30' (seconds)"New value: +"Optional duration in seconds from startTime (e.g. '30'). If neither endTime nor duration is set, trims to end of file."
    • changedInput schema / properties / endTime / description
      Previous value: -"End time timestamp, e.g. '00:02:15' or '135'"New value: +"Optional end timestamp formatted as 'HH:MM:SS' or seconds. Do not combine with duration."
    • changedInput schema / properties / inputPath / description
      Previous value: -"Path to the input media file"New value: +"Path to the source media file to cut."
    • changedInput schema / properties / outputPath / description
      Previous value: -"Destination file path for the trimmed clip"New value: +"Destination path for the trimmed output file (e.g. './clip.mp4')."
    • changedInput schema / properties / startTime / description
      Previous value: -"Start time timestamp, e.g. '00:01:30' or '90' (in seconds)"New value: +"Start timestamp formatted as 'HH:MM:SS' (e.g. '00:01:30') or seconds (e.g. '90')."
  4. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the default stream-copy behavior versus re-encoding and mentions dryRun planning and post-flight verification, but it omits overwrite behavior, error handling, and what post-flight verification actually returns or checks.

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 description is short and front-loaded: purpose first, then encoding behavior, then dryRun and verification. The only slight weakness is the vague phrase 'post-flight verification,' which is not explained.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a seven-parameter media mutation tool with no annotations and no output schema, the description covers the main purpose and mode behavior but leaves gaps around file overwrite behavior, failure modes, and how the verification result is surfaced. It is adequate but not complete.

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%, so the schema already documents all seven parameters thoroughly. The description adds some meaning by explaining the default fast stream-copy mode and when re-encoding is useful, but it does not add syntax or constraints beyond the schema.

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 states a specific verb and resource: cutting a segment from a video or audio file. It is clear what the tool does, but it does not explicitly distinguish this general trimming tool from a sibling such as trim_silence.

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?

It implies use for arbitrary segment cuts and gives mode-selection context: stream copy by default, re-encode when accurate cuts are needed. However, it never names an alternative tool or states when another sibling should be used instead.

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