Skip to main content
Glama
williamzujkowski

Strudel MCP Server

generate_euclidean

Create Euclidean rhythms for music patterns by distributing hits across steps. Specify hits, steps, and optional sound to generate rhythmic sequences for Strudel.cc live coding.

Instructions

Generate Euclidean rhythm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hitsYesNumber of hits
stepsYesTotal steps
soundNoSound to use

Implementation Reference

  • MCP tool handler for 'generate_euclidean' that validates inputs, calls PatternGenerator.generateEuclideanPattern, appends to current pattern, writes it, and returns success message.
    case 'generate_euclidean':
      InputValidator.validateEuclidean(args.hits, args.steps);
      if (args.sound) {
        InputValidator.validateStringLength(args.sound, 'sound', 100, false);
      }
      const euclidean = this.generator.generateEuclideanPattern(
        args.hits,
        args.steps,
        args.sound || 'bd'
      );
      const currentEuc = await this.getCurrentPatternSafe();
      const newEucPattern = currentEuc ? currentEuc + '\n' + euclidean : euclidean;
      await this.writePatternSafe(newEucPattern);
      return `Generated Euclidean rhythm (${args.hits}/${args.steps})`;
  • Tool registration in getTools() including name, description, and input schema for validation.
    {
      name: 'generate_euclidean',
      description: 'Generate Euclidean rhythm',
      inputSchema: {
        type: 'object',
        properties: {
          hits: { type: 'number', description: 'Number of hits' },
          steps: { type: 'number', description: 'Total steps' },
          sound: { type: 'string', description: 'Sound to use' }
        },
        required: ['hits', 'steps']
      }
    },
  • Helper method that generates the Strudel pattern code using the Euclidean rhythm from MusicTheory and a specified sound.
    generateEuclideanPattern(hits: number, steps: number, sound: string = "bd"): string {
      const rhythm = this.theory.generateEuclideanRhythm(hits, steps);
      return `s("${sound}").struct("${rhythm}")`;
    }
  • Core Euclidean rhythm algorithm that computes the hit/rest pattern as a string of '1' and '~' using the mathematical distribution.
    generateEuclideanRhythm(hits: number, steps: number): string {
      if (hits > steps) {
        throw new Error('Hits cannot exceed steps');
      }
      
      const pattern: boolean[] = new Array(steps).fill(false);
      const interval = steps / hits;
      
      for (let i = 0; i < hits; i++) {
        const index = Math.floor(i * interval);
        pattern[index] = true;
      }
      
      return pattern.map(hit => hit ? '1' : '~').join(' ');
    }
Behavior1/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. The description 'Generate Euclidean rhythm' provides no information about what the tool actually does beyond the basic action - it doesn't explain what a Euclidean rhythm is, what format the output takes, whether this creates something new or modifies existing content, or any behavioral characteristics like side effects, performance considerations, or error conditions. For a tool with no annotation coverage, this is completely inadequate.

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 at just three words ('Generate Euclidean rhythm'), which is appropriately sized for a simple tool. It's front-loaded with the core action and resource. There's zero waste or unnecessary elaboration - every word earns its place by communicating the essential purpose.

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

Completeness2/5

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

Given that there are no annotations and no output schema, the description is incomplete for understanding how to use this tool effectively. While the purpose is clear, the description doesn't explain what a Euclidean rhythm is, what the output looks like, or how this tool fits within the broader musical pattern generation context provided by the sibling tools. For a generation tool in a musical context with rich sibling functionality, this description leaves too many questions unanswered.

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%, with all three parameters ('hits', 'steps', 'sound') having clear descriptions in the schema. The tool description adds no additional parameter information beyond what's already documented in the schema. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description, which applies here.

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 'Generate Euclidean rhythm' clearly states the verb ('Generate') and resource ('Euclidean rhythm'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'generate_pattern', 'generate_polyrhythm', or 'generate_drums', which all seem to generate different types of rhythmic/musical patterns. The description is specific about what's being generated but lacks sibling differentiation.

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. There are multiple sibling tools that generate patterns (generate_pattern, generate_polyrhythm, generate_drums, generate_bassline, etc.), but the description offers no context about when Euclidean rhythm generation is appropriate versus other pattern generation methods. No prerequisites, exclusions, or alternatives are mentioned.

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