Skip to main content
Glama

random-pokemon-by-type

Find a random Pokémon based on a specific type (e.g., fire, water, grass) using this tool. Ideal for discovering Pokémon by type for games, research, or entertainment.

Instructions

Get a random Pokémon of a specific type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesThe Pokémon type (e.g., fire, water, grass, etc.)

Implementation Reference

  • Core handler function that fetches type-specific Pokémon list from PokeAPI, selects a random one, retrieves details, and formats the response with type, stats, abilities, and description.
    async function getRandomPokemonByType(type: string): Promise<PokemonResponse> {
      const normalizedType = type.toLowerCase();
    
      // Get all Pokémon of this type
      const typeData = await fetchFromPokeAPI<TypeData>(`/type/${normalizedType}`);
    
      if (!typeData || !typeData.pokemon || typeData.pokemon.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: `Unknown type: ${type} or no Pokémon found of this type.`,
            },
          ],
        };
      }
    
      // Select a random Pokémon
      const randomPokemon = getRandomItem(typeData.pokemon);
    
      // Get detailed information about this Pokémon
      const details = await getPokemonDetails(randomPokemon.pokemon.name);
    
      if (!details) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to retrieve details for the selected ${normalizedType} Pokémon.`,
            },
          ],
        };
      }
    
      // Add type 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(
              normalizedType
            )} 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:340-351 (registration)
    Registers the 'random-pokemon-by-type' tool with MCP server, defining input schema and linking to the handler function.
    server.tool(
      "random-pokemon-by-type",
      "Get a random Pokémon of a specific type",
      {
        type: z
          .string()
          .describe("The Pokémon type (e.g., fire, water, grass, etc.)"),
      },
      async ({ type }, _extra) => {
        return await getRandomPokemonByType(type);
      }
    );
  • Zod input schema for the tool, validating the 'type' parameter as a string.
    {
      type: z
        .string()
        .describe("The Pokémon type (e.g., fire, water, grass, etc.)"),
    },
  • TypeScript interface defining the structure of PokeAPI type data response used in the handler.
    export interface TypeData {
      pokemon: {
        pokemon: {
          name: string;
          url: string;
        };
      }[];
    }
  • Helper function to fetch detailed Pokémon data including species information, used by the handler.
    async function getPokemonDetails(pokemonNameOrId: string) {
      const pokemon = await fetchFromPokeAPI<Pokemon>(
        `/pokemon/${pokemonNameOrId.toLowerCase()}`
      );
      if (!pokemon) return null;
    
      const species = await fetchFromPokeAPI<PokemonSpeciesDetails>(
        `/pokemon-species/${pokemon.id}`
      );
      if (!species) return null;
    
      return { pokemon, species };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool 'Get[s] a random Pokémon,' which suggests a read-only operation, but doesn't clarify aspects like whether the randomness is seeded, if there are rate limits, what format the output takes, or if authentication is required. This leaves significant gaps for a tool with no annotation coverage.

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 functionality ('Get a random Pokémon of a specific type') with no wasted words. Every part of the sentence contributes directly to understanding the tool's purpose.

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 what the tool returns (e.g., Pokémon details, just a name), how randomness is determined, or any behavioral constraints. For a tool with no structured data beyond the input schema, this leaves too many open questions for effective 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 input schema has 100% description coverage, with the parameter 'type' documented as 'The Pokémon type (e.g., fire, water, grass, etc.).' The description adds minimal value by mentioning 'specific type,' which aligns with but doesn't expand beyond the schema. This meets the baseline of 3 for high schema coverage.

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 target resource ('of a specific type'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'random-pokemon' or 'random-pokemon-from-region' beyond mentioning the type parameter.

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?

No guidance is provided on when to use this tool versus alternatives like 'random-pokemon' (which might get any random Pokémon) or 'random-pokemon-from-region' (which filters by region). The description implies usage when a type filter is needed, but doesn't explicitly state this or mention exclusions.

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