Skip to main content
Glama
hollanddd

Pokédex MCP Server

by hollanddd

get_pokemon_encounters

Find where specific Pokémon appear in the wild by entering their name or ID to get detailed location encounter data.

Instructions

Get location encounter information for a Pokémon

Input Schema

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

Implementation Reference

  • The asynchronous handler function for the get_pokemon_encounters MCP tool. It fetches the Pokémon data and encounters using pokeAPI.getPokemonWithEncounters and formats the response with formatPokemonEncounters, catching and formatting any errors.
    async ({ name }) => {
      try {
        const { pokemon, encounters } = await pokeAPI.getPokemonWithEncounters(
          name.toLowerCase().trim(),
        );
        return formatPokemonEncounters(pokemon, encounters);
      } catch (error) {
        return formatCaughtError(error, "fetching encounter information");
      }
    },
  • src/tools.ts:51-65 (registration)
    Registers the get_pokemon_encounters tool with the MCP server, providing the tool name, description, input schema (name parameter), and the handler function.
    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");
        }
      },
    );
  • Zod schema for the tool input, requiring a non-empty string for the Pokémon name or ID.
    { name: z.string().min(1).describe("The name or ID of the Pokémon") },
  • PokeAPIClient helper method that fetches both the Pokémon details and its location area encounters concurrently using Promise.all.
    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 };
    }
  • Formatter helper that converts the Pokémon object and array of LocationAreaEncounter into a formatted MCPResponse text content, handling cases with no encounters and formatting location/version details.
    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}`,
          },
        ],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe any behavioral traits such as whether it's a read-only operation, potential rate limits, error conditions, or what the output format might look like. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently communicates the tool's purpose without any wasted words. It's front-loaded with the essential information and appropriately sized for a simple tool with one parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what 'location encounter information' entails (e.g., format, structure, or examples), nor does it address behavioral aspects like error handling or limitations. For a tool with no structured metadata, the description should provide more context about what to expect from the operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'name' parameter clearly documented as 'The name or ID of the Pokémon'. The description doesn't add any additional meaning beyond what the schema provides, but since schema coverage is high, the baseline score of 3 is appropriate as the schema adequately handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'location encounter information for a Pokémon', making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'fetch_pokemon' or 'search_pokemon' in terms of what specific information is retrieved versus those alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'fetch_pokemon' or 'search_pokemon'. It lacks any context about prerequisites, exclusions, or specific scenarios where this tool is preferred over others, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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