Skip to main content
Glama

generate_chord_progression

Create chord progressions by specifying a key and musical style such as pop, jazz, or blues.

Instructions

Generate chord progression

Input Schema

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

Implementation Reference

  • Handler function that executes 'generate_chord_progression'. Validates inputs (root note + chord style), calls MusicTheory.generateChordProgression() to get the progression string, then calls PatternGenerator.generateChords() to produce the Strudel pattern, and finally appends it to the current pattern.
    case 'generate_chord_progression': {
      InputValidator.validateRootNote(args.key);
      InputValidator.validateChordStyle(args.style);
      const progression = ctx.theory.generateChordProgression(args.key, args.style);
      const chordPattern = ctx.generator.generateChords(progression);
      await appendOrSet(chordPattern, ctx);
      return `Generated ${args.style} progression in ${args.key}: ${progression}`;
  • Tool registration with inputSchema — defines 'generate_chord_progression' requiring 'key' (string) and 'style' (string) parameters.
    {
      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'],
      },
    },
  • Module exports: tools array, toolNames set, and execute function are bundled into generateModule, which is imported by server.ts.
    export const generateModule: ToolModule = { tools, toolNames, execute };
  • Core music theory logic: generateChordProgression() maps Roman numeral patterns (from chordProgressions dict) to actual chord names using the given key. Supports styles: pop, jazz, blues, folk, rock, classical, modal, edm.
    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(' ');
    }
    
    /**
     * Calculates a note at a given interval from the root
     * @param root - Root note name
     * @param semitones - Number of semitones to transpose
     * @returns Transposed note name
     */
    getNote(root: string, semitones: number): string {
      const noteNames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
      const rootIndex = noteNames.indexOf(root.toUpperCase());
      if (rootIndex === -1) return root;
      return noteNames[(rootIndex + semitones) % 12];
    }
  • PatternGenerator.generateChords() converts the progression string (e.g., 'C G Am F') into a Strudel pattern code with voicing options (triad, seventh, sustained, stab, pad).
    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}`;
    }
Behavior1/5

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

With no annotations and a bare description, there is no disclosure of behavioral traits such as whether the tool uses AI, constraints on chord patterns, or repeatability of results.

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

Conciseness1/5

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

The description is extremely short but under-specified, not concise. It fails to convey essential information in a structured manner.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the moderate complexity (2 parameters, no output schema), the description is completely inadequate. It lacks any explanation of output format, expected behavior, or usage context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with basic descriptions for key and style, but the tool description adds no additional meaning beyond what the schema already provides. Baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Generate chord progression' is a tautology, restating the tool name without adding any specificity about what type of progression is generated or how it differs from similar tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like generate_bassline or generate_melody, nor any context about prerequisites or typical use cases.

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

Install Server

Other Tools

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/live-coding-music-mcp'

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