search_pokemon_by_ability
Find all Pokemon that can have a specific ability. Use this tool to identify which Pokemon possess a particular ability for competitive battle strategy planning.
Instructions
Find all Pokemon that can have a specific ability.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ability | Yes | Ability name to search for |
Implementation Reference
- Handler logic in call_tool function: extracts ability name, calls loader.get_pokemon_with_ability, formats and returns the list of matching Pokemon or a not-found message.elif name == "search_pokemon_by_ability": ability = arguments["ability"] pokemon_list = loader.get_pokemon_with_ability(ability) if not pokemon_list: return [TextContent(type="text", text=f"No Pokemon found with ability '{ability}'.")] response = f"""## Pokemon with {ability.title()} Found {len(pokemon_list)} Pokemon: {', '.join(sorted(pokemon_list)[:50])} """ if len(pokemon_list) > 50: response += f"\n... and {len(pokemon_list) - 50} more." return [TextContent(type="text", text=response)]
- mcpkmn_showdown/pokemon_server.py:274-287 (registration)Registers the tool with the MCP server in list_tools(), including name, description, and input schema requiring 'ability' string.Tool( name="search_pokemon_by_ability", description="Find all Pokemon that can have a specific ability.", inputSchema={ "type": "object", "properties": { "ability": { "type": "string", "description": "Ability name to search for" } }, "required": ["ability"] } ),
- Input schema definition: object with required 'ability' property of type string.inputSchema={ "type": "object", "properties": { "ability": { "type": "string", "description": "Ability name to search for" } }, "required": ["ability"] } ),
- Supporting method in PokemonDataLoader: scans all loaded Pokemon data to collect names of those possessing the given ability (case-insensitive match).def get_pokemon_with_ability(self, ability_name: str) -> list[str]: """Find all Pokemon that can have a specific ability.""" self.load_all() ability_lower = ability_name.lower() result = [] for poke_id, poke_data in self.pokemon.items(): abilities = poke_data.get("abilities", {}) for ability in abilities.values(): if ability.lower() == ability_lower: result.append(poke_data.get("name", poke_id)) break return result