getcompetitive 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,434 @@
1
+ /**
2
+ * Matchup preparation: "here is my opponent — prepare me." A pre-game dossier
3
+ * built entirely from the deterministic primitives the rest of the surface
4
+ * shares: usage-derived sets, level-50 Speed math, real damage calculations,
5
+ * and the same bring-four type scoring `analyze_team` uses. The caller narrates;
6
+ * every claim in here carries the number behind it.
7
+ */
8
+ import { z } from 'zod';
9
+ import { getDex, typeEffectiveness, TYPES18, finalStat, damageResult, learnableMoveIds } from '../dex.js';
10
+ import { REGULATION_SETS, getRegulationSet, setStatus } from '../regulations.js';
11
+ import { getThreatList, findThreat } from '../threats.js';
12
+ import { ok, wrap, requireExists, READ_ONLY_ANNOTATIONS } from '../result.js';
13
+ import { parsedSetSchema, resolveMembers } from './team.js';
14
+ import { planBringFour } from './analyze.js';
15
+ const LEAD_MOVES = ['fakeout', 'tailwind', 'trickroom', 'helpinghand', 'followme', 'ragepowder', 'wideguard'];
16
+ const toKey = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, '');
17
+ export function registerMatchupTool(server) {
18
+ server.registerTool('prepare_matchup', {
19
+ title: 'Prepare a matchup',
20
+ description: 'Prepare a match against a known opponent: "here is their team — what do I bring, and what should I watch for?" A deterministic pre-game dossier composed from the rest of the surface. `likelySets` orders the opponent most-used first, carrying each species\u2019 actual usage-derived set (item, ability, nature, EVs, four moves, usage share) where one exists. `speedTiers` compares real level-50 Speed with the margins spelled out. `relevantDamageCalcs` runs real damage rolls for the key matchups — the team\u2019s hardest hit into their top threats and the threat\u2019s hardest hit back at the member that answers it. `recommendedBringFour` is the same type-scored pick `analyze_team` makes. Leads, win conditions, loss conditions, and the members to preserve are heuristics from movesets, Speed and typing, each labelled with what it can see. Speeds and moves for uncurated opponent species are base-stat or STAB estimates and say so. The caller narrates; every number here is a real calculation or a real usage figure.',
21
+ annotations: READ_ONLY_ANNOTATIONS,
22
+ inputSchema: {
23
+ team: z
24
+ .array(parsedSetSchema)
25
+ .min(1)
26
+ .max(6)
27
+ .describe('Your team, in the canonical shape `parse_team` returns: species with optional moves, ability, nature, evs or championsPoints, and item.'),
28
+ opponent: z
29
+ .array(z.union([z.string().describe('A species name, e.g. "Sneasler", "Salamence-Mega".'), parsedSetSchema]))
30
+ .min(1)
31
+ .max(6)
32
+ .describe('The opponent\u2019s team: species names for what preview shows, or full sets when more is known — full sets widen the damage calculations and speed math.'),
33
+ regulation: z
34
+ .string()
35
+ .optional()
36
+ .describe('Regulation id the match is under, e.g. "m-c"; omitted, the current set is used.'),
37
+ },
38
+ outputSchema: {
39
+ regulation: z.string().describe('Display name of the regulation the matchup was prepared under.'),
40
+ opponent: z.array(z.string()).describe('The opponent team as resolved species names, in the order supplied.'),
41
+ likelySets: z
42
+ .array(z.object({
43
+ species: z.string().describe('Species name.'),
44
+ priority: z
45
+ .number()
46
+ .int()
47
+ .nullable()
48
+ .describe('Rank by usage among the opponent, 1 being the most used; null when the species has no curated set.'),
49
+ usage: z.number().optional().describe('Usage share in percent; present only for curated species.'),
50
+ role: z.string().optional().describe('Competitive role from the curated list; present only for curated species.'),
51
+ item: z.string().optional().describe('Most-played item; present only for curated species.'),
52
+ ability: z.string().optional().describe('Most-played ability; present only for curated species.'),
53
+ nature: z.string().optional().describe('Most-played nature; present only for curated species.'),
54
+ evs: z.record(z.string(), z.number()).optional().describe('Most-played spread, keyed by stat id; present only for curated species.'),
55
+ moves: z.array(z.string()).optional().describe('The four most-played moves; present only for curated species.'),
56
+ note: z.string().optional().describe('"No curated set" — its speed below is a base-stat estimate; present only for uncurated species.'),
57
+ }))
58
+ .describe('One entry per opponent species, ordered most used first.'),
59
+ speedTiers: z
60
+ .object({
61
+ ourOrder: z.array(z.string()).describe('Your members, fastest first, with their real level-50 Speed.'),
62
+ theirOrder: z.array(z.string()).describe('Their members, fastest first; uncurated species use a base-stat estimate and say so in `races`.'),
63
+ races: z
64
+ .array(z.object({
65
+ ours: z.string().describe('Your member.'),
66
+ theirs: z.string().describe('Their member.'),
67
+ ourSpeed: z.number().int().describe('Your member\u2019s level-50 Speed.'),
68
+ theirSpeed: z.number().int().describe('Their Speed; flagged below when estimated.'),
69
+ margin: z.number().int().describe('How many points separate them.'),
70
+ weMoveFirst: z.boolean().describe('True when your member moves first.'),
71
+ estimated: z.boolean().optional().describe('True when their Speed is a base-stat estimate; present only then.'),
72
+ }))
73
+ .describe('Your top two against their top two, up to four races.'),
74
+ })
75
+ .describe('Where the Speed matchups stand.'),
76
+ relevantDamageCalcs: z
77
+ .array(z.object({
78
+ move: z.string().describe('The move rolled.'),
79
+ attacker: z.string().describe('Who attacks.'),
80
+ defender: z.string().describe('Who takes it.'),
81
+ damageRange: z.tuple([z.number(), z.number()]).describe('[minimum, maximum] damage.'),
82
+ koChance: z.string().optional().describe('KO chance text, e.g. "guaranteed 2HKO"; absent when the calc reports none.'),
83
+ description: z.string().describe('The rendered Showdown-format line.'),
84
+ }))
85
+ .describe('The key damage rolls, at most four: your hardest hit into each of their top two threats, and each threat\u2019s hardest hit back at your best answer.'),
86
+ recommendedBringFour: z
87
+ .object({
88
+ opponent: z.array(z.string()).describe('The opponent as resolved species names.'),
89
+ picks: z
90
+ .array(z.object({
91
+ species: z.string().describe('Member to bring.'),
92
+ offensive: z.number().int().describe('Opponent species it hits super-effectively.'),
93
+ defensive: z.number().int().describe('Opponent species that hit it super-effectively on STAB.'),
94
+ score: z.number().int().describe('`offensive` minus `defensive`.'),
95
+ }))
96
+ .describe('The recommended four, best first.'),
97
+ leftBehind: z
98
+ .array(z.object({
99
+ species: z.string().describe('Member left behind.'),
100
+ offensive: z.number().int(),
101
+ defensive: z.number().int(),
102
+ score: z.number().int(),
103
+ }))
104
+ .describe('The members not recommended.'),
105
+ atRiskTypes: z.array(z.string()).describe('Types the recommended four leave stacked and uncovered.'),
106
+ note: z.string().describe('What the pick is scored on and what it cannot see.'),
107
+ })
108
+ .describe('Which four of your six to bring, scored on the types team preview shows.'),
109
+ possibleLeads: z
110
+ .object({
111
+ pairs: z
112
+ .array(z.object({
113
+ support: z.string().describe('The lead support with Fake Out, Tailwind, Trick Room, Helping Hand, Follow Me, Rage Powder or Wide Guard.'),
114
+ attacker: z.string().describe('The fast member that follows it up.'),
115
+ why: z.string().describe('One-line reason the pairing works.'),
116
+ }))
117
+ .describe('Your strongest lead pairings; empty when no member supplied a lead-support move.'),
118
+ note: z.string().describe('The heuristic: supports pair with your fastest attackers; it cannot see their defensive answers.'),
119
+ })
120
+ .describe('What to open with.'),
121
+ dangerousOpponentLeads: z
122
+ .object({
123
+ pairs: z
124
+ .array(z.object({
125
+ support: z.string().describe('Their lead support.'),
126
+ attacker: z.string().describe('Their fast member that follows it up.'),
127
+ why: z.string().describe('One-line reason to watch for it.'),
128
+ }))
129
+ .describe('Their lead pairings, from curated movesets only; empty when none of their species have curated sets.'),
130
+ note: z.string().describe('Only curated species have movesets to read, so an uncurated opponent contributes nothing here.'),
131
+ })
132
+ .describe('What to watch for at team preview.'),
133
+ winConditions: z.array(z.string()).describe('The concrete ways the matchup is won: who answers which threat, and which Speed races are already yours.'),
134
+ lossConditions: z.array(z.string()).describe('The concrete ways it is lost: unanswered threats, losing the Speed race, and stacked weaknesses into their STAB.'),
135
+ pokemonToPreserve: z
136
+ .array(z.string())
137
+ .describe('Members that are the only super-effective answer to a threat — losing one forfeits that matchup.'),
138
+ matchupConfidence: z
139
+ .object({
140
+ score: z.number().int().describe('0-100: mean of threat coverage, Speed advantage and how much of their team is known sets.'),
141
+ note: z.string().describe('What the three components are.'),
142
+ })
143
+ .describe('A transparent read on how well the matchup is understood.'),
144
+ note: z.string().describe('What is estimated rather than known: uncurated opponent speeds and moves, and everything the damage calcs do not model.'),
145
+ },
146
+ }, wrap(async (args) => {
147
+ const dex = getDex(9);
148
+ const regulationId = args.regulation ?? (REGULATION_SETS.find((s) => setStatus(s) === 'current')?.id ?? 'm-c');
149
+ const set = getRegulationSet(regulationId);
150
+ if (!set) {
151
+ throw new Error(`Unknown regulation set "${regulationId}". Available: ${REGULATION_SETS.map((s) => s.name).join(', ')}.`);
152
+ }
153
+ const list = getThreatList(set.id);
154
+ const { members, unknownMoves } = resolveMembers(args.team);
155
+ // --- Opponent resolution: curated where a set exists, base-stat otherwise ---
156
+ const opponents = [];
157
+ for (const entry of args.opponent) {
158
+ const parsed = typeof entry === 'string' ? { species: entry } : entry;
159
+ const sp = dex.species.get(parsed.species);
160
+ requireExists(sp, 'Pokemon species', parsed.species);
161
+ const curatedHit = findThreat(parsed.species, set.id);
162
+ if (curatedHit) {
163
+ const t = curatedHit.threat;
164
+ const form = t.megaForm ?? t.form ?? t.species;
165
+ const fs = dex.species.get(form);
166
+ const moveTypes = t.moves
167
+ .map((mv) => dex.moves.get(mv))
168
+ .filter((m) => m.exists)
169
+ .map((m) => m.type);
170
+ opponents.push({
171
+ species: sp.name,
172
+ types: [...sp.types],
173
+ baseSpe: sp.baseStats.spe,
174
+ speed: finalStat(9, 'spe', fs.baseStats.spe, 31, t.evs?.spe ?? 0, 50, t.nature),
175
+ speedKnown: true,
176
+ moves: t.moves,
177
+ moveTypes,
178
+ curated: { threat: t, form, usage: t.usage, role: t.role },
179
+ });
180
+ }
181
+ else {
182
+ const moveTypes = (parsed.moves ?? [])
183
+ .map((mv) => dex.moves.get(mv))
184
+ .filter((m) => m.exists)
185
+ .map((m) => m.type);
186
+ opponents.push({
187
+ species: sp.name,
188
+ types: [...sp.types],
189
+ baseSpe: sp.baseStats.spe,
190
+ speed: sp.baseStats.spe,
191
+ speedKnown: false,
192
+ moves: parsed.moves ?? [],
193
+ moveTypes,
194
+ });
195
+ }
196
+ }
197
+ const ranked = [...opponents].sort((a, b) => (b.curated?.usage ?? -1) - (a.curated?.usage ?? -1));
198
+ const likelySets = ranked.map((o, i) => o.curated
199
+ ? {
200
+ species: o.curated.form,
201
+ priority: i + 1,
202
+ usage: o.curated.usage,
203
+ role: o.curated.role,
204
+ item: o.curated.threat.item,
205
+ ability: o.curated.threat.ability,
206
+ nature: o.curated.threat.nature,
207
+ evs: o.curated.threat.evs,
208
+ moves: o.curated.threat.moves,
209
+ }
210
+ : { species: o.species, priority: null, note: 'No curated set' });
211
+ // --- Speed tiers ---
212
+ const ourOrder = [...members].sort((a, b) => b.speed - a.speed);
213
+ const theirOrder = [...opponents].sort((a, b) => b.speed - a.speed);
214
+ const races = [];
215
+ for (const theirs of theirOrder.slice(0, 2)) {
216
+ for (const ours of ourOrder.slice(0, 2)) {
217
+ races.push({
218
+ ours: ours.species,
219
+ theirs: theirs.species,
220
+ ourSpeed: ours.speed,
221
+ theirSpeed: theirs.speed,
222
+ margin: Math.abs(ours.speed - theirs.speed),
223
+ weMoveFirst: ours.speed >= theirs.speed,
224
+ ...(theirs.speedKnown ? {} : { estimated: true }),
225
+ });
226
+ }
227
+ }
228
+ // --- Damage calcs: our hardest hit into their top two threats, and back ---
229
+ const calcs = [];
230
+ const topThreats = opponents.filter((o) => o.curated).slice(0, 2);
231
+ for (const threat of topThreats) {
232
+ // Their side: threat's hardest move into our best answer (highest SE coverage on it).
233
+ let bestAnswer = ourOrder[0];
234
+ let bestEff = 0;
235
+ for (const m of members) {
236
+ const eff = Math.max(...[...new Set([...m.types, ...m.moveTypes])].map((t) => typeEffectiveness(t, threat.types, 9)));
237
+ if (eff > bestEff) {
238
+ bestEff = eff;
239
+ bestAnswer = m;
240
+ }
241
+ }
242
+ let theirMove;
243
+ for (const mv of threat.moves) {
244
+ const m = dex.moves.get(mv);
245
+ const eff = typeEffectiveness(m.type, bestAnswer.types, 9);
246
+ if (!m.exists || eff === 0)
247
+ continue;
248
+ const score = eff * (m.basePower || 0);
249
+ if (score > 0 && (!theirMove || score > theirMove.score))
250
+ theirMove = { name: m.name, score };
251
+ }
252
+ if (theirMove) {
253
+ const res = damageResult(9, {
254
+ species: threat.curated.form,
255
+ level: 50,
256
+ item: threat.curated.threat.item,
257
+ ability: threat.curated.threat.ability,
258
+ nature: threat.curated.threat.nature,
259
+ evs: threat.curated.threat.evs,
260
+ moves: threat.curated.threat.moves,
261
+ }, { ...bestAnswer.set, level: 50 }, theirMove.name);
262
+ calcs.push({
263
+ move: theirMove.name,
264
+ attacker: res.attacker.species,
265
+ defender: res.defender.species,
266
+ damageRange: res.damageRange,
267
+ koChance: res.koChance,
268
+ description: res.description,
269
+ });
270
+ }
271
+ // Our side: hardest hit into the threat.
272
+ const ourMove = await hardestHit(dex, members, threat.types);
273
+ if (ourMove) {
274
+ const res = damageResult(9, { ...ourMove.member.set, level: 50 }, {
275
+ species: threat.curated.form,
276
+ level: 50,
277
+ item: threat.curated.threat.item,
278
+ ability: threat.curated.threat.ability,
279
+ nature: threat.curated.threat.nature,
280
+ evs: threat.curated.threat.evs,
281
+ moves: threat.curated.threat.moves,
282
+ }, ourMove.move);
283
+ calcs.push({
284
+ move: ourMove.move,
285
+ attacker: res.attacker.species,
286
+ defender: res.defender.species,
287
+ damageRange: res.damageRange,
288
+ koChance: res.koChance,
289
+ description: res.description,
290
+ });
291
+ }
292
+ }
293
+ // --- Bring four, leads, conditions ---
294
+ const bringFour = planBringFour(members.map((m) => ({ species: m.species, types: m.types, moveTypes: m.moveTypes })), opponents.map((o) => ({ name: o.species, types: o.types })));
295
+ const ourSupports = members.filter((m) => m.moves.some((mv) => LEAD_MOVES.includes(toKey(mv))));
296
+ const ourAttackers = [...members].sort((a, b) => b.speed - a.speed).filter((m) => !ourSupports.includes(m)).slice(0, 2);
297
+ const ourPairs = [];
298
+ for (const s of ourSupports.slice(0, 3)) {
299
+ for (const a of ourAttackers.slice(0, 1)) {
300
+ ourPairs.push({
301
+ support: s.species,
302
+ attacker: a.species,
303
+ why: `${s.species} opens with ${s.moves.find((mv) => LEAD_MOVES.includes(toKey(mv)))} to buy ${a.species} (${a.speed} Speed) a free turn.`,
304
+ });
305
+ }
306
+ }
307
+ const theirSupports = opponents.filter((m) => m.moves.some((mv) => LEAD_MOVES.includes(toKey(mv))));
308
+ const theirAttackers = [...opponents].sort((a, b) => b.speed - a.speed).filter((m) => !theirSupports.includes(m)).slice(0, 2);
309
+ const theirPairs = [];
310
+ for (const s of theirSupports.slice(0, 3)) {
311
+ for (const a of theirAttackers.slice(0, 1)) {
312
+ theirPairs.push({
313
+ support: s.species,
314
+ attacker: a.species,
315
+ why: `Watch for ${s.species} opening with ${s.moves.find((mv) => LEAD_MOVES.includes(toKey(mv)))} into ${a.species}.`,
316
+ });
317
+ }
318
+ }
319
+ const threatAnswers = opponents.map((o) => {
320
+ let best = 0;
321
+ let by;
322
+ const solvers = [];
323
+ for (const m of members) {
324
+ const eff = Math.max(...[...new Set([...m.types, ...m.moveTypes])].map((t) => typeEffectiveness(t, o.types, 9)));
325
+ if (eff > best) {
326
+ best = eff;
327
+ by = m.species;
328
+ }
329
+ if (eff >= 2)
330
+ solvers.push(m.species);
331
+ }
332
+ return { species: o.species, best, solvers, by };
333
+ });
334
+ const winConditions = [];
335
+ const lossConditions = [];
336
+ const preserve = new Set();
337
+ for (const a of threatAnswers.filter((t) => t.best >= 2).slice(0, 3)) {
338
+ winConditions.push(`${a.by} answers ${a.species} (${a.best}\u00d7 from STAB or a supplied move).`);
339
+ if (a.solvers.length === 1)
340
+ preserve.add(a.solvers[0]);
341
+ }
342
+ for (const a of threatAnswers.filter((t) => t.best < 2).slice(0, 3)) {
343
+ lossConditions.push(`No super-effective answer to ${a.species} (best hit ${a.best}\u00d7).`);
344
+ }
345
+ const ourFastest = ourOrder[0];
346
+ const theirFastest = theirOrder[0];
347
+ if (ourFastest.speed >= theirFastest.speed) {
348
+ winConditions.push(`${ourFastest.species} (${ourFastest.speed}) outruns their fastest, ${theirFastest.species} (${theirFastest.speed}), by ${ourFastest.speed - theirFastest.speed}.`);
349
+ }
350
+ else {
351
+ lossConditions.push(`${theirFastest.species} (${theirFastest.speed}) moves before ${ourFastest.species} (${ourFastest.speed}) by ${theirFastest.speed - ourFastest.speed}.`);
352
+ }
353
+ const theirStab = new Set(opponents.flatMap((o) => o.types));
354
+ for (const t of TYPES18) {
355
+ if (!theirStab.has(t))
356
+ continue;
357
+ let weak = 0;
358
+ for (const m of members)
359
+ if (typeEffectiveness(t, m.types, 9) > 1)
360
+ weak++;
361
+ if (weak >= 2)
362
+ lossConditions.push(`${weak} of your members are weak to ${t}, which their team carries on STAB.`);
363
+ }
364
+ const answered = threatAnswers.filter((t) => t.best >= 2).length;
365
+ const coveragePart = opponents.length ? answered / opponents.length : 0.5;
366
+ const speedPart = ourFastest.speed >= theirFastest.speed ? 1 : 0.5;
367
+ const knownPart = opponents.length ? opponents.filter((o) => o.curated).length / opponents.length : 0;
368
+ const confidence = Math.round(((coveragePart + speedPart + knownPart) / 3) * 100);
369
+ return ok({
370
+ regulation: set.name,
371
+ opponent: opponents.map((o) => o.species),
372
+ likelySets,
373
+ speedTiers: {
374
+ ourOrder: ourOrder.map((m) => m.species),
375
+ theirOrder: theirOrder.map((o) => o.species),
376
+ races,
377
+ },
378
+ relevantDamageCalcs: calcs.slice(0, 4),
379
+ recommendedBringFour: {
380
+ ...bringFour,
381
+ note: 'Scored on type alone, which is what team preview gives you: ranked is closed teamlist, so the opponent\u2019s sets are unknown by design. `offensive` counts the opponent species a member hits super-effectively from STAB or a supplied move, `defensive` counts those that hit it back on their STAB. Speed, bulk, damage rolls and abilities are not modelled here \u2014 pair it with `relevantDamageCalcs`.',
382
+ },
383
+ possibleLeads: {
384
+ pairs: ourPairs,
385
+ note: 'Lead supports are members carrying Fake Out, Tailwind, Trick Room, Helping Hand, Follow Me, Rage Powder or Wide Guard, paired with your fastest attackers. It cannot see their defensive answers \u2014 treat it as a starting point, not a lock.',
386
+ },
387
+ dangerousOpponentLeads: {
388
+ pairs: theirPairs,
389
+ note: 'Read only from curated movesets; an opponent species without one contributes nothing here.',
390
+ },
391
+ winConditions: winConditions.slice(0, 4),
392
+ lossConditions: lossConditions.slice(0, 5),
393
+ pokemonToPreserve: [...preserve],
394
+ matchupConfidence: {
395
+ score: confidence,
396
+ note: 'Mean of three components: share of their team your team has a super-effective answer for, whether your fastest outruns theirs, and how much of their team is known curated sets. A rough read, not a metagame rating.',
397
+ },
398
+ ...(unknownMoves.length ? { unknownMoves: [...new Set(unknownMoves)] } : {}),
399
+ note: list
400
+ ? `Opponent sets come from the ${list.name} usage list (${list.sourceAsOf}); uncurated opponent species use base-stat Speed estimates and contribute no moves, and Choice Scarf is not modelled on either side.`
401
+ : `No usage list exists for ${set.name}, so every opponent species is estimated from base stats and STAB alone.`,
402
+ });
403
+ }));
404
+ }
405
+ /** The team's hardest hit into a target: best super-effective power among supplied moves, else among the learnset. */
406
+ async function hardestHit(dex, members, targetTypes) {
407
+ let best;
408
+ for (const m of members) {
409
+ for (const mv of m.moves) {
410
+ const move = dex.moves.get(mv);
411
+ const eff = move.exists ? typeEffectiveness(move.type, targetTypes, 9) : 0;
412
+ if (eff === 0)
413
+ continue;
414
+ const stab = m.types.includes(move.type) ? 1.5 : 1;
415
+ const score = eff * (move.basePower || 0) * stab;
416
+ if (score > 0 && (!best || score > best.score))
417
+ best = { member: m, move: move.name, score };
418
+ }
419
+ // Learnset fallback for members that listed no moves: the strongest learnable hit.
420
+ const learnable = await learnableMoveIds(dex, dex.species.get(m.species));
421
+ for (const id of learnable) {
422
+ const move = dex.moves.get(id);
423
+ const eff = move.exists ? typeEffectiveness(move.type, targetTypes, 9) : 0;
424
+ if (eff === 0 || !(move.basePower || 0))
425
+ continue;
426
+ const stab = m.types.includes(move.type) ? 1.5 : 1;
427
+ const score = eff * move.basePower * stab;
428
+ if (!best || score > best.score)
429
+ best = { member: m, move: move.name, score };
430
+ }
431
+ }
432
+ return best ? { member: best.member, move: best.move } : undefined;
433
+ }
434
+ //# sourceMappingURL=matchup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchup.js","sourceRoot":"","sources":["../../src/tools/matchup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,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AC,EAAE,CAAC,CAAC;YAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;gBAAE,SAAS;YAClD,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAC1C,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK;gBAAE,IAAI,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAChF,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Sprite URLs for a team: one call for every member, because a team is the unit
3
+ * of work. This tool returns addresses, never image bytes — it reads a committed
4
+ * id table generated by `scripts/build-sprites.mjs`, so the server performs no
5
+ * network I/O and the caller (or the caller's client) does the fetching.
6
+ *
7
+ * PokéAPI assigns form ids above 10000 that follow neither the National Dex
8
+ * number nor the forme name, which is why the mapping is a build-time table
9
+ * rather than a runtime rule; a species PokéAPI has no entry for is reported
10
+ * unresolved instead of guessed at.
11
+ */
12
+ import { z } from 'zod';
13
+ import { getDex, toID } from '../dex.js';
14
+ import { ok, wrap, READ_ONLY_ANNOTATIONS } from '../result.js';
15
+ import raw from '../sprites.data.js';
16
+ const TABLE = raw;
17
+ const ARTWORK_URL = (id) => `https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/${id}.png`;
18
+ const ICON_URL = (id) => `https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${id}.png`;
19
+ export function registerSpritesTool(server) {
20
+ server.registerTool('get_sprites', {
21
+ title: 'Get sprite URLs for a team',
22
+ description: 'Return sprite URLs for a whole team in one call — the team is the unit of work, so pass every species at once instead of calling per member. Each entry carries the resolved species name, its National Dex number, the URL, and alt text; `size: "artwork"` gives the 475\u00d7475 transparent official art (default) and `"icon"` the 96\u00d796 game sprite for compact rows. The response is addresses, not image bytes: the server reads a committed id table generated by `scripts/build-sprites.mjs` and performs no network I/O itself (openWorldHint false), so the caller fetches the URLs client-side. PokéAPI\u2019s form ids follow neither the dex number nor the forme name, which is why the mapping is baked at build time; a species with no PokéAPI entry (cosmetic or totem forms, a few Champions-exclusive Megas) is reported in `unresolved` alongside the rest — one bad name never fails the batch. Species resolve case- and punctuation-insensitively through the same dataset as the other tools. Read-only and offline.',
23
+ annotations: READ_ONLY_ANNOTATIONS,
24
+ inputSchema: {
25
+ species: z
26
+ .array(z.string())
27
+ .min(1)
28
+ .max(30)
29
+ .describe('Species names, e.g. ["Garchomp", "Rotom-Wash", "Salamence-Mega"], in any order; a whole team is the expected payload.'),
30
+ size: z
31
+ .enum(['artwork', 'icon'])
32
+ .optional()
33
+ .describe('Which image the URLs point at: "artwork" (default) is the 475\u00d7475 transparent official art, "icon" is the 96\u00d796 game sprite for a compact row.'),
34
+ },
35
+ outputSchema: {
36
+ sprites: z
37
+ .array(z.object({
38
+ species: z.string().describe('Resolved species name, e.g. "Salamence-Mega".'),
39
+ dexNumber: z.number().int().describe('National Dex number of the base species, e.g. 373 for Salamence-Mega.'),
40
+ url: z.string().describe('URL of the PNG; fetch it client-side, this server does no I/O.'),
41
+ altText: z.string().describe('Accessible description of the image.'),
42
+ }))
43
+ .describe('One entry per resolved species, in the order supplied.'),
44
+ unresolved: z
45
+ .array(z.string())
46
+ .optional()
47
+ .describe('Species names as supplied that have no PokéAPI entry; absent when everything resolved.'),
48
+ note: z.string().describe('Why the response is URLs rather than bytes, and what unresolved means.'),
49
+ },
50
+ }, wrap(async (args) => {
51
+ const dex = getDex(9);
52
+ const kind = args.size === 'icon' ? 'in-game sprite' : 'official artwork';
53
+ const urlFor = args.size === 'icon' ? ICON_URL : ARTWORK_URL;
54
+ const sprites = [];
55
+ const unresolved = [];
56
+ for (const name of args.species) {
57
+ const sp = dex.species.get(name);
58
+ const id = sp.exists ? TABLE[toID(sp.name)] : undefined;
59
+ if (id === undefined) {
60
+ unresolved.push(name);
61
+ continue;
62
+ }
63
+ sprites.push({
64
+ species: sp.name,
65
+ dexNumber: sp.num,
66
+ url: urlFor(id),
67
+ altText: `${kind} of ${sp.name}`,
68
+ });
69
+ }
70
+ return ok({
71
+ sprites,
72
+ ...(unresolved.length ? { unresolved } : {}),
73
+ note: 'URLs only, no image bytes: the server reads a committed id table (scripts/build-sprites.mjs) and performs no network I/O, so fetch these client-side. A name lands in `unresolved` only when PokéAPI has no entry for that species at all — never because of a fetch failure.',
74
+ });
75
+ }));
76
+ }
77
+ //# sourceMappingURL=sprites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprites.js","sourceRoot":"","sources":["../../src/tools/sprites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,GAAG,MAAM,oBAAoB,CAAC;AAErC,MAAM,KAAK,GAA2B,GAAG,CAAC;AAE1C,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,EAAE,CAC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