generate_scale
Generate musical scale notes by specifying a root note and scale type for music creation and pattern development.
Instructions
Generate scale notes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | Yes | Root note | |
| scale | Yes | Scale type |
Implementation Reference
- Handler executes the generate_scale tool: validates root note and scale name, calls MusicTheory.generateScale, formats and returns the scale notes.case 'generate_scale': InputValidator.validateRootNote(args.root); InputValidator.validateScaleName(args.scale); const scaleNotes = this.theory.generateScale(args.root, args.scale); return `${args.root} ${args.scale} scale: ${scaleNotes.join(', ')}`;
- src/server/EnhancedMCPServerFixed.ts:444-455 (registration)Tool registration in getTools(): defines name, description, and input schema for generate_scale.{ name: 'generate_scale', description: 'Generate scale notes', inputSchema: { type: 'object', properties: { root: { type: 'string', description: 'Root note' }, scale: { type: 'string', description: 'Scale type' } }, required: ['root', 'scale'] } },
- src/services/MusicTheory.ts:37-53 (helper)Core helper function in MusicTheory class: generates scale notes from root and scale intervals using modulo 12 transposition.generateScale(root: string, scaleName: keyof typeof this.scales): string[] { const noteNames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']; const rootIndex = noteNames.indexOf(root.toUpperCase()); if (rootIndex === -1) { throw new Error(`Invalid root note: ${root}`); } const scale = this.scales[scaleName]; if (!scale) { throw new Error(`Invalid scale: ${scaleName}`); } return scale.map(interval => { const noteIndex = (rootIndex + interval) % 12; return noteNames[noteIndex]; }); }