Skip to main content
Glama
williamzujkowski

Strudel MCP Server

generate_pattern

Create music patterns for TidalCycles/Strudel by specifying style, key, and tempo, with optional auto-play functionality.

Instructions

Generate complete pattern from style with optional auto-play

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
styleYesMusic style (techno/house/dnb/ambient/etc)
keyNoMusical key
bpmNoTempo in BPM
auto_playNoStart playback immediately (default: false)

Implementation Reference

  • Defines the input schema and metadata for the 'generate_pattern' MCP tool.
    name: 'generate_pattern',
    description: 'Generate complete pattern from style with optional auto-play',
    inputSchema: {
      type: 'object',
      properties: {
        style: { type: 'string', description: 'Music style (techno/house/dnb/ambient/etc)' },
        key: { type: 'string', description: 'Musical key' },
        bpm: { type: 'number', description: 'Tempo in BPM' },
        auto_play: { type: 'boolean', description: 'Start playback immediately (default: false)' }
      },
      required: ['style']
    }
  • Executes the generate_pattern tool: validates parameters, delegates generation to PatternGenerator, writes pattern to editor, supports auto-play.
    case 'generate_pattern':
      InputValidator.validateStringLength(args.style, 'style', 100, false);
      if (args.key) {
        InputValidator.validateRootNote(args.key);
      }
      if (args.bpm !== undefined) {
        InputValidator.validateBPM(args.bpm);
      }
      const generated = this.generator.generateCompletePattern(
        args.style,
        args.key || 'C',
        args.bpm || 120
      );
      await this.writePatternSafe(generated);
    
      // Auto-play if requested - Issue #38
      if (args.auto_play && this.isInitialized) {
        await this.controller.play();
        return `Generated ${args.style} pattern. Playing.`;
      }
    
      return `Generated ${args.style} pattern`;
  • Generates the full Strudel pattern code by composing drums, bassline, chords, and melody tailored to the music style, key, and BPM.
      generateCompletePattern(style: string, key: string = 'C', bpm: number = 120): string {
        const drums = this.generateDrumPattern(style, 0.7);
        const bass = this.generateBassline(key, style);
        const scale = this.theory.generateScale(key, style === 'jazz' ? 'dorian' : 'minor');
        const melody = this.generateMelody(scale);
        
        const chordStyle = style === 'jazz' ? 'jazz' : 
                          style === 'house' ? 'pop' : 
                          style === 'techno' ? 'edm' : 'pop';
        const progression = this.theory.generateChordProgression(key, chordStyle as any);
        const chords = this.generateChords(progression, style === 'ambient' ? 'pad' : 'stab');
        
        return `// ${style} pattern in ${key} at ${bpm} BPM
    setcpm(${bpm})
    
    stack(
      // Drums
      ${drums},
      
      // Bass
      ${bass},
      
      // Chords
      ${chords}.gain(0.6),
      
      // Melody
      ${melody}.struct("~ 1 ~ 1 1 ~ 1 ~").delay(0.25).room(0.3).gain(0.5)
    ).gain(0.8)`;
      }
  • Registers all tools including generate_pattern via ListToolsRequestSchema handler that returns the tools list from getTools().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: this.getTools()
    }));
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'optional auto-play' which implies a playback behavior, but doesn't explain what 'generate complete pattern' entails—whether it creates a new pattern in memory, saves it, overwrites existing data, or requires specific permissions. For a generation tool with zero annotation coverage, this leaves significant gaps in understanding its effects and constraints.

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

Conciseness5/5

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

The description is extremely concise—a single sentence that front-loads the core action ('Generate complete pattern') and includes key optional feature ('with optional auto-play'). Every word earns its place with no redundancy or fluff, making it efficient and easy to parse.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output format. Without annotations or output schema, the agent must infer behavior from the description alone, which is insufficient for full understanding but meets a bare minimum.

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 description coverage is 100%, so the schema already documents all parameters (style, key, bpm, auto_play) with descriptions. The description adds minimal value beyond the schema by implying that 'style' is the primary input and 'auto_play' is optional, but doesn't provide additional context like default behaviors for unspecified parameters or interaction effects. Baseline 3 is appropriate when the schema handles most documentation.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Generate complete pattern from style with optional auto-play'. It specifies the verb ('generate'), resource ('complete pattern'), and key parameter ('style'), distinguishing it from siblings like 'generate_bassline' or 'generate_melody' that produce specific components rather than a full pattern. However, it doesn't explicitly differentiate from 'compose' or other pattern-related tools, keeping it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools like 'generate_bassline', 'generate_melody', and 'compose', there's no indication of whether this is for initial pattern creation, how it relates to other generation tools, or any prerequisites. The mention of 'optional auto-play' hints at a playback feature but doesn't clarify usage context.

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/strudel-mcp-server'

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