Skip to main content
Glama

get_pokemon

Retrieve detailed Pokémon information including types, base stats, and abilities from PokeAPI by specifying the Pokémon name.

Instructions

Ficha con tipos, base stats y habilidades (PokeAPI).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • Main handler logic for the get_pokemon tool: retrieves raw pokemon data and formats it into name, sorted types, abbreviated base_stats, and abilities list.
    async pokemonCore(name: string) { const p = await this.getPokemon(name); return { name: p.name, types: (p.types as AnyObj[]).sort((a,b)=>a.slot-b.slot).map(t => t.type.name), base_stats: Object.fromEntries((p.stats as AnyObj[]).map(s => [s.stat.name.replace('special-attack','spa').replace('special-defense','spd').replace('speed','spe').replace('attack','atk').replace('defense','def').replace('hp','hp'), s.base_stat])), abilities: (p.abilities as AnyObj[]).map(a => a.ability.name) }; }
  • Input schema definition for the get_pokemon tool, requiring a 'name' string parameter.
    type:'object', properties:{ name:{type:'string'} }, required:['name']
  • src/index.ts:57-63 (registration)
    Registration of the get_pokemon tool in the MCP server registry.
    registerTool('get_pokemon', 'Ficha con tipos, base stats y habilidades (PokeAPI).', { type:'object', properties:{ name:{type:'string'} }, required:['name'] }, async (args:any) => { const name = String(args.name); const core = await pokeapi.pokemonCore(name); return jsonContent(core); });
  • Cached API fetcher for raw pokemon data, used by pokemonCore.
    async getPokemon(name: string): Promise<AnyObj> { const n = normName(name); if (!this.pokemonCache.has(n)) this.pokemonCache.set(n, this.getJSON(`${API}/pokemon/${n}`)); return this.pokemonCache.get(n)!; }
  • Utility for normalizing pokemon names to PokeAPI kebab-case format (e.g., handles spaces, gender symbols). Used in getPokemon.
    export function normName(s: string): string { return s .toLowerCase() .replace(/[\s_.]/g, '-') .replace(/♀/g, '-f') .replace(/♂/g, '-m') .replace(/'/g, '') .replace(/[^a-z0-9-]/g, '') .replace(/-+/g, '-') .trim();

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/EscasanN/MCP_Pokemon'

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