Skip to main content
Glama

generate_chord_progression

Create chord progressions for music composition by specifying a key and style like pop, jazz, or blues.

Instructions

Generate chord progression

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey
styleYesStyle (pop/jazz/blues/etc)

Implementation Reference

  • Handler executes validation, generates progression using MusicTheory, creates Strudel chord pattern using PatternGenerator, writes to editor, and returns summary.
    case 'generate_chord_progression': InputValidator.validateRootNote(args.key); InputValidator.validateChordStyle(args.style); const progression = this.theory.generateChordProgression(args.key, args.style); const chordPattern = this.generator.generateChords(progression); const currentChords = await this.getCurrentPatternSafe(); const newChordPattern = currentChords ? currentChords + '\n' + chordPattern : chordPattern; await this.writePatternSafe(newChordPattern); return `Generated ${args.style} progression in ${args.key}: ${progression}`;
  • Tool registration in getTools() array, including name, description, and input schema.
    { name: 'generate_chord_progression', description: 'Generate chord progression', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Key' }, style: { type: 'string', description: 'Style (pop/jazz/blues/etc)' } }, required: ['key', 'style'] } },
  • Core method generates chord progression string from key and style using predefined progressions and chord mappings.
    generateChordProgression(key: string, style: keyof typeof this.chordProgressions): string { const progression = this.chordProgressions[style]; if (!progression) { throw new Error(`Invalid progression style: ${style}`); } const chordMap: Record<string, string> = { 'I': `"${key}"`, 'I7': `"${key}7"`, 'i': `"${key.toLowerCase()}m"`, 'ii': `"${this.getNote(key, 2)}m"`, 'IIM7': `"${this.getNote(key, 2)}m7"`, 'iii': `"${this.getNote(key, 4)}m"`, 'III': `"${this.getNote(key, 4)}"`, 'IV': `"${this.getNote(key, 5)}"`, 'IV7': `"${this.getNote(key, 5)}7"`, 'V': `"${this.getNote(key, 7)}"`, 'V7': `"${this.getNote(key, 7)}7"`, 'vi': `"${this.getNote(key, 9)}m"`, 'VI': `"${this.getNote(key, 9)}"`, 'VII': `"${this.getNote(key, 11)}"`, 'bVII': `"${this.getNote(key, 10)}"`, 'IM7': `"${key}maj7"` }; return progression .map(chord => chordMap[chord] || `"${key}"`) .join(' '); }
  • Helper converts chord progression string to Strudel pattern code with voicing options.
    generateChords(progression: string, voicing: string = 'triad'): string { const voicings: Record<string, string> = { triad: '.struct("1 ~ ~ ~")', seventh: '.struct("1 ~ ~ ~").add(note("7"))', sustained: '.attack(0.5).release(2)', stab: '.struct("1 ~ 1 ~").release(0.1)', pad: '.attack(2).release(4).room(0.8)' }; return `note(${progression}).s("sawtooth")${voicings[voicing] || voicings.triad}`; }
  • Input schema defines required parameters key and style as strings.
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Key' }, style: { type: 'string', description: 'Style (pop/jazz/blues/etc)' } }, required: ['key', 'style'] }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/williamzujkowski/strudel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server