Skip to main content
Glama

fetch_pokemon

Retrieve detailed Pokémon data, including stats, abilities, sprites, and battle mechanics, by entering the Pokémon's name or ID through the Pokédex MCP Server.

Instructions

Fetch detailed information about a Pokémon by name or ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name or ID of the Pokémon

Implementation Reference

  • The async handler function that implements the core logic of the fetch_pokemon tool: fetches Pokemon data via pokeAPI and formats the response.
    async ({ name }) => { try { const pokemon = await pokeAPI.getPokemon(name.toLowerCase().trim()); return formatPokemon(pokemon); } catch (error) { return formatCaughtError(error, "fetching Pokémon"); } },
  • Zod schema defining the input parameter 'name' for the fetch_pokemon tool.
    { name: z.string().min(1).describe("The name or ID of the Pokémon"), },
  • src/tools.ts:15-29 (registration)
    Registration of the fetch_pokemon tool using McpServer.tool(), including description, schema, and inline handler.
    server.tool( "fetch_pokemon", "Fetch detailed information about a Pokémon by name or ID", { name: z.string().min(1).describe("The name or ID of the Pokémon"), }, async ({ name }) => { try { const pokemon = await pokeAPI.getPokemon(name.toLowerCase().trim()); return formatPokemon(pokemon); } catch (error) { return formatCaughtError(error, "fetching Pokémon"); } }, );
  • PokeAPI client method getPokemon() called by the tool handler to fetch raw Pokemon data from the API.
    async getPokemon(idOrName: string | number): Promise<Pokemon> { return this.fetchAPI<Pokemon>(`/pokemon/${idOrName}`); }
  • Helper function formatPokemon() that formats the raw Pokemon data into a structured MCP text response.
    export function formatPokemon(pokemon: Pokemon): MCPResponse { const stats = pokemon.stats .map((s) => `${s.stat.name}: ${s.base_stat}`) .join(", "); const types = pokemon.types.map((t) => t.type.name).join(", "); const abilities = pokemon.abilities .map((a) => a.is_hidden ? `${a.ability.name} (hidden)` : a.ability.name, ) .join(", "); const artworkUrl = pokemon.sprites.other?.["official-artwork"]?.front_default; return { content: [ { type: "text", text: `**${pokemon.name}** (ID: ${pokemon.id}) Height: ${pokemon.height} decimetres (${(pokemon.height / 10).toFixed(1)}m) Weight: ${pokemon.weight} hectograms (${(pokemon.weight / 10).toFixed(1)}kg) Base Experience: ${pokemon.base_experience || "N/A"} Order: ${pokemon.order || "N/A"} **Types:** ${types} **Abilities:** ${abilities} **Base Stats:** ${stats} **Sprites:** - Default: ${pokemon.sprites.front_default || "N/A"} - Shiny: ${pokemon.sprites.front_shiny || "N/A"} ${artworkUrl ? `- Artwork: ${artworkUrl}` : ""}`, }, ], }; }

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/hollanddd/pokedex-mcp'

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