Skip to main content
Glama
libsonare-mcp

libsonare-mcp

Official
by libraz

Analyze the harmony of music

theory_analyze
Read-only

Analyze MIDI, project, audio, inline notes, or chord labels to identify key changes, chords, Roman numerals, cadences, phrases, rhythm, and motifs; undetermined readings are reported.

Instructions

Analyses a .mid file, a project file, an audio file, inline notes or chord labels: the key (with runner-up readings), key changes, the chord per segment, Roman numerals, cadences, phrases, a reduced progression, the rhythm and recurring motifs, each with the library's rationale; a reading that cannot be made is reported as undetermined. Audio gives the chord-level aspects only (from its key and chord estimates); for its notes, transcribe it with audio_transcribe first. Positions are quarter notes (_ppq). Not for one chord, scale or interval fact (use theory_lookup) or for rule checks (use theory_check). Example: {"chords": [{"symbol": "C", "start_ppq": 0, "end_ppq": 4}, {"symbol": "G7", "start_ppq": 4, "end_ppq": 8}, {"symbol": "C", "start_ppq": 8, "end_ppq": 12}], "aspects": ["key", "roman", "cadences"]}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "theory_analyze"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoKey to analyze in, e.g. 'C major', 'A minor', 'D dorian'. Omit to detect it.
limitNoMaximum rows per long list (chords, roman, reduction); 1-1000.
chordsNoChord labels [{symbol, start_ppq, end_ppq}] instead of a source, analyzed as a progression; each chord lasts until the next one starts. Give either source or chords.
detailNo'concise' returns the summary and the most useful fields; 'full' returns all.concise
offsetNoIndex of the first row of the long lists (chords, roman, reduction).
sourceNoAn audio file, a .mid file, a project file (.sonare.json) or inline tracks [{name?, program?, channel?, is_drum?, notes: [{pitch, start_ppq, length_ppq, velocity}]}]. Drum notes are ignored. Audio gives chord-level aspects only. Give either source or chords.
aspectsNoWhat to analyze: key, modulations, chords, roman, cadences, phrases, reduction, rhythm, motifs (omitted: key, chords, roman, cadences). modulations, rhythm and motifs need notes.
alternativesNoAlso return runner-up key readings and chord readings.
time_signatureNoTime signature {numerator, denominator}. Omit to read it from the source (the first one of a .mid or project; libcantus assumes 4/4 for inline input).

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 already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description adds real behavioral context beyond that: results carry 'the library's rationale', unmakeable readings are reported as 'undetermined' rather than failing, and audio input degrades to chord-level aspects only. It does not discuss cost, truncation, or error behavior beyond the undetermined case, so it stops short of a 5.

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 verb and accepted input types, then alternatives, then an example — good ordering with no filler sentences. The first sentence is a long colon-delimited list that is dense but every element names a distinct returnable aspect; only minor tightening is possible.

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?

With 9 optional parameters and no output schema, the description must carry the return surface, and it does — enumerating every aspect and the undetermined case. The example, the ppq convention, and the audio limitation close the remaining gaps an agent would otherwise hit on first invocation.

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 baseline is 3, but the description genuinely extends it: the worked example shows the chords/aspects combination in use, 'Positions are quarter notes (_ppq)' clarifies the unit convention, and the runner-up phrasing ties to the alternatives flag. The source/aspects interplay ('audio gives the chord-level aspects only') is behavior the schema only hints at via a nested description.

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?

Specific verb plus resource ('Analyses ... a .mid file, a project file, an audio file, inline notes or chord labels') and an explicit enumeration of what it returns (key, key changes, chords, Roman numerals, cadences, phrases, reduction, rhythm, motifs). It also names the two siblings it is not (theory_lookup, theory_check), so the agent can separate it from neighbors without opening a 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?

Explicit exclusions with named alternatives: 'Not for one chord, scale or interval fact (use theory_lookup) or for rule checks (use theory_check)'. It also gives a precondition routing rule for the audio path ('for its notes, transcribe it with audio_transcribe first'), which is exactly the when-to-use detail an agent needs.

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