Skip to main content
Glama

pokemon-query

Answer natural language queries about Pokémon by retrieving detailed data, discovering random Pokémon, and finding Pokémon by region or type through the Poke-MCP server.

Instructions

Answer natural language Pokémon queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesA natural language query about Pokémon

Implementation Reference

  • Main execution logic for the 'pokemon-query' tool: parses natural language input, matches patterns for Pokémon ID, random, region, or type queries, delegates to helpers, or provides usage examples.
      async ({ query }, _extra) => {
        const normalizedQuery = query.toLowerCase();
    
        // Check for Pokémon number query
        const numberMatch =
          normalizedQuery.match(/pokemon\s+#?(\d+)/i) ||
          normalizedQuery.match(/what\s+is\s+pokemon\s+#?(\d+)/i);
        if (numberMatch) {
          const pokemonId = parseInt(numberMatch[1], 10);
          return await getPokemonById(pokemonId);
        }
    
        // Check for random Pokémon request
        if (
          normalizedQuery.includes("random pokemon") &&
          !normalizedQuery.includes("from") &&
          !normalizedQuery.includes("type")
        ) {
          return await getRandomPokemon();
        }
    
        // Check for random Pokémon from region
        const regionMatch = normalizedQuery.match(/random pokemon from (\w+)/i);
        if (regionMatch) {
          const region = regionMatch[1].toLowerCase();
          return await getRandomPokemonFromRegion(region);
        }
    
        // Check for random Pokémon by type
        const typeMatch =
          normalizedQuery.match(/random (\w+) pokemon/i) ||
          normalizedQuery.match(/random pokemon of type (\w+)/i);
        if (typeMatch) {
          const type = typeMatch[1].toLowerCase();
          // Check if the matched word is actually a type and not just any adjective
          const validTypes = [
            "normal",
            "fire",
            "water",
            "grass",
            "electric",
            "ice",
            "fighting",
            "poison",
            "ground",
            "flying",
            "psychic",
            "bug",
            "rock",
            "ghost",
            "dragon",
            "dark",
            "steel",
            "fairy",
          ];
          if (validTypes.includes(type)) {
            return await getRandomPokemonByType(type);
          }
        }
    
        // Default response for unrecognized queries
        return {
          content: [
            {
              type: "text",
              text: `
    I can help with Pokémon queries! Try asking:
    - "What is pokemon #25?"
    - "Give me a random Pokémon"
    - "Give me a random Pokémon from Kanto"
    - "Give me a random Fire Pokémon"
              `.trim(),
            },
          ],
        };
      }
  • Input schema defining the 'query' parameter as a string for natural language Pokémon questions.
    {
      query: z.string().describe("A natural language query about Pokémon"),
    },
  • src/index.ts:354-436 (registration)
    Registers the 'pokemon-query' tool with the MCP server, including name, description, input schema, and handler reference.
    server.tool(
      "pokemon-query",
      "Answer natural language Pokémon queries",
      {
        query: z.string().describe("A natural language query about Pokémon"),
      },
      async ({ query }, _extra) => {
        const normalizedQuery = query.toLowerCase();
    
        // Check for Pokémon number query
        const numberMatch =
          normalizedQuery.match(/pokemon\s+#?(\d+)/i) ||
          normalizedQuery.match(/what\s+is\s+pokemon\s+#?(\d+)/i);
        if (numberMatch) {
          const pokemonId = parseInt(numberMatch[1], 10);
          return await getPokemonById(pokemonId);
        }
    
        // Check for random Pokémon request
        if (
          normalizedQuery.includes("random pokemon") &&
          !normalizedQuery.includes("from") &&
          !normalizedQuery.includes("type")
        ) {
          return await getRandomPokemon();
        }
    
        // Check for random Pokémon from region
        const regionMatch = normalizedQuery.match(/random pokemon from (\w+)/i);
        if (regionMatch) {
          const region = regionMatch[1].toLowerCase();
          return await getRandomPokemonFromRegion(region);
        }
    
        // Check for random Pokémon by type
        const typeMatch =
          normalizedQuery.match(/random (\w+) pokemon/i) ||
          normalizedQuery.match(/random pokemon of type (\w+)/i);
        if (typeMatch) {
          const type = typeMatch[1].toLowerCase();
          // Check if the matched word is actually a type and not just any adjective
          const validTypes = [
            "normal",
            "fire",
            "water",
            "grass",
            "electric",
            "ice",
            "fighting",
            "poison",
            "ground",
            "flying",
            "psychic",
            "bug",
            "rock",
            "ghost",
            "dragon",
            "dark",
            "steel",
            "fairy",
          ];
          if (validTypes.includes(type)) {
            return await getRandomPokemonByType(type);
          }
        }
    
        // Default response for unrecognized queries
        return {
          content: [
            {
              type: "text",
              text: `
    I can help with Pokémon queries! Try asking:
    - "What is pokemon #25?"
    - "Give me a random Pokémon"
    - "Give me a random Pokémon from Kanto"
    - "Give me a random Fire Pokémon"
              `.trim(),
            },
          ],
        };
      }
    );
  • Helper function called by pokemon-query handler to fetch and format details for a specific Pokémon by ID.
    async function getPokemonById(id: number): Promise<PokemonResponse> {
      const details = await getPokemonDetails(id.toString());
    
      if (!details) {
        return {
          content: [
            {
              type: "text",
              text: `No Pokémon found with ID #${id}.`,
            },
          ],
        };
      }
    
      return formatPokemonResponse(details.pokemon, details.species);
    }
  • Type definition for the output response format used by pokemon-query and its helpers.
    export interface PokemonResponse {
      content: {
        type: "text";
        text: string;
      }[];
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Answer natural language Pokémon queries' implies a read-only operation, it doesn't specify what types of answers are provided (facts, stats, descriptions), whether there are limitations on query complexity, or how results are formatted. The description lacks behavioral details beyond the basic purpose.

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 extremely concise with just 5 words: 'Answer natural language Pokémon queries'. Every word earns its place by specifying the action, input format, and subject matter. It's front-loaded with no unnecessary elaboration or redundancy.

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 no annotations, no output schema, and a single parameter with good schema coverage, the description is incomplete. It doesn't explain what types of answers are returned, how comprehensive the knowledge base is, or any limitations. For a query tool with no structured output documentation, the description should provide more context about response format and capabilities.

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?

Schema description coverage is 100% with the single parameter 'query' well-documented as 'A natural language query about Pokémon'. The description adds no additional parameter semantics beyond what the schema already provides. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

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 tool's purpose: 'Answer natural language Pokémon queries' specifies the action (answer) and resource (Pokémon queries). It distinguishes from sibling tools like 'random-pokemon' which provide random selections rather than query-based answers. However, it doesn't explicitly mention what types of Pokémon information it can answer about.

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 its siblings. It doesn't mention alternatives like using 'random-pokemon' for random selections or specify scenarios where this query tool is preferred. The only implied usage is for natural language questions about Pokémon, but no explicit context or exclusions are provided.

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