Skip to main content
Glama
Dosugamea

Voicevox MCP Server

by Dosugamea

voicevox

Synthesize and playback speech using a text-to-speech engine compatible with VOICEVOX, enabling AI agents to generate natural voice output for applications.

Instructions

VOICEVOXを使用して音声を合成し、ホストコンピュータで再生します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo合成する文章

Implementation Reference

  • The execute method that implements the core voicevox tool logic: creates audio query via VOICEVOX API, synthesizes speech, saves to temporary WAV file, and plays it on the host using platform-specific playback.
    async execute({ text }: VoicevoxInput): Promise<string> {
      try {
        // 音声合成用のクエリを作成
        const queryResponse = await axios.post(
          `${this.VOICEVOX_API_URL}/audio_query`,
          null,
          { params: { text, speaker: this.VOICEVOX_API_SPEAKER_ID } }
        );
    
        // 音声を合成
        const synthesisResponse = await axios.post(
          `${this.VOICEVOX_API_URL}/synthesis`,
          queryResponse.data,
          {
            params: { speaker: this.VOICEVOX_API_SPEAKER_ID },
            responseType: "arraybuffer",
          }
        );
    
        // 音声データを一時ファイルに保存
        fs.writeFileSync(
          this.TEMP_AUDIO_FILE,
          Buffer.from(synthesisResponse.data)
        );
    
        // 音声を再生
        await this.playAudio(this.TEMP_AUDIO_FILE);
    
        return `「${text}」の音声をホストコンピュータで再生しました。話者ID: ${this.VOICEVOX_API_SPEAKER_ID}`;
      } catch (error) {
        console.log(error);
        if (error instanceof Error) {
          throw new Error(`音声合成または再生に失敗しました: ${error.message}`);
        }
        throw new Error("音声合成または再生に失敗しました");
      }
    }
  • Input schema definition using Zod for validation and TypeScript interface for typing the 'text' parameter expected by the voicevox tool.
    interface VoicevoxInput {
      text: string;
    }
    
    class VoicevoxTool extends MCPTool<VoicevoxInput> {
      name = "voicevox";
      description =
        "VOICEVOXを使用して音声を合成し、ホストコンピュータで再生します";
    
      schema = {
        text: {
          type: z.string(),
          description: "合成する文章",
        },
      };
  • Supporting helper method to play the generated audio file using OS-specific commands: VLC on Windows, aplay on Linux.
      private async playAudio(filePath: string): Promise<void> {
        try {
          switch (process.platform) {
            // Windows
            case "win32":
              await execAsync(
                `vlc.exe -I dummy --dummy-quiet ${filePath} vlc://quit`
              );
              break;
            // Linux or Docker
            case "linux":
              await execAsync(`aplay ${filePath}`);
              break;
            // Mac
            case "darwin":
            default:
              throw new Error("サポートされていないOSです");
          }
        } catch (error) {
          throw new Error(`音声の再生に失敗しました: ${error}`);
        }
      }
    }
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. It mentions synthesis and playback but lacks details on behavioral traits like error handling, performance characteristics (e.g., latency), or system requirements (e.g., VOICEVOX installation). This leaves significant gaps for an AI agent.

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

Conciseness4/5

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

The description is a single, efficient sentence that directly states the tool's function. It is appropriately sized and front-loaded, with no unnecessary words, though it could be slightly more structured (e.g., separating synthesis and playback aspects).

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 lack of annotations and output schema, the description is incomplete. It covers the basic purpose but omits critical context such as what the tool returns (e.g., success/failure, audio data), error conditions, or usage limitations, which are essential for a synthesis/playback tool.

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 description does not mention the 'text' parameter at all. However, schema description coverage is 100%, with the parameter documented as '合成する文章' (text to synthesize). Since the schema fully covers the parameter, the baseline score of 3 is appropriate, as the description adds no additional semantic value.

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: 'VOICEVOXを使用して音声を合成し、ホストコンピュータで再生します' (Uses VOICEVOX to synthesize speech and play it on the host computer). It specifies the action (synthesize and play speech) and resource (VOICEVOX), but since there are no sibling tools, it doesn't need to distinguish 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 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 or any contextual prerequisites. It simply states what the tool does without indicating appropriate scenarios or constraints.

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

Related 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/Dosugamea/voicevox-mcp-server'

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