Skip to main content
Glama
libsonare-mcp

libsonare-mcp

Official
by libraz

Generate chords, bass, drums or melody

midi_compose
Destructive

Generates deterministic MIDI parts—chords, bass, drums, melody, harmonization, or backing tracks—from a key, length, and seed, optionally matching a song's tempo, meter, key, and chords.

Instructions

Generates music from a key, length and seed: a chord progression, voicings, a bass line, drums, a melody, a motif, a rhythm, a counter-melody to a given melody, chords for a given melody (harmonize), or a ready backing (chords, bass and drums in one file). Writes a .mid; the same arguments and seed always give identical files. Pass 'context' (a song's audio, .mid or project file) to take tempo, meter, key, chords and length from it, so the part fits the song and the file's tempo map equals the song's. Use it for 'make a chord progression', 'add a bass line', 'drum pattern' or a quick accompaniment; Inputs per part: progression {key, style, bars}; bass {chords, style}; drums {style, bars}; counterMelody {melody, chords?}; melody {melody? as the reference}; motif {key, bars, style = contour}; rhythm {time_signature, bars}; harmonize {melody}; voicing {chords, style}; backing {key, style, bars}. Not for changing existing notes (use midi_edit), for analyzing chords (use theory_analyze) or for audio (put the .mid on a project track with project_edit addMidiClip, then project_render). Example: {"part": "bass", "context": "song.sonare.json", "seed": 7}.

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": {
      "part": "<part>"
    },
    "name": "midi_compose"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoKey such as 'C major', 'A minor', 'D dorian'. Default: the context's key, else 'C major' (harmonize infers it from the melody instead).
barsNoLength in bars (1-128). Default: the context's length, else 4. Ignored by bass and voicing (the chords set the length), counterMelody and harmonize (the melody does).
partYesWhat to generate: progression, bass, drums, counterMelody, melody, motif, rhythm, harmonize, voicing, backing. Inputs per part: progression {key, style, bars}; bass {chords, style}; drums {style, bars}; counterMelody {melody, chords?}; melody {melody? as the reference}; motif {key, bars, style = contour}; rhythm {time_signature, bars}; harmonize {melody}; voicing {chords, style}; backing {key, style, bars}.
seedNoRandom seed 0-4294967295; the same arguments and seed give identical files (default 0).
styleNoStyle per part: progression and backing take a progression style (minimal, dance, idol, rock); bass takes root, rootFifth, pop, walking or arpeggio; drums takes standard, funk, shuffle, bossa, trap, halftime, breakbeat, house or synthpop; voicing takes smooth, close, drop2, drop3, shell or rootless; motif takes arch, ascending, descending or wave; counterMelody takes strict or pop; harmonize takes diatonic, secondaryDominant or borrowed (reharmonization). melody and rhythm take none. Defaults: progression minimal, bass root, drums standard, voicing close, backing minimal.
chordsNoChords for bass and voicing (needed there unless the context gives them) and optionally counterMelody.
detailNo'concise' returns the summary and the most useful fields; 'full' returns all.concise
melodyNoMelody for counterMelody and harmonize (required there) and optionally melody (as the reference to derive from): inline tracks, or the path of a .mid or project file. The first non-drum track with notes is used.
outputNoOutput .mid path. Omit to auto-name a file in the output directory.
contextNoAn audio file, a .mid file or a project file (.sonare.json) to take the tempo map, time signature, key, chords and length (bars) from. The written file carries the context's tempo map. Explicit key, chords, tempo_bpm, time_signature and bars win and are listed in derived_from.overridden. A .mid context carries no key or chords; chords from audio or a project need a libsonare that converts seconds to PPQ and reads annotations.
dry_runNoGenerate and report, with the planned path, without writing.
overwriteNoReplace an existing file at 'output' (default false).
tempo_bpmNoConstant tempo in quarter notes per minute, written into the file. Default: the context's tempo map, else 120.
time_signatureNoTime signature. Default: the context's first one, else 4/4. drums accepts only 4/4.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: the output is a written .mid file, results are deterministic for the same arguments and seed, and a supplied context propagates its tempo map while explicit arguments win and are reported in derived_from.overridden. It does not spell out what happens when 'output' already exists (destruction of an existing file) beyond the schema's 'overwrite' flag, which matters given destructiveHint=true.

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

Conciseness3/5

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

Front-loaded with the core purpose and use cases, but the single dense paragraph repeats the part list twice (the prose enumeration and then the per-part input matrix) before reaching the constraints and the example. Trimming the duplicated enumeration would make the important routing sentence ('Not for changing existing notes...') visible sooner.

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 14-parameter generative tool this covers defaults, determinism, context inheritance, part-specific inputs, exclusions, and a concrete call example, with the schema carrying detailed field semantics and enums. The only real gap is that it never describes the return value (no output schema exists), although the 'detail' parameter hints at a summary plus fields.

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 a per-part input matrix (bass takes chords and style, harmonize takes melody, rhythm takes time_signature, etc.) that tells the agent which of the 14 parameters actually apply for a chosen part. That mapping is largely duplicated in the 'part' enum description in the schema, limiting the added value.

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 (generates music as a .mid) and enumerates the ten concrete parts it can produce, so an agent knows exactly what range of output to expect. It also bounds the scope positively ('a ready backing') and negatively ('not for changing existing notes'), which separates it from midi_edit and theory_analyze.

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?

Explicitly names three exclusions with the correct alternative for each: note changes go to midi_edit, chord analysis to theory_analyze, and audio to a project track via project_edit addMidiClip then project_render. It also frames the positive use cases ('make a chord progression', 'add a bass line', 'drum pattern') and explains when to pass 'context' instead of explicit key/tempo.

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