Skip to main content
Glama
libsonare-mcp

libsonare-mcp

Official
by libraz

Draw MIDI as a piano roll

midi_visualize
Read-only

Draws MIDI files, project tracks, or inline notes as piano-roll PNGs to inspect arrangements, generated parts, or edits, with optional chord strip and file saving.

Instructions

Draws a MIDI file, a project file's MIDI tracks or inline tracks as a piano-roll PNG: notes as rectangles (pitch up, quarter notes right) colored per track and shaded by velocity, bar lines from the time signatures and an optional chord strip. The reply carries the PPQ and pitch ranges drawn, and 'save' keeps the PNG as a file. Use it to look at an arrangement, a generated part or an edit. Do not use it to list exact notes (midi_read), to analyze harmony (theory_analyze) or to draw audio (audio_visualize). Example: {"source": "song.mid", "range": {"start_ppq": 0, "end_ppq": 32}, "track": "bass"}.

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": {
      "source": "<source>"
    },
    "name": "midi_visualize"
  }
}

Input Schema

NameRequiredDescriptionDefault
saveNoAlso write the PNG as a new file in the output directory (path in 'files').
rangeNoDraw only this window ({start_ppq, end_ppq}, quarter notes). Omit for the whole piece; a few bars to a few dozen bars read best.
trackNoDraw only this track: its id (integer from 1) or its unique name. Omit to draw every track.
widthNoImage width in pixels (240-1400, default 1200).
detailNo'concise' returns the summary and the most useful fields; 'full' returns all.concise
heightNoImage height in pixels (160-1400, default 480).
sourceYesA .mid/.midi file, a project file (.sonare.json) or inline tracks [{name?, is_drum?, notes: [{pitch, start_ppq, length_ppq, velocity}]}]. Track ids are the core's (1, 2, ...); inline tracks count from 1.
show_chordsNoDraw a chord strip above the roll, read from the drawn tracks' notes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only supply readOnlyHint=true and openWorldHint=false; the description adds substantial behavior beyond that: the reply carries the PPQ and pitch ranges actually drawn, and 'save' writes the PNG into the output directory with the path reported in 'files'. That file-writing side effect is disclosed rather than hidden, which is exactly what an agent needs to plan around. It stays at 4 rather than 5 because the optional file write sits in mild tension with readOnlyHint and the description never clarifies that 'save' is the only side-effecting path.

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 the purpose, then rendering semantics, return payload, usage routing and a compact example - each sentence does work. The opening sentence is dense with comma-separated clauses (coloring, shading, bar lines, chord strip), which slightly slows comprehension but nothing is redundant.

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?

Eight parameters, one required, no output schema - and the description compensates by stating what the reply contains (PPQ and pitch range drawn) and what 'save' produces. Combined with correct routing to siblings, an agent has everything needed to invoke this correctly on the first try.

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 already 100%, so the baseline is 3, but the description adds real selection guidance the schema lacks: use 'range' for 'a few bars to a few dozen bars', 'track' accepts a core id or a unique name with inline tracks counting from 1, and 'source' accepts .mid/.midi, .sonare.json or inline tracks. The worked example ({"source": "song.mid", "range": {...}, "track": "bass"}) demonstrates the intended combination of parameters.

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 concrete verb and output ('Draws ... as a piano-roll PNG') and then enumerates exactly what is rendered: rectangles for notes, pitch-up/quarter-notes-right orientation, per-track coloring, velocity shading, bar lines and a chord strip. An agent can immediately tell this is a rendering tool, not a data-extraction tool, and the sibling comparison makes the boundary explicit.

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 positive guidance ('look at an arrangement, a generated part or an edit') and names three excluded use cases with the correct alternatives inline: exact notes -> midi_read, harmony -> theory_analyze, audio drawing -> audio_visualize. That is explicit when/when-not/alternative coverage, so nothing is left to inference.

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