get_evolutions
Retrieve the complete evolution chain for any Pokémon species, showing all evolutionary paths and relationships from the base form to final evolutions.
Instructions
Cadena/grafo de evoluciones desde species->evolution_chain.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/index.ts:76-82 (registration)Registers the get_evolutions tool with description, input schema, and inline handler function that delegates to pokeapi helpers.registerTool('get_evolutions', 'Cadena/grafo de evoluciones desde species->evolution_chain.', { type:'object', properties:{ name:{type:'string'} }, required:['name'] }, async (args:any) => { const name = String(args.name); const chain = await pokeapi.getEvolutionChainBySpeciesName(name); return jsonContent({ name, edges: pokeapi.parseEvolutionChain(chain) }); });
- src/index.ts:78-82 (handler)The main handler function for the tool, which takes the pokemon name, fetches the evolution chain data, parses it into edges, and returns as JSON.}, async (args:any) => { const name = String(args.name); const chain = await pokeapi.getEvolutionChainBySpeciesName(name); return jsonContent({ name, edges: pokeapi.parseEvolutionChain(chain) }); });
- src/index.ts:77-77 (schema)Input schema requiring a 'name' string parameter.type:'object', properties:{ name:{type:'string'} }, required:['name']
- src/pokeapi.ts:47-51 (helper)Helper method that retrieves the full evolution chain by first getting the species and then fetching the chain URL.async getEvolutionChainBySpeciesName(name: string): Promise<AnyObj> { const sp = await this.getSpecies(name); const url = sp.evolution_chain.url as string; return this.getJSON(url); }
- src/pokeapi.ts:126-139 (helper)Helper function that recursively parses the evolution chain into a list of directed edges with evolution conditions.parseEvolutionChain(chain: AnyObj) { const edges: {from:string,to:string,conditions:AnyObj}[] = []; function walk(node: AnyObj) { const from = node.species.name; for (const evo of node.evolves_to as AnyObj[]) { const to = evo.species.name; const conds = (evo.evolution_details?.[0]) || {}; edges.push({ from, to, conditions: conds }); walk(evo); } } walk(chain.chain); return edges; }