Skip to main content
Glama

mcp_opendaw_constrain_note_range

Fix out-of-range MIDI notes by clamping or octave-wrapping them to a specified pitch range, preserving musical relationships for instrument playability.

Instructions

Constrain notes to a pitch range — clamp or octave-wrap out-of-range notes.

After AI generation, transcription, or aggressive transposition, notes can land outside the playable range of an instrument. This tool brings them back inside.

Two modes:

  • "clamp" — notes below min_pitch are set to min_pitch, notes above max_pitch are set to max_pitch. Preserves the note but loses pitch information. Use when exact range matters (e.g. MIDI 0-127 safety).

  • "octave_wrap" — notes are shifted by octaves (±12 semitones) until they fall within [min_pitch, max_pitch]. Preserves pitch class and musical relationship. Use for instrument range constraints (violin, guitar, vocal, flute). If a note can't fit even after wrapping (range < 12 semitones), it's clamped.

Common instrument ranges (MIDI note numbers):

  • Guitar (standard tuning): E2(40) to E6(88)

  • Bass guitar: E1(28) to G4(67)

  • Violin: G3(55) to A7(105)

  • Cello: C2(36) to C6(84)

  • Flute: C4(60) to D7(98)

  • Vocal soprano: C4(60) to A5(81)

  • Vocal bass: E2(40) to E4(64)

unit_index: AU index (-1 = all AUs). track_index: Note track index (-1 = all note tracks on the AU). region_index: Region index (-1 = all regions on the track). min_pitch: Minimum allowed MIDI pitch (0-127, default 0 = no lower bound). max_pitch: Maximum allowed MIDI pitch (0-127, default 127 = no upper bound). mode: "clamp" (hard limit) or "octave_wrap" (shift by octaves to fit).

Returns per-track notes adjusted, clamped count, wrapped count.

Example:

Constrain to guitar range with octave wrapping

constrain_note_range(unit_index=0, track_index=2, min_pitch=40, max_pitch=88, mode="octave_wrap")

Safety clamp to MIDI range

constrain_note_range(mode="clamp", min_pitch=0, max_pitch=127)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoclamp
max_pitchNo
min_pitchNo
unit_indexNo
track_indexNo
region_indexNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses the effect on notes (clamping loses pitch info, wrapping preserves pitch class), the fallback behavior, and the return values (adjusted/clamped/wrapped counts). However, it does not state whether the operation is destructive/in-place or if it can be undone, which is a minor transparency gap for a mutation tool.

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?

The description is long but well-organized with clear sections: introduction, mode explanations, common instrument ranges, parameter list, returns, and examples. Every element adds value and there is no fluff or repetition.

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 tool with 6 parameters, two modes, and no annotations, the description covers all necessary context: what problem it solves, how each mode behaves, parameter semantics, return values, and concrete examples. The added instrument range reference is a thoughtful extra that helps agents choose appropriate min/max values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by explaining every parameter: unit_index, track_index, region_index with '-1 = all' semantics, min/max_pitch with defaults and bounds, and mode values with explanations. This completely covers what the schema lacks.

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?

The description states exactly what the tool does: 'Constrain notes to a pitch range' with two distinct modes (clamp and octave_wrap). It clearly identifies the use case (notes out of playable range after generation/transposition) and distinguishes this from sibling tools like transpose_notes or rotate_notes.

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?

Explicit guidance is given on when to use the tool ('After AI generation, transcription, or aggressive transposition') and when to choose each mode: clamp for exact range safety (e.g., MIDI 0-127), octave_wrap for instrument ranges. The edge case of ranges smaller than 12 semitones is also documented.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ameobius-ai/opendaw-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server