Skip to main content
Glama

get_random_unused_voice

Retrieve a random unused voice character from VOICEVOX to assign unique speakers for text-to-speech synthesis.

Instructions

使用されていない音声をランダムに1つ取得

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler implementation for 'get_random_unused_voice' tool. Gets all voices from VoiceVox, filters out voices currently in use, and randomly selects from unused voices (or all voices if all are in use)
    case "get_random_unused_voice": {
      // 利用可能な全音声を取得
      const allVoices = await voicevox.getVoices();
      const voicesInUse = await queue.getVoicesInUse();
      
      // 使用されていない音声を抽出
      const unusedVoices = allVoices.filter(
        (voice) => !voicesInUse.includes(voice.id),
      );
      
      let selectedVoice;
      if (unusedVoices.length > 0) {
        // 未使用の音声からランダムに選択
        const randomIndex = Math.floor(Math.random() * unusedVoices.length);
        selectedVoice = unusedVoices[randomIndex];
      } else {
        // 全ての音声が使用中の場合は、全音声からランダムに選択
        const randomIndex = Math.floor(Math.random() * allVoices.length);
        selectedVoice = allVoices[randomIndex];
      }
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              voice: selectedVoice,
              isUnused: unusedVoices.length > 0,
              totalVoices: allVoices.length,
              unusedCount: unusedVoices.length,
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:122-129 (registration)
    Registration of 'get_random_unused_voice' tool with MCP server, defining tool name, description (in Japanese), and empty input schema
    {
      name: "get_random_unused_voice",
      description: "使用されていない音声をランダムに1つ取得",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Helper function that fetches all available voices from VOICEVOX API by querying /speakers endpoint and flattening speaker styles into voice objects
    async getVoices(): Promise<Voice[]> {
      const response = await fetch(`${this.baseUrl}/speakers`);
      const speakers = await response.json() as any[];
    
      const voices: Voice[] = [];
      for (const speaker of speakers) {
        for (const style of speaker.styles) {
          voices.push({
            character: speaker.name,
            name: style.name,
            id: style.id,
          });
        }
      }
    
      return voices;
  • Helper function that retrieves list of voice IDs currently in use across all processes via shared state
    async getVoicesInUse(): Promise<number[]> {
      // 共有状態から全プロセスの使用中音声を取得
      try {
        return await this.sharedState.getVoicesInUse();
      } catch (error) {
        console.error("Failed to get voices in use:", error);
        // エラー時はローカルのキュー情報のみ返す
        const localVoices: number[] = [];
        if (this.currentTask) {
Behavior3/5

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

The description discloses the random selection behavior and the 'unused' filtering criteria, which adds necessary context. However, with no annotations provided, it fails to clarify critical behavioral traits: whether retrieving a voice marks it as 'used' (state mutation), what happens when no unused voices remain, or the return value structure.

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 12-character Japanese sentence that conveys the complete operation without redundancy or wasted words. Information density is maximized.

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?

While the description covers the core retrieval logic, it lacks necessary completeness given the absence of annotations and output schema. It omits the return value format (voice ID? object? name?) and error conditions (empty pool handling), which are essential for a zero-parameter tool with no schema documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema contains zero parameters, establishing a baseline score of 4. The description appropriately requires no additional parameter clarification given the tool's simple, fixed operation.

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

Purpose5/5

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

The description explicitly states the tool retrieves 'one random unused voice' (使用されていない音声をランダムに1つ取得), providing specific verb (取得/retrieve), resource (音声/voice), and scope constraints (unused, random, single item). It clearly distinguishes from sibling get_voices_in_use by filtering for unused voices rather than active ones.

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 like list_voices (which presumably returns all voices) or get_session_voice. It does not indicate whether this is for initial voice selection, rotation scenarios, or queue management.

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/arrow2nd/vv-mcp'

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