get_learnset
Retrieve Pokémon move learnsets by version group and learning method to build optimal movesets for battles and team planning.
Instructions
Learnset por version_group y método.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | all | |
| name | Yes | ||
| version_group | No | emerald |
Implementation Reference
- src/index.ts:69-74 (handler)The handler function for the 'get_learnset' tool. It processes input arguments, fetches learnset data using pokeapi.learnset, filters moves by method, and returns formatted JSON.}, async (args:any) => { const name = String(args.name), vg = String(args.version_group || 'emerald'), method = String(args.method || 'all'); const data = await pokeapi.learnset(name, vg); const filtered = data.filter(e => method==='all' || e.methods.some(m => m.method===method)); return jsonContent({ name, version_group: vg, method, moves: filtered }); });
- src/index.ts:66-68 (schema)JSON Schema defining the input parameters for the 'get_learnset' tool: pokemon name (required), optional version_group and method.type:'object', properties:{ name:{type:'string'}, version_group:{type:'string', default:'emerald'}, method:{type:'string', default:'all'} }, required:['name']
- src/index.ts:65-74 (registration)Registration of the 'get_learnset' tool using registerTool, including schema and inline handler.registerTool('get_learnset', 'Learnset por version_group y método.', { type:'object', properties:{ name:{type:'string'}, version_group:{type:'string', default:'emerald'}, method:{type:'string', default:'all'} }, required:['name'] }, async (args:any) => { const name = String(args.name), vg = String(args.version_group || 'emerald'), method = String(args.method || 'all'); const data = await pokeapi.learnset(name, vg); const filtered = data.filter(e => method==='all' || e.methods.some(m => m.method===method)); return jsonContent({ name, version_group: vg, method, moves: filtered }); });
- src/pokeapi.ts:98-114 (helper)Core helper function pokeapi.learnset that retrieves and processes the pokemon's move learnset from PokeAPI, filtering by version_group and aggregating methods with levels.async learnset(name: string, version_group?: string) { const p = await this.getPokemon(name); const vg = this.validVersionGroup(version_group); const rows = p.moves as AnyObj[]; const out: { move: string, methods: {version_group:string, method:string, level:number}[] }[] = []; for (const r of rows) { const methods = (r.version_group_details as AnyObj[]) .filter(d => !vg || d.version_group.name === vg) .map(d => ({ version_group: d.version_group.name, method: this.methodAlias(d.move_learn_method.name), level: d.level_learned_at })); if (methods.length) out.push({ move: r.move.name, methods }); } return out; }