Skip to main content
Glama

random-pokemon

Generate a random Pokémon using the model context protocol server Poke-MCP, perfect for discovering new Pokémon data without specific search criteria.

Instructions

Get a random Pokémon

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that generates a random Pokémon ID between 1 and 1000, fetches the Pokémon details, handles errors, and formats the response using formatPokemonResponse.
    async function getRandomPokemon(): Promise<PokemonResponse> {
      // There are currently around 1000+ Pokémon, but we'll limit to 1000 to be safe
      const randomId = Math.floor(Math.random() * 1000) + 1;
      const details = await getPokemonDetails(randomId.toString());
    
      if (!details) {
        return {
          content: [
            {
              type: "text",
              text: "Failed to retrieve a random Pokémon. Please try again.",
            },
          ],
        };
      }
    
      return formatPokemonResponse(details.pokemon, details.species);
    }
  • src/index.ts:319-325 (registration)
    Registers the 'random-pokemon' tool with no input parameters, a descriptive name, and an inline handler that delegates to the getRandomPokemon function.
      "random-pokemon",
      "Get a random Pokémon",
      {},
      async (_args, _extra) => {
        return await getRandomPokemon();
      }
    );
  • Type definition for the output response format used by the tool, consisting of text content blocks.
    export interface PokemonResponse {
      content: Array<{
        type: "text";
        text: string;
      }>;
      [key: string]: unknown;
    }
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/NaveenBandarage/poke-mcp'

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