Skip to main content
Glama
BradA1878
by BradA1878

sc_play_pattern

Generate rhythmic patterns and musical sequences by defining note events with timing parameters to create melodies, beats, and phrases in SuperCollider.

Instructions

Play a rhythmic pattern or sequence of notes. Useful for creating melodies, beats, or musical phrases.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesArray of note events with timing

Implementation Reference

  • Handler that parses the pattern array, constructs a SuperCollider Routine to sequence synth plays with delays, and executes the code on the server.
          case 'sc_play_pattern': {
            const schema = z.object({
              pattern: z.array(
                z.object({
                  synth: z.string(),
                  freq: z.number().optional(),
                  duration: z.number().optional(),
                  delay: z.number().optional(),
                  amp: z.number().optional(),
                })
              ),
            });
            const { pattern } = schema.parse(args);
    
            if (!scServer.getBooted() || !synthDefsLoaded) {
              return {
                content: [{ type: 'text', text: 'Error: SuperCollider server is not running. Call sc_boot first.' }],
                isError: true,
              };
            }
    
            // Build a Routine to play the pattern
            const events = pattern.map((event, i) => {
              const params = Object.entries(event)
                .filter(([key]) => key !== 'synth' && key !== 'delay')
                .map(([key, value]) => `\\${key}, ${value}`)
                .join(', ');
              const delay = event.delay || 0;
              return `${delay}.wait; Synth(\\${event.synth}, [${params}]);`;
            });
    
            const code = `
    Routine({
      ${events.join('\n  ')}
    }).play;
    `;
            await scServer.executeCode(code);
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Playing pattern with ${pattern.length} events`,
                },
              ],
            };
          }
  • src/index.ts:143-166 (registration)
    Tool definition and registration in the tools list, including name, description, and input schema for the pattern array of synth events.
    {
      name: 'sc_play_pattern',
      description: 'Play a rhythmic pattern or sequence of notes. Useful for creating melodies, beats, or musical phrases.',
      inputSchema: {
        type: 'object',
        properties: {
          pattern: {
            type: 'array',
            description: 'Array of note events with timing',
            items: {
              type: 'object',
              properties: {
                synth: { type: 'string' },
                freq: { type: 'number' },
                duration: { type: 'number' },
                delay: { type: 'number' },
                amp: { type: 'number' },
              },
            },
          },
        },
        required: ['pattern'],
      },
    },
  • Zod schema validation inside the handler matching the tool's input schema.
    const schema = z.object({
      pattern: z.array(
        z.object({
          synth: z.string(),
          freq: z.number().optional(),
          duration: z.number().optional(),
          delay: z.number().optional(),
          amp: z.number().optional(),
        })
      ),
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool 'plays' patterns, implying an audio output action, but doesn't disclose critical behavioral traits such as whether playback is immediate or scheduled, if it requires audio resources, what happens on errors, or if it affects other playback (e.g., overlapping with sc_play_synth). This leaves significant gaps for an agent to understand how to invoke it correctly.

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 highly concise and front-loaded, consisting of two sentences that efficiently convey the core purpose and usage context without any wasted words. Every sentence earns its place by adding value, making it easy for an agent to parse quickly.

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 (playing audio patterns), lack of annotations, and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose and usage context but fails to address behavioral aspects like audio output handling, error conditions, or interaction with sibling tools, which are crucial for correct agent invocation in a musical context.

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?

The input schema has 100% description coverage, with the 'pattern' parameter well-documented as an 'array of note events with timing' and detailed sub-properties. The description adds no additional parameter semantics beyond this, so it meets the baseline of 3 by not detracting from the schema's information.

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 with a specific verb ('Play') and resource ('rhythmic pattern or sequence of notes'), and distinguishes it from siblings like sc_play_synth by focusing on patterns rather than single notes. However, it doesn't explicitly differentiate from sc_play_synth_advanced, leaving some ambiguity about sibling relationships.

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

Usage Guidelines3/5

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

The description provides implied usage guidance by stating it's 'useful for creating melodies, beats, or musical phrases,' which suggests when to use it. However, it doesn't explicitly state when to choose this tool over alternatives like sc_play_synth or sc_play_synth_advanced, nor does it mention any exclusions or prerequisites for usage.

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/BradA1878/mcp-wave'

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