Skip to main content
Glama

play_pokemon_cry

Play the authentic cry of any Pokémon by entering its name or ID number. This tool retrieves and plays the official sound file for Pokémon identification and enjoyment.

Instructions

ポケモンの鳴き声を再生(音声ファイルをダウンロードして情報を返す)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pokemonYesポケモン名またはID番号

Implementation Reference

  • The core handler function that fetches Pokemon data, downloads the cry audio file from PokeAPI cries repo, saves to temp file, plays it using platform-specific commands (PowerShell on Windows, afplay on macOS, aplay/paplay on Linux), handles errors, cleans up temp file, and returns play status information.
    private async playPokemonCry(pokemon: string) {
      try {
        const data = await this.fetchPokemonData(pokemon);
    
        // 鳴き声ファイルのURL(PokeAPI/cries リポジトリから)
        const cryUrl = `https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/${data.id}.ogg`;
    
        // 一時ディレクトリとファイル名を作成
        const tempDir = path.join(process.cwd(), 'temp');
        if (!fs.existsSync(tempDir)) {
          fs.mkdirSync(tempDir, { recursive: true });
        }
    
        const fileName = `${data.name}_cry.ogg`;
        const filePath = path.join(tempDir, fileName);
    
        // 音声ファイルをダウンロード
        const response = await axios.get(cryUrl, { responseType: 'stream' });
        const writer = fs.createWriteStream(filePath);
        response.data.pipe(writer);
    
        await new Promise<void>((resolve, reject) => {
          writer.on('finish', () => resolve());
          writer.on('error', reject);
        });
    
        // プラットフォームに応じて音声再生コマンドを選択
        let playCommand: string;
        const platform = process.platform;
    
        if (platform === 'win32') {
          // Windows: PowerShellでメディアプレイヤーを使用
          playCommand = `powershell -c "(New-Object Media.SoundPlayer '${filePath}').PlaySync()"`;
        } else if (platform === 'darwin') {
          // macOS: afplayを使用
          playCommand = `afplay "${filePath}"`;
        } else {
          // Linux: aplayまたはpaplayを使用
          playCommand = `aplay "${filePath}" || paplay "${filePath}"`;
        }
    
        // 音声再生を実行
        try {
          await execAsync(playCommand);
    
          // 再生後にファイルを削除
          fs.unlinkSync(filePath);
    
          const playInfo = {
            name: data.name,
            id: data.id,
            cry_url: cryUrl,
            status: "再生完了",
            platform: platform,
            file_saved_temporarily: filePath
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(playInfo, null, 2)
              }
            ]
          };
        } catch (playError) {
          // 再生エラーの場合でもファイル情報は返す
          const playInfo = {
            name: data.name,
            id: data.id,
            cry_url: cryUrl,
            status: "ダウンロード完了(再生エラー)",
            platform: platform,
            file_saved_at: filePath,
            play_error: playError instanceof Error ? playError.message : String(playError),
            manual_play_instructions: platform === 'win32'
              ? "Windowsメディアプレーヤーまたは対応ソフトでファイルを開いてください"
              : "音声プレーヤーでファイルを開いてください"
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(playInfo, null, 2)
              }
            ]
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `エラー: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema definition for the play_pokemon_cry tool, specifying pokemon as required string input.
    {
      name: "play_pokemon_cry",
      description: "ポケモンの鳴き声を再生(音声ファイルをダウンロードして情報を返す)",
      inputSchema: {
        type: "object",
        properties: {
          pokemon: {
            type: "string",
            description: "ポケモン名またはID番号",
          },
        },
        required: ["pokemon"],
      },
    },
  • src/index.ts:173-175 (registration)
    The dispatch logic in the CallToolRequestSchema handler that routes calls to play_pokemon_cry to the playPokemonCry method.
    } else if (name === "play_pokemon_cry") {
      return await this.playPokemonCry(args.pokemon as string);
    }
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 downloading an audio file and returning information, but lacks details on behavioral traits like whether this requires network access, if it's a read-only operation, potential rate limits, or error handling. The description is minimal and doesn't compensate for the lack of annotations.

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 concise and front-loaded, consisting of a single sentence that directly states the tool's function. There's no wasted text, but it could be slightly more structured by separating the action from the outcome for clarity.

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 complexity (a tool that downloads and plays audio) and lack of annotations and output schema, the description is incomplete. It doesn't explain what information is returned, how the audio is handled, or any prerequisites. For a tool with no structured data beyond the input schema, more context is needed to be fully helpful.

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 parameter 'pokemon' documented as 'ポケモン名またはID番号' (Pokémon name or ID number). The description doesn't add any additional meaning beyond what the schema provides, such as examples or constraints, so it meets the baseline of 3 given the high schema coverage.

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: 'ポケモンの鳴き声を再生' (play Pokémon cry) and adds '音声ファイルをダウンロードして情報を返す' (download audio file and return information). It specifies the action (play/download) and resource (Pokémon cry), but doesn't explicitly differentiate from sibling tools like 'get_pokemon_cry' which might have overlapping functionality.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention sibling tools or contexts where this tool is preferred, such as for playing sounds versus retrieving metadata. Usage is implied by the action described, but no explicit guidelines are given.

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/t-daiki96/poke_mcp'

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