Skip to main content
Glama

get_pokemon_encounters

Retrieve detailed encounter locations for any Pokémon by name or ID. Access specific wild encounter data to track Pokémon habitats and spawn areas.

Instructions

Get location encounter information for a Pokémon

Input Schema

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

Implementation Reference

  • src/tools.ts:51-65 (registration)
    MCP server.tool registration for 'get_pokemon_encounters', including description, Zod input schema {name: string}, and inline async handler that fetches encounters via pokeAPI and formats the response.
    server.tool( "get_pokemon_encounters", "Get location encounter information for a Pokémon", { name: z.string().min(1).describe("The name or ID of the Pokémon") }, async ({ name }) => { try { const { pokemon, encounters } = await pokeAPI.getPokemonWithEncounters( name.toLowerCase().trim(), ); return formatPokemonEncounters(pokemon, encounters); } catch (error) { return formatCaughtError(error, "fetching encounter information"); } }, );
  • The core handler function for the tool: extracts name, calls pokeAPI.getPokemonWithEncounters, formats with formatPokemonEncounters or handles error.
    async ({ name }) => { try { const { pokemon, encounters } = await pokeAPI.getPokemonWithEncounters( name.toLowerCase().trim(), ); return formatPokemonEncounters(pokemon, encounters); } catch (error) { return formatCaughtError(error, "fetching encounter information"); } },
  • PokeAPI helper getPokemonWithEncounters that parallel fetches pokemon details and encounters, returning both.
    async getPokemonWithEncounters(idOrName: string | number): Promise<{ pokemon: Pokemon; encounters: LocationAreaEncounter[]; }> { const [pokemon, encounters] = await Promise.all([ this.getPokemon(idOrName), this.getPokemonEncounters(idOrName) ]); return { pokemon, encounters }; }
  • PokeAPIClient method getPokemonEncounters: fetches raw encounters data from /pokemon/{idOrName}/encounters endpoint.
    async getPokemonEncounters(idOrName: string | number): Promise<LocationAreaEncounter[]> { return this.fetchAPI<LocationAreaEncounter[]>(`/pokemon/${idOrName}/encounters`); }
  • formatPokemonEncounters helper: formats pokemon and encounters into MCP text response with location areas, versions, methods, levels, and chances.
    export function formatPokemonEncounters( pokemon: Pokemon, encounters: LocationAreaEncounter[] ): MCPResponse { if (encounters.length === 0) { return { content: [ { type: "text", text: `**${pokemon.name}** has no recorded wild encounters. This Pokémon might be: - A starter Pokémon - Obtained through evolution - A legendary/mythical Pokémon - Only available through special events`, }, ], }; } const locationInfo = encounters .map((encounter) => { const locationName = encounter.location_area.name.replace("-", " "); const versions = encounter.version_details .map((vd) => { const encounterMethods = vd.encounter_details .map( (ed) => `${ed.method.name} (Lv.${ed.min_level}-${ed.max_level}, ${ed.chance}% chance)`, ) .join(", "); return `${vd.version.name}: ${encounterMethods}`; }) .join("\n "); return `**${locationName}:**\n ${versions}`; }) .join("\n\n"); return { content: [ { type: "text", text: `**${pokemon.name} Encounter Locations:**\n\n${locationInfo}`, }, ], }; }

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