Skip to main content
Glama

random-pokemon-from-region

Generate a random Pokémon from a specified region like Kanto, Johto, or Hoenn using a dedicated tool that fetches data from the PokeAPI for easy discovery.

Instructions

Get a random Pokémon from a specific region

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionYesThe Pokémon region (e.g., kanto, johto, hoenn, etc.)

Implementation Reference

  • Main handler function that implements the logic to retrieve and format a random Pokémon from the specified region using PokeAPI data.
    async function getRandomPokemonFromRegion(
      region: string
    ): Promise<PokemonResponse> {
      const normalizedRegion = region.toLowerCase();
      const generation = REGION_TO_GENERATION[normalizedRegion];
    
      if (!generation) {
        return {
          content: [
            {
              type: "text",
              text: `Unknown region: ${region}. Available regions are: ${Object.keys(
                REGION_TO_GENERATION
              ).join(", ")}`,
            },
          ],
        };
      }
    
      // Get all Pokémon from this generation
      const generationData = await fetchFromPokeAPI<GenerationData>(
        `/generation/${generation}`
      );
    
      if (
        !generationData ||
        !generationData.pokemon_species ||
        generationData.pokemon_species.length === 0
      ) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to retrieve Pokémon from the ${normalizedRegion} region.`,
            },
          ],
        };
      }
    
      // Select a random Pokémon
      const randomPokemon = getRandomItem(generationData.pokemon_species);
    
      // Get detailed information about this Pokémon
      const details = await getPokemonDetails(randomPokemon.name);
    
      if (!details) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to retrieve details for the selected Pokémon from ${normalizedRegion}.`,
            },
          ],
        };
      }
    
      // Add region information to the response
      const types = formatPokemonTypes(details.pokemon.types);
      const abilities = formatPokemonAbilities(details.pokemon.abilities);
      const flavorText = getEnglishFlavorText(details.species);
    
      return {
        content: [
          {
            type: "text",
            text: `
    # Random ${capitalizeFirstLetter(
              normalizedRegion
            )} Pokémon: ${capitalizeFirstLetter(details.pokemon.name)} (#${
              details.pokemon.id
            })
    
    **Types:** ${types}
    **Height:** ${details.pokemon.height / 10}m
    **Weight:** ${details.pokemon.weight / 10}kg
    **Abilities:** ${abilities}
    
    **Description:** ${flavorText}
            `.trim(),
          },
        ],
      };
    }
  • src/index.ts:327-338 (registration)
    Registration of the 'random-pokemon-from-region' tool with the MCP server, including input schema and handler reference.
    server.tool(
      "random-pokemon-from-region",
      "Get a random Pokémon from a specific region",
      {
        region: z
          .string()
          .describe("The Pokémon region (e.g., kanto, johto, hoenn, etc.)"),
      },
      async ({ region }, _extra) => {
        return await getRandomPokemonFromRegion(region);
      }
    );
  • Zod input schema defining the 'region' parameter for the tool.
    {
      region: z
        .string()
        .describe("The Pokémon region (e.g., kanto, johto, hoenn, etc.)"),
    },
  • Mapping of region names to Pokémon generations used by the handler.
    const REGION_TO_GENERATION: Record<string, number> = {
      kanto: 1,
      johto: 2,
      hoenn: 3,
      sinnoh: 4,
      unova: 5,
      kalos: 6,
      alola: 7,
      galar: 8,
      paldea: 9,
    };
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 key traits: whether it's read-only or mutative, if there are rate limits, authentication needs, or what the output looks like (e.g., Pokémon details). This leaves significant gaps for a tool with no structured safety hints.

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, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for a simple tool with one parameter, making it easy for an agent to parse quickly.

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. It doesn't explain behavioral aspects like safety or output format, and while the schema covers parameters well, the overall context for a tool with no structured metadata is insufficient, requiring more guidance for reliable use.

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 schema description coverage is 100%, with the single parameter 'region' well-documented in the schema (including examples like 'kanto'). The description adds no additional parameter details beyond what's in the schema, so it meets the baseline score of 3 where the schema does the heavy lifting.

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 action ('Get a random Pokémon') and the resource ('from a specific region'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'random-pokemon' (which likely gets any random Pokémon) or 'random-pokemon-by-type' (which filters by type rather than region), missing full sibling distinction.

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. There's no mention of when it's appropriate compared to 'pokemon-query', 'random-pokemon', or 'random-pokemon-by-type', nor any context about prerequisites or exclusions, leaving the agent to infer usage from the 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

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/NaveenBandarage/poke-mcp'

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