validate_moveset
Validate Pokémon movesets against PokeAPI by version group to ensure move compatibility and accuracy for battle preparation.
Instructions
Valida un moveset contra PokeAPI por version_group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| moves | Yes | ||
| name | Yes | ||
| version_group | No | emerald |
Implementation Reference
- src/index.ts:129-142 (handler)The handler function validates the provided moveset against the Pokemon's learnset from PokeAPI for the given version_group. It checks each move and reports issues if not in learnset.}, async (args:any) => { const name = String(args.name), vg = String(args.version_group || 'emerald'); const moves = (args.moves as string[]).map(String); const ls = await pokeapi.learnset(name, vg); const index = new Map(ls.map(e => [e.move.toLowerCase(), e.methods])); const details:any[] = []; const issues:any[] = []; for (const mv of moves) { const item = index.get(mv.toLowerCase()); if (!item) issues.push({ code:'illegal-move', move: mv, detail: 'not-in-learnset' }); else details.push({ move: mv, methods: item }); } return jsonContent({ ok: issues.length===0, issues, learned: details }); });
- src/index.ts:126-128 (schema)Input schema defining parameters: name (string), version_group (string, default 'emerald'), moves (array of strings, 1-4 items). Requires name and moves.type:'object', properties:{ name:{type:'string'}, version_group:{type:'string', default:'emerald'}, moves:{type:'array', items:{type:'string'}, minItems:1, maxItems:4} }, required:['name','moves']
- src/index.ts:125-142 (registration)The registerTool call registers the 'validate_moveset' tool with its description, input schema, and inline handler function.registerTool('validate_moveset', 'Valida un moveset contra PokeAPI por version_group.', { type:'object', properties:{ name:{type:'string'}, version_group:{type:'string', default:'emerald'}, moves:{type:'array', items:{type:'string'}, minItems:1, maxItems:4} }, required:['name','moves'] }, async (args:any) => { const name = String(args.name), vg = String(args.version_group || 'emerald'); const moves = (args.moves as string[]).map(String); const ls = await pokeapi.learnset(name, vg); const index = new Map(ls.map(e => [e.move.toLowerCase(), e.methods])); const details:any[] = []; const issues:any[] = []; for (const mv of moves) { const item = index.get(mv.toLowerCase()); if (!item) issues.push({ code:'illegal-move', move: mv, detail: 'not-in-learnset' }); else details.push({ move: mv, methods: item }); } return jsonContent({ ok: issues.length===0, issues, learned: details }); });