Skip to main content
Glama

Detect beats in a file

detect_beats_in_file
Read-onlyIdempotent

Detect rhythmic onsets and estimate tempo in an audio file to return beat times, beat count, and tempo confidence for placing markers or cuts to music.

Instructions

Find rhythmic onsets (beats, hits, transients) in a file's audio by decoding it and picking energy peaks, and estimate the tempo. Returns beat_times in file time (seconds from the start of the file), beat_count, median_beat_interval, tempo_bpm and tempo_confidence (0-1). Use it to cut to music: place markers (add_markers) or cuts (razor_at_times) at the returned times (for a clip at 100 % speed: sequence time = clip start + file time - clip in point). tempo_bpm is null when no steady pulse is found. Works best on music with clear percussion; for speech use detect_silence_in_file instead. 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_beats_in_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
endNoAnalyse up to this file time, in seconds; clamped to the file's length. Must be greater than start. Default: the end of the file.
pathYesAbsolute path of the media file on this computer.
startNoAnalyse from this file time (seconds from the start of the file). Default 0.
max_bpmNoHighest tempo considered for the tempo estimate, in beats per minute; must be above min_bpm. Default 200.
min_bpmNoLowest tempo considered for the tempo estimate, in beats per minute. Default 60.
max_resultsNoMaximum beats to return. When there are more, the result has truncated=true and the total count. Default 2000.
min_spacingNoSmallest time between two reported beats, in seconds; of two closer onsets the stronger wins. Default 0.25 (at most 4 per second). Use 0.4-0.5 to get only main beats.
sensitivityNo0-1. Higher reports weaker onsets too, lower only the strongest hits. Default 0.5.
audio_streamNoWhich audio stream to use, 0-based among the file's audio streams (see probe_media_file). Default 0.
timeout_secondsNoStop ffmpeg and fail with TIMEOUT after this many seconds. Default 600.
include_strengthsNoAlso return beat_strengths: the relative strength (0-1) of each beat, in the same order as beat_times. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds real behavioral context on top: it operates on the file via ffmpeg without Premiere, requires ffmpeg/ffprobe (see check_ffmpeg), fails with FFMPEG_NOT_FOUND, and returns a null tempo_bpm when no steady pulse exists. It does not mention performance characteristics or pagination behavior beyond the schema's max_results/truncated field.

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 purpose and return fields, then usage, then constraints; every clause carries information. It is a single dense paragraph with the time-conversion formula embedded mid-sentence, which makes it slightly harder to scan than a lightly structured version would be.

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 an 11-parameter tool with no output schema, the description enumerates the return fields (beat_times, beat_count, median_beat_interval, tempo_bpm, tempo_confidence) and the truncation behavior, plus dependencies and failure modes. Nothing an agent needs to call it correctly or interpret the result is missing.

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 adds interpretive meaning the schema lacks: all times are file-relative (seconds from the start of the file) and how to convert them to sequence time, plus the meaning of a null tempo_bpm. It does not explain the tuning tradeoffs between sensitivity and min_spacing, which remain schema-only.

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 rhythmic onsets (beats, hits, transients)... and estimate the tempo") and explicitly distinguishes the tool from the speech-oriented sibling detect_silence_in_file. An agent can tell what it produces without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete when-to-use guidance ("Use it to cut to music: place markers (add_markers) or cuts (razor_at_times) at the returned times"), names the downstream siblings, and supplies the conversion formula for sequence time. It also states the exclusion ("for speech use detect_silence_in_file instead") and the scope limit (file on disk with ffmpeg, not the timeline).

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