Skip to main content
Glama

multi-synth-execute

Execute multiple SuperCollider synth definitions simultaneously to create layered audio compositions or test sound combinations.

Instructions

複数のSynthDefを同時に実行します。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
synthsYes再生するシンセのリスト
durationNo再生時間(ミリ秒)。デフォルトは10000(10秒)

Implementation Reference

  • The main handler function for the 'multi-synth-execute' tool. It initializes the SuperCollider server, loads and plays multiple synths concurrently using Promise.all on loadAndPlaySynth, waits for the specified duration, cleans up the server, and returns a structured response with playback details or handles errors.
    async (
      { synths, duration = 10000 }:
        {
          synths: { name: string, code: string }[],
          duration?: number
        }
    ) => {
      try {
        const scServer = await initServer();
        const synthPromises = [];
    
        for (const synth of synths) {
          synthPromises.push(loadAndPlaySynth(scServer, synth.name, synth.code));
        }
    
        const loadedSynths = await Promise.all(synthPromises);
    
        console.error(`${synths.length}個のシンセを${duration / 1000}秒間演奏中...`);
        await new Promise(resolve => setTimeout(resolve, duration));
    
        await cleanupServer();
    
        console.error('複数シンセの演奏完了');
    
        return {
          content: [
            {
              type: "text",
              text: `${synths.length}個のシンセを同時に再生しました。`,
            },
            {
              type: "text",
              text: `再生したシンセ: ${synths.map(s => s.name).join(', ')}`,
            },
            {
              type: "text",
              text: `合計再生時間: ${duration / 1000}秒`,
            }
          ],
        };
      } catch (error) {
        console.error("複数シンセ実行エラー:", error);
        return {
          content: [
            {
              type: "text",
              text: `エラーが発生しました: ${error instanceof Error ? error.message : JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
            }
          ],
        };
      }
    }
  • Zod schema for the tool input parameters: an array of synth objects (each with name and code strings) and an optional duration in milliseconds (default 10000).
    {
      synths: z.array(
        z.object({
          name: z.string().describe("シンセの名前"),
          code: z.string().describe("シンセのコード")
        })
      ).describe("再生するシンセのリスト"),
      duration: z.number().optional().describe("再生時間(ミリ秒)。デフォルトは10000(10秒)")
    },
  • src/index.ts:143-207 (registration)
    Registration of the 'multi-synth-execute' tool on the MCP server, specifying the tool name, description, input schema, and handler function.
    server.tool(
      "multi-synth-execute",
      "複数のSynthDefを同時に実行します。",
      {
        synths: z.array(
          z.object({
            name: z.string().describe("シンセの名前"),
            code: z.string().describe("シンセのコード")
          })
        ).describe("再生するシンセのリスト"),
        duration: z.number().optional().describe("再生時間(ミリ秒)。デフォルトは10000(10秒)")
      },
      async (
        { synths, duration = 10000 }:
          {
            synths: { name: string, code: string }[],
            duration?: number
          }
      ) => {
        try {
          const scServer = await initServer();
          const synthPromises = [];
    
          for (const synth of synths) {
            synthPromises.push(loadAndPlaySynth(scServer, synth.name, synth.code));
          }
    
          const loadedSynths = await Promise.all(synthPromises);
    
          console.error(`${synths.length}個のシンセを${duration / 1000}秒間演奏中...`);
          await new Promise(resolve => setTimeout(resolve, duration));
    
          await cleanupServer();
    
          console.error('複数シンセの演奏完了');
    
          return {
            content: [
              {
                type: "text",
                text: `${synths.length}個のシンセを同時に再生しました。`,
              },
              {
                type: "text",
                text: `再生したシンセ: ${synths.map(s => s.name).join(', ')}`,
              },
              {
                type: "text",
                text: `合計再生時間: ${duration / 1000}秒`,
              }
            ],
          };
        } catch (error) {
          console.error("複数シンセ実行エラー:", error);
          return {
            content: [
              {
                type: "text",
                text: `エラーが発生しました: ${error instanceof Error ? error.message : JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
              }
            ],
          };
        }
      }
    );
  • Helper function used by the handler to load a SynthDef by name and code, create a synth instance from it, track it in activeSynths, and return the synth.
    async function loadAndPlaySynth(scServer: SCServer, synthName: string, synthCode: string): Promise<any> {
      const def = await scServer.synthDef(synthName, synthCode);
      const synth = await scServer.synth(def);
      activeSynths.push(synth);
      return synth;
    }
  • Helper function to initialize and boot the SuperCollider server lazily, ensuring only one instance, used by the handler.
    async function initServer(): Promise<SCServer> {
      if (serverInitPromise) {
        return serverInitPromise;
      }
    
      serverInitPromise = (async () => {
        try {
          console.error("SuperColliderサーバーを起動中...");
          const server = await (sc as any).server.boot({
            debug: false,
            echo: false,
            stderr: './supercollider-error.log'
          }) as SCServer;
    
          console.error("SuperColliderサーバー起動完了");
          scServerInstance = server;
          return server;
        } catch (err) {
          console.error("SuperColliderサーバー起動エラー:", err);
          serverInitPromise = null;
          throw err;
        }
      })();
    
      return serverInitPromise!;
    }
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 states the tool executes multiple SynthDefs simultaneously but does not cover critical aspects like whether this is a read-only or destructive operation, error handling, concurrency limits, or what happens after execution (e.g., resource cleanup). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence in Japanese that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to understand quickly. There is no wasted text, and it fits well within a concise format.

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 the tool involves executing multiple audio synthesis definitions (a potentially complex operation), no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, error handling), output expectations, or performance implications. For a tool with these contextual factors, more completeness is needed to guide effective use.

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 clear descriptions for both parameters ('synths' as a list of synths to play and 'duration' as playback time in milliseconds with a default). The description does not add meaning beyond the schema, such as explaining interactions between parameters or usage examples. With high schema coverage, the baseline score of 3 is appropriate as the schema adequately documents parameters without extra value from the description.

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 action ('複数のSynthDefを同時に実行します' translates to 'Execute multiple SynthDefs simultaneously') and identifies the resource (SynthDefs). It distinguishes from the sibling tool 'synth-execute' by specifying 'multiple' execution, though not explicitly contrasting with the sibling's likely single execution. The purpose is specific but could be more explicit about the 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, such as the sibling 'synth-execute'. It does not mention prerequisites, exclusions, or contextual factors like performance considerations for multiple executions. Usage is implied only by the tool name and description, lacking explicit when/when-not instructions.

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/Synohara/supercollider-mcp'

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