Skip to main content
Glama

calc_stats

Calculate final Pokémon stats based on level, IVs, EVs, and nature to optimize battle performance and team building.

Instructions

Cálculo de stats finales (nivel, IVs, EVs, naturaleza).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
evsNo
ivsNo
levelNo
nameYes
natureNoserious

Implementation Reference

  • Core handler logic for calc_stats tool: computes final Pokémon stats based on base stats from PokeAPI, IVs, EVs, level, and nature multipliers.
    const core = await pokeapi.pokemonCore(String(args.name)); const level = Number(args.level || 50); const ivs = Object.assign({hp:31,atk:31,def:31,spa:31,spd:31,spe:31}, args.ivs || {}); const evs = Object.assign({hp:0,atk:0,def:0,spa:0,spd:0,spe:0}, args.evs || {}); const nature = String(args.nature || 'serious'); const bs:any = core.base_stats; const stat=(base:number,iv:number,ev:number, mult:number, isHP=false)=>{ if (isHP) return Math.floor(((2*base + iv + Math.floor(ev/4))*level)/100)+level+10; const val = Math.floor(((2*base + iv + Math.floor(ev/4))*level)/100)+5; return Math.floor(val * mult); }; return jsonContent({ name: core.name, level, nature, stats: { hp: stat(bs.hp,ivs.hp,evs.hp,1,true), atk: stat(bs.atk,ivs.atk,evs.atk,natureMultiplier(nature,'atk')), def: stat(bs.def,ivs.def,evs.def,natureMultiplier(nature,'def')), spa: stat(bs.spa,ivs.spa,evs.spa,natureMultiplier(nature,'spa')), spd: stat(bs.spd,ivs.spd,evs.spd,natureMultiplier(nature,'spd')), spe: stat(bs.spe,ivs.spe,evs.spe,natureMultiplier(nature,'spe')) } });
  • Input schema defining parameters for calc_stats: pokemon name (required), level, IVs, EVs, nature.
    type:'object', properties:{ name:{type:'string'}, level:{type:'integer', default:50}, ivs:{type:'object', default:{}, additionalProperties:{ type:'integer' }}, evs:{type:'object', default:{}, additionalProperties:{ type:'integer' }}, nature:{type:'string', default:'serious'} }, required:['name']
  • src/index.ts:93-123 (registration)
    Registration of the calc_stats tool using registerTool, including schema and inline handler.
    registerTool('calc_stats', 'Cálculo de stats finales (nivel, IVs, EVs, naturaleza).', { type:'object', properties:{ name:{type:'string'}, level:{type:'integer', default:50}, ivs:{type:'object', default:{}, additionalProperties:{ type:'integer' }}, evs:{type:'object', default:{}, additionalProperties:{ type:'integer' }}, nature:{type:'string', default:'serious'} }, required:['name'] }, async (args:any) => { const core = await pokeapi.pokemonCore(String(args.name)); const level = Number(args.level || 50); const ivs = Object.assign({hp:31,atk:31,def:31,spa:31,spd:31,spe:31}, args.ivs || {}); const evs = Object.assign({hp:0,atk:0,def:0,spa:0,spd:0,spe:0}, args.evs || {}); const nature = String(args.nature || 'serious'); const bs:any = core.base_stats; const stat=(base:number,iv:number,ev:number, mult:number, isHP=false)=>{ if (isHP) return Math.floor(((2*base + iv + Math.floor(ev/4))*level)/100)+level+10; const val = Math.floor(((2*base + iv + Math.floor(ev/4))*level)/100)+5; return Math.floor(val * mult); }; return jsonContent({ name: core.name, level, nature, stats: { hp: stat(bs.hp,ivs.hp,evs.hp,1,true), atk: stat(bs.atk,ivs.atk,evs.atk,natureMultiplier(nature,'atk')), def: stat(bs.def,ivs.def,evs.def,natureMultiplier(nature,'def')), spa: stat(bs.spa,ivs.spa,evs.spa,natureMultiplier(nature,'spa')), spd: stat(bs.spd,ivs.spd,evs.spd,natureMultiplier(nature,'spd')), spe: stat(bs.spe,ivs.spe,evs.spe,natureMultiplier(nature,'spe')) } }); });
  • Helper function natureMultiplier that provides the 1.1/0.9/1.0 multiplier for stats based on Pokémon nature, used in calc_stats handler.
    export function natureMultiplier(nature: Nature | string, stat: 'atk'|'def'|'spa'|'spd'|'spe'): number { const n = String(nature).toLowerCase(); const mod = natureMods[n] || {}; if (mod.up === stat) return 1.1; if (mod.down === stat) return 0.9; return 1.0; }

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/EscasanN/MCP_Pokemon'

If you have feedback or need assistance with the MCP directory API, please join our Discord server