Skip to content

Tools Overview

encoding-music-mcp provides a suite of tools for analyzing MEI files. All tools work with the built-in MEI collection.

Available Tools

Discovery Tools

Tool Purpose Learn More
list_available_mei_files Browse and discover the 46 built-in MEI files Documentation

Metadata Tools

Tool Purpose Learn More
get_mei_metadata Extract title, composer, editors, dates, and copyright info Documentation

Analysis Tools

Tool Purpose Learn More
analyze_key Detect musical key with confidence scores Documentation
get_notes Extract all notes with pitch and octave information Documentation
get_melodic_intervals Analyze melodic intervals within voices Documentation
get_harmonic_intervals Analyze harmonic intervals between voices Documentation
get_melodic_ngrams Find recurring melodic patterns Documentation

Tool Categories

πŸ” Discovery

Tools for exploring the MEI collection:

πŸ“‹ Metadata

Tools for extracting descriptive information:

🎡 Musical Analysis

Tools for analyzing musical content:

  • analyze_key: Key detection using music21
  • Interval Analysis: Comprehensive interval analysis using CRIM Intervals
    • Notes extraction
    • Melodic intervals
    • Harmonic intervals
    • N-gram pattern matching

Tool Design Philosophy

All tools in encoding-music-mcp follow these principles:

1. Direct File Access

Tools read directly from disk with no intermediate caching, ensuring:

  • ⚑ Fast response times
  • πŸ’Ύ Minimal memory usage
  • πŸ”„ Always up-to-date results

2. Structured Output

All tools return structured dictionaries with consistent keys:

{
    "filename": "Bach_BWV_0772.mei",  # Always included
    "key_name": "...",                 # Tool-specific data
    # ...
}

3. Error Handling

Tools provide clear error messages when files don't exist or can't be processed:

FileNotFoundError: Could not load MEI file: nonexistent.mei

4. Dataframe Format

Analysis tools return data in readable tabular format:

  • Rows: Measure and beat positions
  • Columns: Voice parts or analysis dimensions
  • Values: Musical data (notes, intervals, patterns)

Common Parameters

Most tools accept a filename parameter:

filename: str  # Name of the MEI file (e.g., "Bach_BWV_0772.mei")

Analysis tools may accept additional parameters:

n: int  # For ngrams: length of patterns (default: 4)

Using Tools with AI Assistants

Natural Language Queries

Simply ask your AI assistant in natural language:

  • "What MEI files are available?"
  • "Analyze the key of Bach_BWV_0772.mei"
  • "Get melodic 5-grams from Bartok_Mikrokosmos_022.mei"

Direct Tool Invocation

MCP clients can also invoke tools directly:

{
  "tool": "get_mei_metadata",
  "arguments": {
    "filename": "Bach_BWV_0772.mei"
  }
}

Next Steps

  • Browse specific tool documentation using the navigation menu
  • Try the Quick Start guide for examples
  • Explore the MEI Resources available for analysis