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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:132-149 (handler)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(); } );
- src/types.ts:2-8 (schema)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; }