Skip to main content
Glama
williamzujkowski

Strudel MCP Server

generate_polyrhythm

Create complex polyrhythms by combining multiple sound patterns with different rhythmic cycles for experimental music composition.

Instructions

Generate polyrhythm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
soundsYesSounds to use
patternsYesPattern numbers

Implementation Reference

  • Core handler function that implements generate_polyrhythm by stacking individual Euclidean rhythms (using Strudel's .euclid) for each provided sound and pattern length over 16 steps.
    generatePolyrhythm(sounds: string[], patterns: number[]): string {
      if (sounds.length !== patterns.length) {
        throw new Error('Number of sounds must match number of patterns');
      }
      
      const rhythms = sounds.map((sound, i) => {
        return `s("${sound}").euclid(${patterns[i]}, 16)`;
      });
      
      return `stack(\n  ${rhythms.join(',\n  ')}\n)`;
    }
  • MCP tool registration in getTools(), including name, description, and input schema defining sounds (array of strings) and patterns (array of numbers).
      name: 'generate_polyrhythm',
      description: 'Generate polyrhythm',
      inputSchema: {
        type: 'object',
        properties: {
          sounds: { type: 'array', items: { type: 'string' }, description: 'Sounds to use' },
          patterns: { type: 'array', items: { type: 'number' }, description: 'Pattern numbers' }
        },
        required: ['sounds', 'patterns']
      }
    },
  • Input schema for validating tool arguments: arrays of sounds and patterns.
    inputSchema: {
      type: 'object',
      properties: {
        sounds: { type: 'array', items: { type: 'string' }, description: 'Sounds to use' },
        patterns: { type: 'array', items: { type: 'number' }, description: 'Pattern numbers' }
      },
      required: ['sounds', 'patterns']
    }
  • Server-side dispatch handler: validates inputs, calls PatternGenerator.generatePolyrhythm, appends to current pattern, writes to editor, and returns confirmation.
    case 'generate_polyrhythm':
      args.sounds.forEach((sound: string) => {
        InputValidator.validateStringLength(sound, 'sound', 100, false);
      });
      args.patterns.forEach((pattern: number) => {
        InputValidator.validatePositiveInteger(pattern, 'pattern');
      });
      const poly = this.generator.generatePolyrhythm(args.sounds, args.patterns);
      const currentPoly = await this.getCurrentPatternSafe();
      const newPolyPattern = currentPoly ? currentPoly + '\n' + poly : poly;
      await this.writePatternSafe(newPolyPattern);
      return `Generated polyrhythm`;
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Generate polyrhythm' gives no indication of what the tool actually produces (audio output, data structure, visual representation?), whether it's read-only or mutates state, what permissions are needed, or any side effects. This is inadequate for a tool with no annotation coverage.

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

Conciseness2/5

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

While technically concise with just two words, this represents under-specification rather than effective brevity. The description fails to convey essential information that would help an AI agent understand and use the tool correctly. Every sentence should earn its place, but here the single phrase doesn't earn its place by providing meaningful guidance.

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

Completeness1/5

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

Given no annotations, no output schema, and a complex domain with many similar sibling tools, the description is completely inadequate. It doesn't explain what the tool returns, how it differs from other generation tools, or what behavioral characteristics it has. For a music/rhythm generation tool in a rich ecosystem, this minimal description leaves critical gaps.

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 both parameters ('sounds' and 'patterns') having basic descriptions in the schema. The tool description adds no additional parameter information beyond what the schema provides. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose2/5

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

The description 'Generate polyrhythm' is a tautology that merely restates the tool name without elaboration. It doesn't specify what resource is being generated (audio, notation, pattern data?) or how it differs from sibling tools like generate_pattern, generate_euclidean, or generate_drums. The purpose remains vague and indistinguishable from alternatives.

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

Usage Guidelines1/5

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

No guidance is provided about when to use this tool versus alternatives. With multiple rhythm/music generation siblings (generate_pattern, generate_euclidean, generate_drums, generate_bassline, etc.), the description offers no context about appropriate use cases, prerequisites, or distinctions between these tools.

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