Skip to main content
Glama

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
NameRequiredDescriptionDefault
rootYesRoot note
scaleYesScale 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(', ')}`;
  • 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'] } },
  • 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]; }); }

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