Skip to main content
Glama

snap_midi_notes_to_scale

Fix off-key MIDI notes by snapping them to the nearest pitch in a chosen scale. Select root, mode, and direction to correct wrong notes, leaving in-scale notes untouched.

Instructions

Snap off-key MIDI notes onto a scale (fix a wrong note, force a part into a key).

Notes already in the scale are left alone; each off-scale note moves to the nearest in-scale pitch, and under nearest a tie resolves toward the middle of the selection. A note with no in-scale pitch left inside 0-127 stays put and is counted in skipped.

Args: root: Root pitch class, 0-11 (0=C, 1=C#, 2=D ... 11=B). mode: Scale name: major, minor, harmonic_minor, melodic_minor, dorian, phrygian, lydian, mixolydian, locrian, major_pentatonic, minor_pentatonic, blues, whole_tone, chromatic (aliases: ionian, aeolian, natural_minor). Or a custom list of semitone intervals from the root, each 0-11 (e.g. [0,2,4,7,9]). direction: "nearest" (closest scale tone), "up" or "down" (that way only, skipping a note rather than falling back to the other direction).

Returns: {ok, notes_changed, clamped, skipped, out_of_bounds, notes:[...]}; notes is the post-transform list, with indices re-synced after the sort.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNomajor
rootYes
fieldsNo
channelNo
end_beatNo
directionNonearest
pitch_lowNo
item_indexYes
pitch_highNo
start_beatNo
track_indexYes
return_notesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.7.3

TDQS

A4.2/5.0
Behavior5/5

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

The description goes well beyond the single destructiveHint annotation: it specifies that in-scale notes are preserved, off-scale notes move to the nearest in-scale pitch, ties resolve toward the middle of the selection under 'nearest', and unpitchable notes remain and are counted in skipped. It also documents direction behavior and returned counters.

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 front-loaded with a one-sentence summary followed by algorithm, argument explanations, and return shape. Every section earns its place; the length is justified by the custom-mode and tie-resolution details.

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 12-parameter tool with no output schema, the description provides the algorithm, the returned counters, and the key musical parameters, so a basic call is actionable. It is not fully complete because required target-selection parameters and the filtering/return_notes toggles are undocumented, which could lead an agent to misuse them.

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

Parameters2/5

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

Root, mode, and direction receive rich explanation (root mapping, scale-name list, aliases, custom interval arrays, direction semantics), which is critical because the input schema has 0% description coverage. However, required track_index and item_index are never explained, and the filtering fields, channel, pitch_low/high, start/end_beat, fields, and return_notes are left entirely to the schema's bare names.

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 opening sentence names a concrete transform ('Snap off-key MIDI notes onto a scale') and adds intent ('fix a wrong note, force a part into a key'), so an agent knows exactly what resource is modified and why. This is distinct from sibling quantize/transpose/velocity tools even though it does not name one.

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?

The parenthetical gives two concrete triggers — fixing a wrong note or forcing a part into a key — and the first paragraph further says already-in-scale notes are untouched, so the agent can infer the tool targets off-key passages. It does not explicitly name alternatives or exclusions, but the use context is clear enough for selection.

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