@withinfocus/tba-mcp-server 0.2.6 → 0.3.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,918 @@
1
+ import { z } from 'zod';
2
+ import { makeApiRequest } from './utils.js';
3
+ import { TeamKeySchema, YearSchema, EventKeySchema, TeamSchema, EventSchema, AwardSchema, MatchSchema, RankingSchema, AllianceSchema, DistrictPointsSchema, InsightsSchema, DistrictSchema, RobotSchema, MediaSchema, StatusSchema, EventOPRsSchema, TeamEventStatusSchema, DistrictRankingSchema, TeamSimpleSchema, EventSimpleSchema, MatchSimpleSchema, ZebraSchema, PredictionSchema, TeamHistorySchema, } from './schemas.js';
4
+ export async function handleToolCall(name, args) {
5
+ switch (name) {
6
+ case 'get_team': {
7
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
8
+ const data = await makeApiRequest(`/team/${team_key}`);
9
+ const team = TeamSchema.parse(data);
10
+ return {
11
+ content: [
12
+ {
13
+ type: 'text',
14
+ text: JSON.stringify(team, null, 2),
15
+ },
16
+ ],
17
+ };
18
+ }
19
+ case 'get_team_events': {
20
+ const { team_key, year } = z
21
+ .object({
22
+ team_key: TeamKeySchema,
23
+ year: YearSchema,
24
+ })
25
+ .parse(args);
26
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}`);
27
+ const events = z.array(EventSchema).parse(data);
28
+ return {
29
+ content: [
30
+ {
31
+ type: 'text',
32
+ text: JSON.stringify(events, null, 2),
33
+ },
34
+ ],
35
+ };
36
+ }
37
+ case 'get_team_awards': {
38
+ const { team_key, year } = z
39
+ .object({
40
+ team_key: TeamKeySchema,
41
+ year: YearSchema,
42
+ })
43
+ .parse(args);
44
+ const data = await makeApiRequest(`/team/${team_key}/awards/${year}`);
45
+ const awards = z.array(AwardSchema).parse(data);
46
+ return {
47
+ content: [
48
+ {
49
+ type: 'text',
50
+ text: JSON.stringify(awards, null, 2),
51
+ },
52
+ ],
53
+ };
54
+ }
55
+ case 'get_team_matches': {
56
+ const { team_key, year } = z
57
+ .object({
58
+ team_key: TeamKeySchema,
59
+ year: YearSchema,
60
+ })
61
+ .parse(args);
62
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}`);
63
+ const matches = z.array(MatchSchema).parse(data);
64
+ return {
65
+ content: [
66
+ {
67
+ type: 'text',
68
+ text: JSON.stringify(matches, null, 2),
69
+ },
70
+ ],
71
+ };
72
+ }
73
+ case 'get_events': {
74
+ const { year } = z.object({ year: YearSchema }).parse(args);
75
+ const data = await makeApiRequest(`/events/${year}`);
76
+ const events = z.array(EventSchema).parse(data);
77
+ return {
78
+ content: [
79
+ {
80
+ type: 'text',
81
+ text: JSON.stringify(events, null, 2),
82
+ },
83
+ ],
84
+ };
85
+ }
86
+ case 'get_event': {
87
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
88
+ const data = await makeApiRequest(`/event/${event_key}`);
89
+ const event = EventSchema.parse(data);
90
+ return {
91
+ content: [
92
+ {
93
+ type: 'text',
94
+ text: JSON.stringify(event, null, 2),
95
+ },
96
+ ],
97
+ };
98
+ }
99
+ case 'get_event_teams': {
100
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
101
+ const data = await makeApiRequest(`/event/${event_key}/teams`);
102
+ const teams = z.array(TeamSchema).parse(data);
103
+ return {
104
+ content: [
105
+ {
106
+ type: 'text',
107
+ text: JSON.stringify(teams, null, 2),
108
+ },
109
+ ],
110
+ };
111
+ }
112
+ case 'get_event_rankings': {
113
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
114
+ const data = await makeApiRequest(`/event/${event_key}/rankings`);
115
+ const rankings = RankingSchema.parse(data);
116
+ return {
117
+ content: [
118
+ {
119
+ type: 'text',
120
+ text: JSON.stringify(rankings, null, 2),
121
+ },
122
+ ],
123
+ };
124
+ }
125
+ case 'get_event_matches': {
126
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
127
+ const data = await makeApiRequest(`/event/${event_key}/matches`);
128
+ const matches = z.array(MatchSchema).parse(data);
129
+ return {
130
+ content: [
131
+ {
132
+ type: 'text',
133
+ text: JSON.stringify(matches, null, 2),
134
+ },
135
+ ],
136
+ };
137
+ }
138
+ case 'get_event_alliances': {
139
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
140
+ const data = await makeApiRequest(`/event/${event_key}/alliances`);
141
+ const alliances = z.array(AllianceSchema).parse(data);
142
+ return {
143
+ content: [
144
+ {
145
+ type: 'text',
146
+ text: JSON.stringify(alliances, null, 2),
147
+ },
148
+ ],
149
+ };
150
+ }
151
+ case 'get_event_insights': {
152
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
153
+ const data = await makeApiRequest(`/event/${event_key}/insights`);
154
+ const insights = InsightsSchema.parse(data);
155
+ return {
156
+ content: [
157
+ {
158
+ type: 'text',
159
+ text: JSON.stringify(insights, null, 2),
160
+ },
161
+ ],
162
+ };
163
+ }
164
+ case 'get_event_district_points': {
165
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
166
+ const data = await makeApiRequest(`/event/${event_key}/district_points`);
167
+ const districtPoints = DistrictPointsSchema.parse(data);
168
+ return {
169
+ content: [
170
+ {
171
+ type: 'text',
172
+ text: JSON.stringify(districtPoints, null, 2),
173
+ },
174
+ ],
175
+ };
176
+ }
177
+ case 'get_team_years_participated': {
178
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
179
+ const data = await makeApiRequest(`/team/${team_key}/years_participated`);
180
+ const years = z.array(z.number()).parse(data);
181
+ return {
182
+ content: [
183
+ {
184
+ type: 'text',
185
+ text: JSON.stringify(years, null, 2),
186
+ },
187
+ ],
188
+ };
189
+ }
190
+ case 'get_team_districts': {
191
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
192
+ const data = await makeApiRequest(`/team/${team_key}/districts`);
193
+ const districts = z.array(DistrictSchema).parse(data);
194
+ return {
195
+ content: [
196
+ {
197
+ type: 'text',
198
+ text: JSON.stringify(districts, null, 2),
199
+ },
200
+ ],
201
+ };
202
+ }
203
+ case 'get_team_robots': {
204
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
205
+ const data = await makeApiRequest(`/team/${team_key}/robots`);
206
+ const robots = z.array(RobotSchema).parse(data);
207
+ return {
208
+ content: [
209
+ {
210
+ type: 'text',
211
+ text: JSON.stringify(robots, null, 2),
212
+ },
213
+ ],
214
+ };
215
+ }
216
+ case 'get_team_media': {
217
+ const { team_key, year } = z
218
+ .object({
219
+ team_key: TeamKeySchema,
220
+ year: YearSchema,
221
+ })
222
+ .parse(args);
223
+ const data = await makeApiRequest(`/team/${team_key}/media/${year}`);
224
+ const media = z.array(MediaSchema).parse(data);
225
+ return {
226
+ content: [
227
+ {
228
+ type: 'text',
229
+ text: JSON.stringify(media, null, 2),
230
+ },
231
+ ],
232
+ };
233
+ }
234
+ case 'get_team_event_matches': {
235
+ const { team_key, event_key } = z
236
+ .object({
237
+ team_key: TeamKeySchema,
238
+ event_key: EventKeySchema,
239
+ })
240
+ .parse(args);
241
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches`);
242
+ const matches = z.array(MatchSchema).parse(data);
243
+ return {
244
+ content: [
245
+ {
246
+ type: 'text',
247
+ text: JSON.stringify(matches, null, 2),
248
+ },
249
+ ],
250
+ };
251
+ }
252
+ case 'get_teams': {
253
+ const { page_num } = z
254
+ .object({ page_num: z.number().min(0) })
255
+ .parse(args);
256
+ const data = await makeApiRequest(`/teams/${page_num}`);
257
+ const teams = z.array(TeamSchema).parse(data);
258
+ return {
259
+ content: [
260
+ {
261
+ type: 'text',
262
+ text: JSON.stringify(teams, null, 2),
263
+ },
264
+ ],
265
+ };
266
+ }
267
+ case 'get_status': {
268
+ const data = await makeApiRequest('/status');
269
+ const status = StatusSchema.parse(data);
270
+ return {
271
+ content: [
272
+ {
273
+ type: 'text',
274
+ text: JSON.stringify(status, null, 2),
275
+ },
276
+ ],
277
+ };
278
+ }
279
+ case 'get_match': {
280
+ const { match_key } = z.object({ match_key: z.string() }).parse(args);
281
+ const data = await makeApiRequest(`/match/${match_key}`);
282
+ const match = MatchSchema.parse(data);
283
+ return {
284
+ content: [
285
+ {
286
+ type: 'text',
287
+ text: JSON.stringify(match, null, 2),
288
+ },
289
+ ],
290
+ };
291
+ }
292
+ case 'get_event_oprs': {
293
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
294
+ const data = await makeApiRequest(`/event/${event_key}/oprs`);
295
+ const oprs = EventOPRsSchema.parse(data);
296
+ return {
297
+ content: [
298
+ {
299
+ type: 'text',
300
+ text: JSON.stringify(oprs, null, 2),
301
+ },
302
+ ],
303
+ };
304
+ }
305
+ case 'get_event_awards': {
306
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
307
+ const data = await makeApiRequest(`/event/${event_key}/awards`);
308
+ const awards = z.array(AwardSchema).parse(data);
309
+ return {
310
+ content: [
311
+ {
312
+ type: 'text',
313
+ text: JSON.stringify(awards, null, 2),
314
+ },
315
+ ],
316
+ };
317
+ }
318
+ case 'get_team_awards_all': {
319
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
320
+ const data = await makeApiRequest(`/team/${team_key}/awards`);
321
+ const awards = z.array(AwardSchema).parse(data);
322
+ return {
323
+ content: [
324
+ {
325
+ type: 'text',
326
+ text: JSON.stringify(awards, null, 2),
327
+ },
328
+ ],
329
+ };
330
+ }
331
+ case 'get_team_events_all': {
332
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
333
+ const data = await makeApiRequest(`/team/${team_key}/events`);
334
+ const events = z.array(EventSchema).parse(data);
335
+ return {
336
+ content: [
337
+ {
338
+ type: 'text',
339
+ text: JSON.stringify(events, null, 2),
340
+ },
341
+ ],
342
+ };
343
+ }
344
+ case 'get_team_event_status': {
345
+ const { team_key, event_key } = z
346
+ .object({
347
+ team_key: TeamKeySchema,
348
+ event_key: EventKeySchema,
349
+ })
350
+ .parse(args);
351
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/status`);
352
+ const status = TeamEventStatusSchema.parse(data);
353
+ return {
354
+ content: [
355
+ {
356
+ type: 'text',
357
+ text: JSON.stringify(status, null, 2),
358
+ },
359
+ ],
360
+ };
361
+ }
362
+ case 'get_districts': {
363
+ const { year } = z.object({ year: YearSchema }).parse(args);
364
+ const data = await makeApiRequest(`/districts/${year}`);
365
+ const districts = z.array(DistrictSchema).parse(data);
366
+ return {
367
+ content: [
368
+ {
369
+ type: 'text',
370
+ text: JSON.stringify(districts, null, 2),
371
+ },
372
+ ],
373
+ };
374
+ }
375
+ case 'get_district_rankings': {
376
+ const { district_key } = z
377
+ .object({ district_key: z.string() })
378
+ .parse(args);
379
+ const data = await makeApiRequest(`/district/${district_key}/rankings`);
380
+ const rankings = z.array(DistrictRankingSchema).parse(data);
381
+ return {
382
+ content: [
383
+ {
384
+ type: 'text',
385
+ text: JSON.stringify(rankings, null, 2),
386
+ },
387
+ ],
388
+ };
389
+ }
390
+ case 'get_teams_simple': {
391
+ const { page_num } = z
392
+ .object({ page_num: z.number().min(0) })
393
+ .parse(args);
394
+ const data = await makeApiRequest(`/teams/${page_num}/simple`);
395
+ const teams = z.array(TeamSimpleSchema).parse(data);
396
+ return {
397
+ content: [
398
+ {
399
+ type: 'text',
400
+ text: JSON.stringify(teams, null, 2),
401
+ },
402
+ ],
403
+ };
404
+ }
405
+ case 'get_teams_keys': {
406
+ const { page_num } = z
407
+ .object({ page_num: z.number().min(0) })
408
+ .parse(args);
409
+ const data = await makeApiRequest(`/teams/${page_num}/keys`);
410
+ const keys = z.array(z.string()).parse(data);
411
+ return {
412
+ content: [
413
+ {
414
+ type: 'text',
415
+ text: JSON.stringify(keys, null, 2),
416
+ },
417
+ ],
418
+ };
419
+ }
420
+ case 'get_teams_by_year': {
421
+ const { year, page_num } = z
422
+ .object({
423
+ year: YearSchema,
424
+ page_num: z.number().min(0),
425
+ })
426
+ .parse(args);
427
+ const data = await makeApiRequest(`/teams/${year}/${page_num}`);
428
+ const teams = z.array(TeamSchema).parse(data);
429
+ return {
430
+ content: [
431
+ {
432
+ type: 'text',
433
+ text: JSON.stringify(teams, null, 2),
434
+ },
435
+ ],
436
+ };
437
+ }
438
+ case 'get_teams_by_year_simple': {
439
+ const { year, page_num } = z
440
+ .object({
441
+ year: YearSchema,
442
+ page_num: z.number().min(0),
443
+ })
444
+ .parse(args);
445
+ const data = await makeApiRequest(`/teams/${year}/${page_num}/simple`);
446
+ const teams = z.array(TeamSimpleSchema).parse(data);
447
+ return {
448
+ content: [
449
+ {
450
+ type: 'text',
451
+ text: JSON.stringify(teams, null, 2),
452
+ },
453
+ ],
454
+ };
455
+ }
456
+ case 'get_teams_by_year_keys': {
457
+ const { year, page_num } = z
458
+ .object({
459
+ year: YearSchema,
460
+ page_num: z.number().min(0),
461
+ })
462
+ .parse(args);
463
+ const data = await makeApiRequest(`/teams/${year}/${page_num}/keys`);
464
+ const keys = z.array(z.string()).parse(data);
465
+ return {
466
+ content: [
467
+ {
468
+ type: 'text',
469
+ text: JSON.stringify(keys, null, 2),
470
+ },
471
+ ],
472
+ };
473
+ }
474
+ case 'get_team_simple': {
475
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
476
+ const data = await makeApiRequest(`/team/${team_key}/simple`);
477
+ const team = TeamSimpleSchema.parse(data);
478
+ return {
479
+ content: [
480
+ {
481
+ type: 'text',
482
+ text: JSON.stringify(team, null, 2),
483
+ },
484
+ ],
485
+ };
486
+ }
487
+ case 'get_event_simple': {
488
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
489
+ const data = await makeApiRequest(`/event/${event_key}/simple`);
490
+ const event = EventSimpleSchema.parse(data);
491
+ return {
492
+ content: [
493
+ {
494
+ type: 'text',
495
+ text: JSON.stringify(event, null, 2),
496
+ },
497
+ ],
498
+ };
499
+ }
500
+ case 'get_events_simple': {
501
+ const { year } = z.object({ year: YearSchema }).parse(args);
502
+ const data = await makeApiRequest(`/events/${year}/simple`);
503
+ const events = z.array(EventSimpleSchema).parse(data);
504
+ return {
505
+ content: [
506
+ {
507
+ type: 'text',
508
+ text: JSON.stringify(events, null, 2),
509
+ },
510
+ ],
511
+ };
512
+ }
513
+ case 'get_events_keys': {
514
+ const { year } = z.object({ year: YearSchema }).parse(args);
515
+ const data = await makeApiRequest(`/events/${year}/keys`);
516
+ const keys = z.array(z.string()).parse(data);
517
+ return {
518
+ content: [
519
+ {
520
+ type: 'text',
521
+ text: JSON.stringify(keys, null, 2),
522
+ },
523
+ ],
524
+ };
525
+ }
526
+ case 'get_match_simple': {
527
+ const { match_key } = z.object({ match_key: z.string() }).parse(args);
528
+ const data = await makeApiRequest(`/match/${match_key}/simple`);
529
+ const match = MatchSimpleSchema.parse(data);
530
+ return {
531
+ content: [
532
+ {
533
+ type: 'text',
534
+ text: JSON.stringify(match, null, 2),
535
+ },
536
+ ],
537
+ };
538
+ }
539
+ case 'get_team_events_simple': {
540
+ const { team_key, year } = z
541
+ .object({
542
+ team_key: TeamKeySchema,
543
+ year: YearSchema,
544
+ })
545
+ .parse(args);
546
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/simple`);
547
+ const events = z.array(EventSimpleSchema).parse(data);
548
+ return {
549
+ content: [
550
+ {
551
+ type: 'text',
552
+ text: JSON.stringify(events, null, 2),
553
+ },
554
+ ],
555
+ };
556
+ }
557
+ case 'get_team_events_keys': {
558
+ const { team_key, year } = z
559
+ .object({
560
+ team_key: TeamKeySchema,
561
+ year: YearSchema,
562
+ })
563
+ .parse(args);
564
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/keys`);
565
+ const keys = z.array(z.string()).parse(data);
566
+ return {
567
+ content: [
568
+ {
569
+ type: 'text',
570
+ text: JSON.stringify(keys, null, 2),
571
+ },
572
+ ],
573
+ };
574
+ }
575
+ case 'get_team_event_awards': {
576
+ const { team_key, event_key } = z
577
+ .object({
578
+ team_key: TeamKeySchema,
579
+ event_key: EventKeySchema,
580
+ })
581
+ .parse(args);
582
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/awards`);
583
+ const awards = z.array(AwardSchema).parse(data);
584
+ return {
585
+ content: [
586
+ {
587
+ type: 'text',
588
+ text: JSON.stringify(awards, null, 2),
589
+ },
590
+ ],
591
+ };
592
+ }
593
+ case 'get_team_matches_simple': {
594
+ const { team_key, year } = z
595
+ .object({
596
+ team_key: TeamKeySchema,
597
+ year: YearSchema,
598
+ })
599
+ .parse(args);
600
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}/simple`);
601
+ const matches = z.array(MatchSimpleSchema).parse(data);
602
+ return {
603
+ content: [
604
+ {
605
+ type: 'text',
606
+ text: JSON.stringify(matches, null, 2),
607
+ },
608
+ ],
609
+ };
610
+ }
611
+ case 'get_team_matches_keys': {
612
+ const { team_key, year } = z
613
+ .object({
614
+ team_key: TeamKeySchema,
615
+ year: YearSchema,
616
+ })
617
+ .parse(args);
618
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}/keys`);
619
+ const keys = z.array(z.string()).parse(data);
620
+ return {
621
+ content: [
622
+ {
623
+ type: 'text',
624
+ text: JSON.stringify(keys, null, 2),
625
+ },
626
+ ],
627
+ };
628
+ }
629
+ case 'get_team_social_media': {
630
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
631
+ const data = await makeApiRequest(`/team/${team_key}/social_media`);
632
+ const media = z.array(MediaSchema).parse(data);
633
+ return {
634
+ content: [
635
+ {
636
+ type: 'text',
637
+ text: JSON.stringify(media, null, 2),
638
+ },
639
+ ],
640
+ };
641
+ }
642
+ case 'get_team_media_by_tag': {
643
+ const { team_key, media_tag } = z
644
+ .object({
645
+ team_key: TeamKeySchema,
646
+ media_tag: z.string(),
647
+ })
648
+ .parse(args);
649
+ const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}`);
650
+ const media = z.array(MediaSchema).parse(data);
651
+ return {
652
+ content: [
653
+ {
654
+ type: 'text',
655
+ text: JSON.stringify(media, null, 2),
656
+ },
657
+ ],
658
+ };
659
+ }
660
+ case 'get_team_media_by_tag_year': {
661
+ const { team_key, media_tag, year } = z
662
+ .object({
663
+ team_key: TeamKeySchema,
664
+ media_tag: z.string(),
665
+ year: YearSchema,
666
+ })
667
+ .parse(args);
668
+ const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}/${year}`);
669
+ const media = z.array(MediaSchema).parse(data);
670
+ return {
671
+ content: [
672
+ {
673
+ type: 'text',
674
+ text: JSON.stringify(media, null, 2),
675
+ },
676
+ ],
677
+ };
678
+ }
679
+ case 'get_event_teams_simple': {
680
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
681
+ const data = await makeApiRequest(`/event/${event_key}/teams/simple`);
682
+ const teams = z.array(TeamSimpleSchema).parse(data);
683
+ return {
684
+ content: [
685
+ {
686
+ type: 'text',
687
+ text: JSON.stringify(teams, null, 2),
688
+ },
689
+ ],
690
+ };
691
+ }
692
+ case 'get_event_teams_keys': {
693
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
694
+ const data = await makeApiRequest(`/event/${event_key}/teams/keys`);
695
+ const keys = z.array(z.string()).parse(data);
696
+ return {
697
+ content: [
698
+ {
699
+ type: 'text',
700
+ text: JSON.stringify(keys, null, 2),
701
+ },
702
+ ],
703
+ };
704
+ }
705
+ case 'get_event_matches_simple': {
706
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
707
+ const data = await makeApiRequest(`/event/${event_key}/matches/simple`);
708
+ const matches = z.array(MatchSimpleSchema).parse(data);
709
+ return {
710
+ content: [
711
+ {
712
+ type: 'text',
713
+ text: JSON.stringify(matches, null, 2),
714
+ },
715
+ ],
716
+ };
717
+ }
718
+ case 'get_event_matches_keys': {
719
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
720
+ const data = await makeApiRequest(`/event/${event_key}/matches/keys`);
721
+ const keys = z.array(z.string()).parse(data);
722
+ return {
723
+ content: [
724
+ {
725
+ type: 'text',
726
+ text: JSON.stringify(keys, null, 2),
727
+ },
728
+ ],
729
+ };
730
+ }
731
+ case 'get_team_history': {
732
+ const { team_key } = z.object({ team_key: TeamKeySchema }).parse(args);
733
+ const data = await makeApiRequest(`/team/${team_key}/history`);
734
+ const history = TeamHistorySchema.parse(data);
735
+ return {
736
+ content: [
737
+ {
738
+ type: 'text',
739
+ text: JSON.stringify(history, null, 2),
740
+ },
741
+ ],
742
+ };
743
+ }
744
+ case 'get_team_event_statuses': {
745
+ const { team_key, year } = z
746
+ .object({
747
+ team_key: TeamKeySchema,
748
+ year: YearSchema,
749
+ })
750
+ .parse(args);
751
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/statuses`);
752
+ const statuses = z.record(z.string(), TeamEventStatusSchema).parse(data);
753
+ return {
754
+ content: [
755
+ {
756
+ type: 'text',
757
+ text: JSON.stringify(statuses, null, 2),
758
+ },
759
+ ],
760
+ };
761
+ }
762
+ case 'get_team_event_matches_simple': {
763
+ const { team_key, event_key } = z
764
+ .object({
765
+ team_key: TeamKeySchema,
766
+ event_key: EventKeySchema,
767
+ })
768
+ .parse(args);
769
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/simple`);
770
+ const matches = z.array(MatchSimpleSchema).parse(data);
771
+ return {
772
+ content: [
773
+ {
774
+ type: 'text',
775
+ text: JSON.stringify(matches, null, 2),
776
+ },
777
+ ],
778
+ };
779
+ }
780
+ case 'get_team_event_matches_keys': {
781
+ const { team_key, event_key } = z
782
+ .object({
783
+ team_key: TeamKeySchema,
784
+ event_key: EventKeySchema,
785
+ })
786
+ .parse(args);
787
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/keys`);
788
+ const keys = z.array(z.string()).parse(data);
789
+ return {
790
+ content: [
791
+ {
792
+ type: 'text',
793
+ text: JSON.stringify(keys, null, 2),
794
+ },
795
+ ],
796
+ };
797
+ }
798
+ case 'get_district_events': {
799
+ const { district_key } = z
800
+ .object({ district_key: z.string() })
801
+ .parse(args);
802
+ const data = await makeApiRequest(`/district/${district_key}/events`);
803
+ const events = z.array(EventSchema).parse(data);
804
+ return {
805
+ content: [
806
+ {
807
+ type: 'text',
808
+ text: JSON.stringify(events, null, 2),
809
+ },
810
+ ],
811
+ };
812
+ }
813
+ case 'get_district_events_simple': {
814
+ const { district_key } = z
815
+ .object({ district_key: z.string() })
816
+ .parse(args);
817
+ const data = await makeApiRequest(`/district/${district_key}/events/simple`);
818
+ const events = z.array(EventSimpleSchema).parse(data);
819
+ return {
820
+ content: [
821
+ {
822
+ type: 'text',
823
+ text: JSON.stringify(events, null, 2),
824
+ },
825
+ ],
826
+ };
827
+ }
828
+ case 'get_district_events_keys': {
829
+ const { district_key } = z
830
+ .object({ district_key: z.string() })
831
+ .parse(args);
832
+ const data = await makeApiRequest(`/district/${district_key}/events/keys`);
833
+ const keys = z.array(z.string()).parse(data);
834
+ return {
835
+ content: [
836
+ {
837
+ type: 'text',
838
+ text: JSON.stringify(keys, null, 2),
839
+ },
840
+ ],
841
+ };
842
+ }
843
+ case 'get_district_teams': {
844
+ const { district_key } = z
845
+ .object({ district_key: z.string() })
846
+ .parse(args);
847
+ const data = await makeApiRequest(`/district/${district_key}/teams`);
848
+ const teams = z.array(TeamSchema).parse(data);
849
+ return {
850
+ content: [
851
+ {
852
+ type: 'text',
853
+ text: JSON.stringify(teams, null, 2),
854
+ },
855
+ ],
856
+ };
857
+ }
858
+ case 'get_district_teams_simple': {
859
+ const { district_key } = z
860
+ .object({ district_key: z.string() })
861
+ .parse(args);
862
+ const data = await makeApiRequest(`/district/${district_key}/teams/simple`);
863
+ const teams = z.array(TeamSimpleSchema).parse(data);
864
+ return {
865
+ content: [
866
+ {
867
+ type: 'text',
868
+ text: JSON.stringify(teams, null, 2),
869
+ },
870
+ ],
871
+ };
872
+ }
873
+ case 'get_district_teams_keys': {
874
+ const { district_key } = z
875
+ .object({ district_key: z.string() })
876
+ .parse(args);
877
+ const data = await makeApiRequest(`/district/${district_key}/teams/keys`);
878
+ const keys = z.array(z.string()).parse(data);
879
+ return {
880
+ content: [
881
+ {
882
+ type: 'text',
883
+ text: JSON.stringify(keys, null, 2),
884
+ },
885
+ ],
886
+ };
887
+ }
888
+ case 'get_match_zebra': {
889
+ const { match_key } = z.object({ match_key: z.string() }).parse(args);
890
+ const data = await makeApiRequest(`/match/${match_key}/zebra`);
891
+ const zebra = ZebraSchema.parse(data);
892
+ return {
893
+ content: [
894
+ {
895
+ type: 'text',
896
+ text: JSON.stringify(zebra, null, 2),
897
+ },
898
+ ],
899
+ };
900
+ }
901
+ case 'get_event_predictions': {
902
+ const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
903
+ const data = await makeApiRequest(`/event/${event_key}/predictions`);
904
+ const predictions = PredictionSchema.parse(data);
905
+ return {
906
+ content: [
907
+ {
908
+ type: 'text',
909
+ text: JSON.stringify(predictions, null, 2),
910
+ },
911
+ ],
912
+ };
913
+ }
914
+ default:
915
+ throw new Error(`Unknown tool: ${name}`);
916
+ }
917
+ }
918
+ //# sourceMappingURL=handlers.js.map