Skip to main content
Glama

trim_media

Cut a specific segment from a video or audio file using start and optional end or duration. Uses stream copy by default or re-encoding for accurate keyframe cuts.

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.

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
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. 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+)?)$"
  2. 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')."
  3. First observedv0.1.0

TDQS

A3.5/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 burden. It usefully discloses the default stream-copy behavior versus re-encoding, but does not mention whether output files are overwritten, whether the source is preserved, permission requirements, or error behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core action and immediately followed by the key processing-mode distinction. No wasted wording.

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?

The description covers the core operation and default encoding behavior, which is adequate for a simple trim tool with rich schema coverage. However, without annotations or an output schema, it should say more about output handling, overwrite behavior, or return values.

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 coverage is 100%, so the schema already documents all six parameters. The description only restates the accurateReencode behavior already present in the schema and adds no extra meaning for startTime, endTime, duration, or paths.

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: 'Cut a segment from a video or audio file.' It clearly identifies the operation, though it does not explicitly contrast with sibling tools such as concat_media or extract_audio.

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 provides useful guidance on the accurateReencode trade-off (stream copy by default, re-encode for accurate cuts), but does not state when to choose trim_media over sibling tools or any exclusions/preconditions.

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