Skip to main content
Glama

compose

Generate and play complete music patterns in one step for genres like techno, house, or ambient. Auto-initializes browser for Strudel.cc live coding with customizable tempo, key, and playback.

Instructions

Generate, write, and play a complete pattern in one step. Auto-initializes browser if needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
styleYesGenre: techno, house, dnb, ambient, trap, jungle, jazz, experimental
tempoNoBPM (default: genre-appropriate)
keyNoMusical key (default: C)
auto_playNoStart playback immediately (default: true)

Implementation Reference

  • Handler for the 'compose' tool: validates inputs, auto-initializes browser if needed, generates complete pattern via PatternGenerator, writes to editor, plays if requested, returns success with preview and metadata.
    case 'compose': InputValidator.validateStringLength(args.style, 'style', 100, false); if (args.key) { InputValidator.validateRootNote(args.key); } if (args.tempo !== undefined) { InputValidator.validateBPM(args.tempo); } // Auto-initialize if needed if (!this.isInitialized) { await this.controller.initialize(); this.isInitialized = true; } // Generate pattern const composedPattern = this.generator.generateCompletePattern( args.style, args.key || 'C', args.tempo || this.getDefaultTempo(args.style) ); // Write pattern await this.controller.writePattern(composedPattern); // Auto-play by default (unless explicitly set to false) const shouldPlay = args.auto_play !== false; if (shouldPlay) { await this.controller.play(); } return { success: true, pattern: composedPattern.substring(0, 200) + (composedPattern.length > 200 ? '...' : ''), metadata: { style: args.style, bpm: args.tempo || this.getDefaultTempo(args.style), key: args.key || 'C' }, status: shouldPlay ? 'playing' : 'ready', message: `Created ${args.style} pattern in ${args.key || 'C'}${shouldPlay ? ' - now playing' : ''}` };
  • Schema definition for 'compose' tool including input parameters: style (required), tempo, key, auto_play.
    { name: 'compose', description: 'Generate, write, and play a complete pattern in one step. Auto-initializes browser if needed.', inputSchema: { type: 'object', properties: { style: { type: 'string', description: 'Genre: techno, house, dnb, ambient, trap, jungle, jazz, experimental' }, tempo: { type: 'number', description: 'BPM (default: genre-appropriate)' }, key: { type: 'string', description: 'Musical key (default: C)' }, auto_play: { type: 'boolean', description: 'Start playback immediately (default: true)' } }, required: ['style'] } }
  • Registration of tool list handler which includes the 'compose' tool via getTools().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: this.getTools() }));

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