@withinfocus/tba-mcp-server 0.2.3 → 0.2.5

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.
package/dist/index.js CHANGED
@@ -420,2022 +420,2108 @@ function getApiKey() {
420
420
  if (!API_KEY) {
421
421
  API_KEY = process.env['TBA_API_KEY'];
422
422
  if (!API_KEY) {
423
- throw new Error('TBA_API_KEY environment variable is required');
423
+ const errorMessage = 'TBA_API_KEY environment variable is required but not set. Please set the TBA_API_KEY environment variable with your The Blue Alliance API key.';
424
+ console.error(errorMessage);
425
+ throw new Error(errorMessage);
426
+ }
427
+ if (API_KEY.trim() === '') {
428
+ const errorMessage = 'TBA_API_KEY environment variable is set but empty. Please provide a valid The Blue Alliance API key.';
429
+ console.error(errorMessage);
430
+ throw new Error(errorMessage);
424
431
  }
425
432
  }
426
433
  return API_KEY;
427
434
  }
428
435
  export async function makeApiRequest(endpoint) {
429
- const apiKey = getApiKey();
430
- const url = `https://www.thebluealliance.com/api/v3${endpoint}`;
431
- const response = await fetch(url, {
432
- headers: {
433
- 'X-TBA-Auth-Key': apiKey,
434
- Accept: 'application/json',
435
- },
436
- });
437
- if (!response.ok) {
438
- throw new Error(`TBA API request failed: ${response.status} ${response.statusText}`);
436
+ try {
437
+ const apiKey = getApiKey();
438
+ const url = `https://www.thebluealliance.com/api/v3${endpoint}`;
439
+ const response = await fetch(url, {
440
+ headers: {
441
+ 'X-TBA-Auth-Key': apiKey,
442
+ Accept: 'application/json',
443
+ },
444
+ });
445
+ if (!response.ok) {
446
+ const errorMessage = `TBA API request failed: ${response.status} ${response.statusText} for endpoint ${endpoint}`;
447
+ console.error(errorMessage);
448
+ throw new Error(errorMessage);
449
+ }
450
+ return response.json();
451
+ }
452
+ catch (error) {
453
+ if (error instanceof Error) {
454
+ console.error(`API request error for endpoint ${endpoint}: ${error.message}`);
455
+ throw error;
456
+ }
457
+ const errorMessage = `Unknown error during API request for endpoint ${endpoint}`;
458
+ console.error(`${errorMessage}: ${error}`);
459
+ throw new Error(errorMessage);
439
460
  }
440
- return response.json();
441
461
  }
442
462
  async function runServer() {
443
- console.error('The Blue Alliance MCP Server starting ...');
444
- const server = new Server({
445
- name: 'The Blue Alliance MCP Server',
446
- version: '0.2.2',
447
- }, {
448
- capabilities: {
449
- tools: {},
450
- },
451
- });
452
- server.setRequestHandler(ListToolsRequestSchema, async () => {
453
- return {
454
- tools: [
455
- {
456
- name: 'get_team',
457
- description: 'Get detailed information about a specific FRC team',
458
- inputSchema: {
459
- type: 'object',
460
- properties: {
461
- team_key: {
462
- type: 'string',
463
- description: 'Team key in format frcXXXX (e.g., frc86)',
464
- pattern: '^frc\\d+$',
465
- },
463
+ // Create server first so we can use its logging method
464
+ let server = null;
465
+ // Common logging method that uses MCP server's sendLoggingMessage
466
+ const log = async (level, data, logger) => {
467
+ if (server) {
468
+ try {
469
+ await server.sendLoggingMessage({ level, data, logger });
470
+ }
471
+ catch {
472
+ // Fallback to console if MCP logging fails
473
+ console.error(data);
474
+ }
475
+ }
476
+ else {
477
+ // Fallback to console if server not initialized yet
478
+ console.error(data);
479
+ }
480
+ };
481
+ try {
482
+ await log('info', 'The Blue Alliance MCP Server starting ...');
483
+ // Validate API key availability early
484
+ try {
485
+ getApiKey();
486
+ await log('info', 'TBA API key validated successfully');
487
+ }
488
+ catch (error) {
489
+ const errorMessage = 'Failed to get TBA API key';
490
+ await log('error', `${errorMessage}: ${error instanceof Error ? error.message : error}`);
491
+ throw new Error(errorMessage);
492
+ }
493
+ await log('info', 'Initializing MCP server ...');
494
+ server = new Server({
495
+ name: 'The Blue Alliance MCP Server',
496
+ version: '0.2.5',
497
+ }, {
498
+ capabilities: {
499
+ tools: {},
500
+ },
501
+ });
502
+ await log('info', 'Setting up request handlers ...');
503
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
504
+ return {
505
+ tools: [
506
+ {
507
+ name: 'get_team',
508
+ description: 'Get detailed information about a specific FRC team',
509
+ inputSchema: {
510
+ type: 'object',
511
+ properties: {
512
+ team_key: {
513
+ type: 'string',
514
+ description: 'Team key in format frcXXXX (e.g., frc86)',
515
+ pattern: '^frc\\d+$',
516
+ },
517
+ },
518
+ required: ['team_key'],
466
519
  },
467
- required: ['team_key'],
468
520
  },
469
- },
470
- {
471
- name: 'get_team_events',
472
- description: 'Get events that a team has participated in for a given year',
473
- inputSchema: {
474
- type: 'object',
475
- properties: {
476
- team_key: {
477
- type: 'string',
478
- description: 'Team key in format frcXXXX (e.g., frc86)',
479
- pattern: '^frc\\d+$',
480
- },
481
- year: {
482
- type: 'number',
483
- description: 'Competition year',
484
- minimum: 1992,
485
- maximum: new Date().getFullYear() + 1,
486
- },
521
+ {
522
+ name: 'get_team_events',
523
+ description: 'Get events that a team has participated in for a given year',
524
+ inputSchema: {
525
+ type: 'object',
526
+ properties: {
527
+ team_key: {
528
+ type: 'string',
529
+ description: 'Team key in format frcXXXX (e.g., frc86)',
530
+ pattern: '^frc\\d+$',
531
+ },
532
+ year: {
533
+ type: 'number',
534
+ description: 'Competition year',
535
+ minimum: 1992,
536
+ maximum: new Date().getFullYear() + 1,
537
+ },
538
+ },
539
+ required: ['team_key', 'year'],
487
540
  },
488
- required: ['team_key', 'year'],
489
541
  },
490
- },
491
- {
492
- name: 'get_team_awards',
493
- description: 'Get awards won by a team in a specific year',
494
- inputSchema: {
495
- type: 'object',
496
- properties: {
497
- team_key: {
498
- type: 'string',
499
- description: 'Team key in format frcXXXX (e.g., frc86)',
500
- pattern: '^frc\\d+$',
501
- },
502
- year: {
503
- type: 'number',
504
- description: 'Competition year',
505
- minimum: 1992,
506
- maximum: new Date().getFullYear() + 1,
507
- },
542
+ {
543
+ name: 'get_team_awards',
544
+ description: 'Get awards won by a team in a specific year',
545
+ inputSchema: {
546
+ type: 'object',
547
+ properties: {
548
+ team_key: {
549
+ type: 'string',
550
+ description: 'Team key in format frcXXXX (e.g., frc86)',
551
+ pattern: '^frc\\d+$',
552
+ },
553
+ year: {
554
+ type: 'number',
555
+ description: 'Competition year',
556
+ minimum: 1992,
557
+ maximum: new Date().getFullYear() + 1,
558
+ },
559
+ },
560
+ required: ['team_key', 'year'],
508
561
  },
509
- required: ['team_key', 'year'],
510
562
  },
511
- },
512
- {
513
- name: 'get_team_matches',
514
- description: 'Get matches played by a team in a specific year',
515
- inputSchema: {
516
- type: 'object',
517
- properties: {
518
- team_key: {
519
- type: 'string',
520
- description: 'Team key in format frcXXXX (e.g., frc86)',
521
- pattern: '^frc\\d+$',
522
- },
523
- year: {
524
- type: 'number',
525
- description: 'Competition year',
526
- minimum: 1992,
527
- maximum: new Date().getFullYear() + 1,
528
- },
563
+ {
564
+ name: 'get_team_matches',
565
+ description: 'Get matches played by a team in a specific year',
566
+ inputSchema: {
567
+ type: 'object',
568
+ properties: {
569
+ team_key: {
570
+ type: 'string',
571
+ description: 'Team key in format frcXXXX (e.g., frc86)',
572
+ pattern: '^frc\\d+$',
573
+ },
574
+ year: {
575
+ type: 'number',
576
+ description: 'Competition year',
577
+ minimum: 1992,
578
+ maximum: new Date().getFullYear() + 1,
579
+ },
580
+ },
581
+ required: ['team_key', 'year'],
529
582
  },
530
- required: ['team_key', 'year'],
531
583
  },
532
- },
533
- {
534
- name: 'get_events',
535
- description: 'Get all FRC events for a specific year',
536
- inputSchema: {
537
- type: 'object',
538
- properties: {
539
- year: {
540
- type: 'number',
541
- description: 'Competition year',
542
- minimum: 1992,
543
- maximum: new Date().getFullYear() + 1,
544
- },
584
+ {
585
+ name: 'get_events',
586
+ description: 'Get all FRC events for a specific year',
587
+ inputSchema: {
588
+ type: 'object',
589
+ properties: {
590
+ year: {
591
+ type: 'number',
592
+ description: 'Competition year',
593
+ minimum: 1992,
594
+ maximum: new Date().getFullYear() + 1,
595
+ },
596
+ },
597
+ required: ['year'],
545
598
  },
546
- required: ['year'],
547
599
  },
548
- },
549
- {
550
- name: 'get_event',
551
- description: 'Get detailed information about a specific event',
552
- inputSchema: {
553
- type: 'object',
554
- properties: {
555
- event_key: {
556
- type: 'string',
557
- description: 'Event key (e.g., 2023casj)',
558
- },
600
+ {
601
+ name: 'get_event',
602
+ description: 'Get detailed information about a specific event',
603
+ inputSchema: {
604
+ type: 'object',
605
+ properties: {
606
+ event_key: {
607
+ type: 'string',
608
+ description: 'Event key (e.g., 2023casj)',
609
+ },
610
+ },
611
+ required: ['event_key'],
559
612
  },
560
- required: ['event_key'],
561
613
  },
562
- },
563
- {
564
- name: 'get_event_teams',
565
- description: 'Get teams participating in a specific event',
566
- inputSchema: {
567
- type: 'object',
568
- properties: {
569
- event_key: {
570
- type: 'string',
571
- description: 'Event key (e.g., 2023casj)',
572
- },
614
+ {
615
+ name: 'get_event_teams',
616
+ description: 'Get teams participating in a specific event',
617
+ inputSchema: {
618
+ type: 'object',
619
+ properties: {
620
+ event_key: {
621
+ type: 'string',
622
+ description: 'Event key (e.g., 2023casj)',
623
+ },
624
+ },
625
+ required: ['event_key'],
573
626
  },
574
- required: ['event_key'],
575
627
  },
576
- },
577
- {
578
- name: 'get_event_rankings',
579
- description: 'Get team rankings for a specific event',
580
- inputSchema: {
581
- type: 'object',
582
- properties: {
583
- event_key: {
584
- type: 'string',
585
- description: 'Event key (e.g., 2023casj)',
586
- },
628
+ {
629
+ name: 'get_event_rankings',
630
+ description: 'Get team rankings for a specific event',
631
+ inputSchema: {
632
+ type: 'object',
633
+ properties: {
634
+ event_key: {
635
+ type: 'string',
636
+ description: 'Event key (e.g., 2023casj)',
637
+ },
638
+ },
639
+ required: ['event_key'],
587
640
  },
588
- required: ['event_key'],
589
641
  },
590
- },
591
- {
592
- name: 'get_event_matches',
593
- description: 'Get matches for a specific event',
594
- inputSchema: {
595
- type: 'object',
596
- properties: {
597
- event_key: {
598
- type: 'string',
599
- description: 'Event key (e.g., 2023casj)',
600
- },
642
+ {
643
+ name: 'get_event_matches',
644
+ description: 'Get matches for a specific event',
645
+ inputSchema: {
646
+ type: 'object',
647
+ properties: {
648
+ event_key: {
649
+ type: 'string',
650
+ description: 'Event key (e.g., 2023casj)',
651
+ },
652
+ },
653
+ required: ['event_key'],
601
654
  },
602
- required: ['event_key'],
603
655
  },
604
- },
605
- {
606
- name: 'get_event_alliances',
607
- description: 'Get elimination alliances for a specific event',
608
- inputSchema: {
609
- type: 'object',
610
- properties: {
611
- event_key: {
612
- type: 'string',
613
- description: 'Event key (e.g., 2023casj)',
614
- },
656
+ {
657
+ name: 'get_event_alliances',
658
+ description: 'Get elimination alliances for a specific event',
659
+ inputSchema: {
660
+ type: 'object',
661
+ properties: {
662
+ event_key: {
663
+ type: 'string',
664
+ description: 'Event key (e.g., 2023casj)',
665
+ },
666
+ },
667
+ required: ['event_key'],
615
668
  },
616
- required: ['event_key'],
617
669
  },
618
- },
619
- {
620
- name: 'get_event_insights',
621
- description: 'Get event-specific insights and statistics',
622
- inputSchema: {
623
- type: 'object',
624
- properties: {
625
- event_key: {
626
- type: 'string',
627
- description: 'Event key (e.g., 2023casj)',
628
- },
670
+ {
671
+ name: 'get_event_insights',
672
+ description: 'Get event-specific insights and statistics',
673
+ inputSchema: {
674
+ type: 'object',
675
+ properties: {
676
+ event_key: {
677
+ type: 'string',
678
+ description: 'Event key (e.g., 2023casj)',
679
+ },
680
+ },
681
+ required: ['event_key'],
629
682
  },
630
- required: ['event_key'],
631
683
  },
632
- },
633
- {
634
- name: 'get_event_district_points',
635
- description: 'Get district points for teams at an event',
636
- inputSchema: {
637
- type: 'object',
638
- properties: {
639
- event_key: {
640
- type: 'string',
641
- description: 'Event key (e.g., 2023casj)',
642
- },
684
+ {
685
+ name: 'get_event_district_points',
686
+ description: 'Get district points for teams at an event',
687
+ inputSchema: {
688
+ type: 'object',
689
+ properties: {
690
+ event_key: {
691
+ type: 'string',
692
+ description: 'Event key (e.g., 2023casj)',
693
+ },
694
+ },
695
+ required: ['event_key'],
643
696
  },
644
- required: ['event_key'],
645
697
  },
646
- },
647
- {
648
- name: 'get_team_years_participated',
649
- description: 'Get years that a team has participated in competition',
650
- inputSchema: {
651
- type: 'object',
652
- properties: {
653
- team_key: {
654
- type: 'string',
655
- description: 'Team key in format frcXXXX (e.g., frc86)',
656
- pattern: '^frc\\d+$',
657
- },
698
+ {
699
+ name: 'get_team_years_participated',
700
+ description: 'Get years that a team has participated in competition',
701
+ inputSchema: {
702
+ type: 'object',
703
+ properties: {
704
+ team_key: {
705
+ type: 'string',
706
+ description: 'Team key in format frcXXXX (e.g., frc86)',
707
+ pattern: '^frc\\d+$',
708
+ },
709
+ },
710
+ required: ['team_key'],
658
711
  },
659
- required: ['team_key'],
660
712
  },
661
- },
662
- {
663
- name: 'get_team_districts',
664
- description: 'Get district history for a team',
665
- inputSchema: {
666
- type: 'object',
667
- properties: {
668
- team_key: {
669
- type: 'string',
670
- description: 'Team key in format frcXXXX (e.g., frc86)',
671
- pattern: '^frc\\d+$',
672
- },
713
+ {
714
+ name: 'get_team_districts',
715
+ description: 'Get district history for a team',
716
+ inputSchema: {
717
+ type: 'object',
718
+ properties: {
719
+ team_key: {
720
+ type: 'string',
721
+ description: 'Team key in format frcXXXX (e.g., frc86)',
722
+ pattern: '^frc\\d+$',
723
+ },
724
+ },
725
+ required: ['team_key'],
673
726
  },
674
- required: ['team_key'],
675
727
  },
676
- },
677
- {
678
- name: 'get_team_robots',
679
- description: 'Get robot names for a team by year',
680
- inputSchema: {
681
- type: 'object',
682
- properties: {
683
- team_key: {
684
- type: 'string',
685
- description: 'Team key in format frcXXXX (e.g., frc86)',
686
- pattern: '^frc\\d+$',
687
- },
728
+ {
729
+ name: 'get_team_robots',
730
+ description: 'Get robot names for a team by year',
731
+ inputSchema: {
732
+ type: 'object',
733
+ properties: {
734
+ team_key: {
735
+ type: 'string',
736
+ description: 'Team key in format frcXXXX (e.g., frc86)',
737
+ pattern: '^frc\\d+$',
738
+ },
739
+ },
740
+ required: ['team_key'],
688
741
  },
689
- required: ['team_key'],
690
742
  },
691
- },
692
- {
693
- name: 'get_team_media',
694
- description: 'Get media for a team in a specific year',
695
- inputSchema: {
696
- type: 'object',
697
- properties: {
698
- team_key: {
699
- type: 'string',
700
- description: 'Team key in format frcXXXX (e.g., frc86)',
701
- pattern: '^frc\\d+$',
702
- },
703
- year: {
704
- type: 'number',
705
- description: 'Competition year',
706
- minimum: 1992,
707
- maximum: new Date().getFullYear() + 1,
708
- },
743
+ {
744
+ name: 'get_team_media',
745
+ description: 'Get media for a team in a specific year',
746
+ inputSchema: {
747
+ type: 'object',
748
+ properties: {
749
+ team_key: {
750
+ type: 'string',
751
+ description: 'Team key in format frcXXXX (e.g., frc86)',
752
+ pattern: '^frc\\d+$',
753
+ },
754
+ year: {
755
+ type: 'number',
756
+ description: 'Competition year',
757
+ minimum: 1992,
758
+ maximum: new Date().getFullYear() + 1,
759
+ },
760
+ },
761
+ required: ['team_key', 'year'],
709
762
  },
710
- required: ['team_key', 'year'],
711
763
  },
712
- },
713
- {
714
- name: 'get_team_event_matches',
715
- description: 'Get matches for a team at a specific event',
716
- inputSchema: {
717
- type: 'object',
718
- properties: {
719
- team_key: {
720
- type: 'string',
721
- description: 'Team key in format frcXXXX (e.g., frc86)',
722
- pattern: '^frc\\d+$',
723
- },
724
- event_key: {
725
- type: 'string',
726
- description: 'Event key (e.g., 2023casj)',
727
- },
764
+ {
765
+ name: 'get_team_event_matches',
766
+ description: 'Get matches for a team at a specific event',
767
+ inputSchema: {
768
+ type: 'object',
769
+ properties: {
770
+ team_key: {
771
+ type: 'string',
772
+ description: 'Team key in format frcXXXX (e.g., frc86)',
773
+ pattern: '^frc\\d+$',
774
+ },
775
+ event_key: {
776
+ type: 'string',
777
+ description: 'Event key (e.g., 2023casj)',
778
+ },
779
+ },
780
+ required: ['team_key', 'event_key'],
728
781
  },
729
- required: ['team_key', 'event_key'],
730
782
  },
731
- },
732
- {
733
- name: 'get_teams',
734
- description: 'Get list of teams with pagination',
735
- inputSchema: {
736
- type: 'object',
737
- properties: {
738
- page_num: {
739
- type: 'number',
740
- description: 'Page number (0-indexed)',
741
- minimum: 0,
742
- },
783
+ {
784
+ name: 'get_teams',
785
+ description: 'Get list of teams with pagination',
786
+ inputSchema: {
787
+ type: 'object',
788
+ properties: {
789
+ page_num: {
790
+ type: 'number',
791
+ description: 'Page number (0-indexed)',
792
+ minimum: 0,
793
+ },
794
+ },
795
+ required: ['page_num'],
743
796
  },
744
- required: ['page_num'],
745
797
  },
746
- },
747
- {
748
- name: 'get_status',
749
- description: 'Get TBA API status information',
750
- inputSchema: {
751
- type: 'object',
752
- properties: {},
798
+ {
799
+ name: 'get_status',
800
+ description: 'Get TBA API status information',
801
+ inputSchema: {
802
+ type: 'object',
803
+ properties: {},
804
+ },
753
805
  },
754
- },
755
- {
756
- name: 'get_match',
757
- description: 'Get detailed information about a specific match',
758
- inputSchema: {
759
- type: 'object',
760
- properties: {
761
- match_key: {
762
- type: 'string',
763
- description: 'Match key (e.g., 2023casj_qm1)',
764
- },
806
+ {
807
+ name: 'get_match',
808
+ description: 'Get detailed information about a specific match',
809
+ inputSchema: {
810
+ type: 'object',
811
+ properties: {
812
+ match_key: {
813
+ type: 'string',
814
+ description: 'Match key (e.g., 2023casj_qm1)',
815
+ },
816
+ },
817
+ required: ['match_key'],
765
818
  },
766
- required: ['match_key'],
767
819
  },
768
- },
769
- {
770
- name: 'get_event_oprs',
771
- description: 'Get OPR, DPR, and CCWM ratings for teams at an event',
772
- inputSchema: {
773
- type: 'object',
774
- properties: {
775
- event_key: {
776
- type: 'string',
777
- description: 'Event key (e.g., 2023casj)',
778
- },
820
+ {
821
+ name: 'get_event_oprs',
822
+ description: 'Get OPR, DPR, and CCWM ratings for teams at an event',
823
+ inputSchema: {
824
+ type: 'object',
825
+ properties: {
826
+ event_key: {
827
+ type: 'string',
828
+ description: 'Event key (e.g., 2023casj)',
829
+ },
830
+ },
831
+ required: ['event_key'],
779
832
  },
780
- required: ['event_key'],
781
833
  },
782
- },
783
- {
784
- name: 'get_event_awards',
785
- description: 'Get awards from a specific event',
786
- inputSchema: {
787
- type: 'object',
788
- properties: {
789
- event_key: {
790
- type: 'string',
791
- description: 'Event key (e.g., 2023casj)',
792
- },
834
+ {
835
+ name: 'get_event_awards',
836
+ description: 'Get awards from a specific event',
837
+ inputSchema: {
838
+ type: 'object',
839
+ properties: {
840
+ event_key: {
841
+ type: 'string',
842
+ description: 'Event key (e.g., 2023casj)',
843
+ },
844
+ },
845
+ required: ['event_key'],
793
846
  },
794
- required: ['event_key'],
795
847
  },
796
- },
797
- {
798
- name: 'get_team_awards_all',
799
- description: 'Get all awards won by a team across all years',
800
- inputSchema: {
801
- type: 'object',
802
- properties: {
803
- team_key: {
804
- type: 'string',
805
- description: 'Team key in format frcXXXX (e.g., frc86)',
806
- pattern: '^frc\\d+$',
807
- },
848
+ {
849
+ name: 'get_team_awards_all',
850
+ description: 'Get all awards won by a team across all years',
851
+ inputSchema: {
852
+ type: 'object',
853
+ properties: {
854
+ team_key: {
855
+ type: 'string',
856
+ description: 'Team key in format frcXXXX (e.g., frc86)',
857
+ pattern: '^frc\\d+$',
858
+ },
859
+ },
860
+ required: ['team_key'],
808
861
  },
809
- required: ['team_key'],
810
862
  },
811
- },
812
- {
813
- name: 'get_team_events_all',
814
- description: 'Get all events a team has participated in across all years',
815
- inputSchema: {
816
- type: 'object',
817
- properties: {
818
- team_key: {
819
- type: 'string',
820
- description: 'Team key in format frcXXXX (e.g., frc86)',
821
- pattern: '^frc\\d+$',
822
- },
863
+ {
864
+ name: 'get_team_events_all',
865
+ description: 'Get all events a team has participated in across all years',
866
+ inputSchema: {
867
+ type: 'object',
868
+ properties: {
869
+ team_key: {
870
+ type: 'string',
871
+ description: 'Team key in format frcXXXX (e.g., frc86)',
872
+ pattern: '^frc\\d+$',
873
+ },
874
+ },
875
+ required: ['team_key'],
823
876
  },
824
- required: ['team_key'],
825
877
  },
826
- },
827
- {
828
- name: 'get_team_event_status',
829
- description: 'Get team competition rank and status at a specific event',
830
- inputSchema: {
831
- type: 'object',
832
- properties: {
833
- team_key: {
834
- type: 'string',
835
- description: 'Team key in format frcXXXX (e.g., frc86)',
836
- pattern: '^frc\\d+$',
837
- },
838
- event_key: {
839
- type: 'string',
840
- description: 'Event key (e.g., 2023casj)',
841
- },
878
+ {
879
+ name: 'get_team_event_status',
880
+ description: 'Get team competition rank and status at a specific event',
881
+ inputSchema: {
882
+ type: 'object',
883
+ properties: {
884
+ team_key: {
885
+ type: 'string',
886
+ description: 'Team key in format frcXXXX (e.g., frc86)',
887
+ pattern: '^frc\\d+$',
888
+ },
889
+ event_key: {
890
+ type: 'string',
891
+ description: 'Event key (e.g., 2023casj)',
892
+ },
893
+ },
894
+ required: ['team_key', 'event_key'],
842
895
  },
843
- required: ['team_key', 'event_key'],
844
896
  },
845
- },
846
- {
847
- name: 'get_districts',
848
- description: 'Get all districts for a specific year',
849
- inputSchema: {
850
- type: 'object',
851
- properties: {
852
- year: {
853
- type: 'number',
854
- description: 'Competition year',
855
- minimum: 1992,
856
- maximum: new Date().getFullYear() + 1,
857
- },
897
+ {
898
+ name: 'get_districts',
899
+ description: 'Get all districts for a specific year',
900
+ inputSchema: {
901
+ type: 'object',
902
+ properties: {
903
+ year: {
904
+ type: 'number',
905
+ description: 'Competition year',
906
+ minimum: 1992,
907
+ maximum: new Date().getFullYear() + 1,
908
+ },
909
+ },
910
+ required: ['year'],
858
911
  },
859
- required: ['year'],
860
912
  },
861
- },
862
- {
863
- name: 'get_district_rankings',
864
- description: 'Get team rankings within a district',
865
- inputSchema: {
866
- type: 'object',
867
- properties: {
868
- district_key: {
869
- type: 'string',
870
- description: 'District key (e.g., 2023fim)',
871
- },
913
+ {
914
+ name: 'get_district_rankings',
915
+ description: 'Get team rankings within a district',
916
+ inputSchema: {
917
+ type: 'object',
918
+ properties: {
919
+ district_key: {
920
+ type: 'string',
921
+ description: 'District key (e.g., 2023fim)',
922
+ },
923
+ },
924
+ required: ['district_key'],
872
925
  },
873
- required: ['district_key'],
874
926
  },
875
- },
876
- {
877
- name: 'get_teams_simple',
878
- description: 'Get simplified list of teams with pagination',
879
- inputSchema: {
880
- type: 'object',
881
- properties: {
882
- page_num: {
883
- type: 'number',
884
- description: 'Page number (0-indexed)',
885
- minimum: 0,
886
- },
927
+ {
928
+ name: 'get_teams_simple',
929
+ description: 'Get simplified list of teams with pagination',
930
+ inputSchema: {
931
+ type: 'object',
932
+ properties: {
933
+ page_num: {
934
+ type: 'number',
935
+ description: 'Page number (0-indexed)',
936
+ minimum: 0,
937
+ },
938
+ },
939
+ required: ['page_num'],
887
940
  },
888
- required: ['page_num'],
889
941
  },
890
- },
891
- {
892
- name: 'get_teams_keys',
893
- description: 'Get list of team keys with pagination',
894
- inputSchema: {
895
- type: 'object',
896
- properties: {
897
- page_num: {
898
- type: 'number',
899
- description: 'Page number (0-indexed)',
900
- minimum: 0,
901
- },
942
+ {
943
+ name: 'get_teams_keys',
944
+ description: 'Get list of team keys with pagination',
945
+ inputSchema: {
946
+ type: 'object',
947
+ properties: {
948
+ page_num: {
949
+ type: 'number',
950
+ description: 'Page number (0-indexed)',
951
+ minimum: 0,
952
+ },
953
+ },
954
+ required: ['page_num'],
902
955
  },
903
- required: ['page_num'],
904
956
  },
905
- },
906
- {
907
- name: 'get_teams_by_year',
908
- description: 'Get teams that competed in a specific year',
909
- inputSchema: {
910
- type: 'object',
911
- properties: {
912
- year: {
913
- type: 'number',
914
- description: 'Competition year',
915
- minimum: 1992,
916
- maximum: new Date().getFullYear() + 1,
917
- },
918
- page_num: {
919
- type: 'number',
920
- description: 'Page number (0-indexed)',
921
- minimum: 0,
922
- },
957
+ {
958
+ name: 'get_teams_by_year',
959
+ description: 'Get teams that competed in a specific year',
960
+ inputSchema: {
961
+ type: 'object',
962
+ properties: {
963
+ year: {
964
+ type: 'number',
965
+ description: 'Competition year',
966
+ minimum: 1992,
967
+ maximum: new Date().getFullYear() + 1,
968
+ },
969
+ page_num: {
970
+ type: 'number',
971
+ description: 'Page number (0-indexed)',
972
+ minimum: 0,
973
+ },
974
+ },
975
+ required: ['year', 'page_num'],
923
976
  },
924
- required: ['year', 'page_num'],
925
977
  },
926
- },
927
- {
928
- name: 'get_teams_by_year_simple',
929
- description: 'Get simplified teams that competed in a specific year',
930
- inputSchema: {
931
- type: 'object',
932
- properties: {
933
- year: {
934
- type: 'number',
935
- description: 'Competition year',
936
- minimum: 1992,
937
- maximum: new Date().getFullYear() + 1,
938
- },
939
- page_num: {
940
- type: 'number',
941
- description: 'Page number (0-indexed)',
942
- minimum: 0,
943
- },
978
+ {
979
+ name: 'get_teams_by_year_simple',
980
+ description: 'Get simplified teams that competed in a specific year',
981
+ inputSchema: {
982
+ type: 'object',
983
+ properties: {
984
+ year: {
985
+ type: 'number',
986
+ description: 'Competition year',
987
+ minimum: 1992,
988
+ maximum: new Date().getFullYear() + 1,
989
+ },
990
+ page_num: {
991
+ type: 'number',
992
+ description: 'Page number (0-indexed)',
993
+ minimum: 0,
994
+ },
995
+ },
996
+ required: ['year', 'page_num'],
944
997
  },
945
- required: ['year', 'page_num'],
946
998
  },
947
- },
948
- {
949
- name: 'get_teams_by_year_keys',
950
- description: 'Get team keys that competed in a specific year',
951
- inputSchema: {
952
- type: 'object',
953
- properties: {
954
- year: {
955
- type: 'number',
956
- description: 'Competition year',
957
- minimum: 1992,
958
- maximum: new Date().getFullYear() + 1,
959
- },
960
- page_num: {
961
- type: 'number',
962
- description: 'Page number (0-indexed)',
963
- minimum: 0,
964
- },
999
+ {
1000
+ name: 'get_teams_by_year_keys',
1001
+ description: 'Get team keys that competed in a specific year',
1002
+ inputSchema: {
1003
+ type: 'object',
1004
+ properties: {
1005
+ year: {
1006
+ type: 'number',
1007
+ description: 'Competition year',
1008
+ minimum: 1992,
1009
+ maximum: new Date().getFullYear() + 1,
1010
+ },
1011
+ page_num: {
1012
+ type: 'number',
1013
+ description: 'Page number (0-indexed)',
1014
+ minimum: 0,
1015
+ },
1016
+ },
1017
+ required: ['year', 'page_num'],
965
1018
  },
966
- required: ['year', 'page_num'],
967
1019
  },
968
- },
969
- {
970
- name: 'get_team_simple',
971
- description: 'Get simplified information about a specific team',
972
- inputSchema: {
973
- type: 'object',
974
- properties: {
975
- team_key: {
976
- type: 'string',
977
- description: 'Team key in format frcXXXX (e.g., frc86)',
978
- pattern: '^frc\\d+$',
979
- },
1020
+ {
1021
+ name: 'get_team_simple',
1022
+ description: 'Get simplified information about a specific team',
1023
+ inputSchema: {
1024
+ type: 'object',
1025
+ properties: {
1026
+ team_key: {
1027
+ type: 'string',
1028
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1029
+ pattern: '^frc\\d+$',
1030
+ },
1031
+ },
1032
+ required: ['team_key'],
980
1033
  },
981
- required: ['team_key'],
982
1034
  },
983
- },
984
- {
985
- name: 'get_event_simple',
986
- description: 'Get simplified information about a specific event',
987
- inputSchema: {
988
- type: 'object',
989
- properties: {
990
- event_key: {
991
- type: 'string',
992
- description: 'Event key (e.g., 2023casj)',
993
- },
1035
+ {
1036
+ name: 'get_event_simple',
1037
+ description: 'Get simplified information about a specific event',
1038
+ inputSchema: {
1039
+ type: 'object',
1040
+ properties: {
1041
+ event_key: {
1042
+ type: 'string',
1043
+ description: 'Event key (e.g., 2023casj)',
1044
+ },
1045
+ },
1046
+ required: ['event_key'],
994
1047
  },
995
- required: ['event_key'],
996
1048
  },
997
- },
998
- {
999
- name: 'get_events_simple',
1000
- description: 'Get simplified list of events for a year',
1001
- inputSchema: {
1002
- type: 'object',
1003
- properties: {
1004
- year: {
1005
- type: 'number',
1006
- description: 'Competition year',
1007
- minimum: 1992,
1008
- maximum: new Date().getFullYear() + 1,
1009
- },
1049
+ {
1050
+ name: 'get_events_simple',
1051
+ description: 'Get simplified list of events for a year',
1052
+ inputSchema: {
1053
+ type: 'object',
1054
+ properties: {
1055
+ year: {
1056
+ type: 'number',
1057
+ description: 'Competition year',
1058
+ minimum: 1992,
1059
+ maximum: new Date().getFullYear() + 1,
1060
+ },
1061
+ },
1062
+ required: ['year'],
1010
1063
  },
1011
- required: ['year'],
1012
1064
  },
1013
- },
1014
- {
1015
- name: 'get_events_keys',
1016
- description: 'Get list of event keys for a year',
1017
- inputSchema: {
1018
- type: 'object',
1019
- properties: {
1020
- year: {
1021
- type: 'number',
1022
- description: 'Competition year',
1023
- minimum: 1992,
1024
- maximum: new Date().getFullYear() + 1,
1025
- },
1065
+ {
1066
+ name: 'get_events_keys',
1067
+ description: 'Get list of event keys for a year',
1068
+ inputSchema: {
1069
+ type: 'object',
1070
+ properties: {
1071
+ year: {
1072
+ type: 'number',
1073
+ description: 'Competition year',
1074
+ minimum: 1992,
1075
+ maximum: new Date().getFullYear() + 1,
1076
+ },
1077
+ },
1078
+ required: ['year'],
1026
1079
  },
1027
- required: ['year'],
1028
1080
  },
1029
- },
1030
- {
1031
- name: 'get_match_simple',
1032
- description: 'Get simplified information about a specific match',
1033
- inputSchema: {
1034
- type: 'object',
1035
- properties: {
1036
- match_key: {
1037
- type: 'string',
1038
- description: 'Match key (e.g., 2023casj_qm1)',
1039
- },
1081
+ {
1082
+ name: 'get_match_simple',
1083
+ description: 'Get simplified information about a specific match',
1084
+ inputSchema: {
1085
+ type: 'object',
1086
+ properties: {
1087
+ match_key: {
1088
+ type: 'string',
1089
+ description: 'Match key (e.g., 2023casj_qm1)',
1090
+ },
1091
+ },
1092
+ required: ['match_key'],
1040
1093
  },
1041
- required: ['match_key'],
1042
1094
  },
1043
- },
1044
- {
1045
- name: 'get_team_events_simple',
1046
- description: 'Get simplified events for a team in a specific year',
1047
- inputSchema: {
1048
- type: 'object',
1049
- properties: {
1050
- team_key: {
1051
- type: 'string',
1052
- description: 'Team key in format frcXXXX (e.g., frc86)',
1053
- pattern: '^frc\\d+$',
1054
- },
1055
- year: {
1056
- type: 'number',
1057
- description: 'Competition year',
1058
- minimum: 1992,
1059
- maximum: new Date().getFullYear() + 1,
1060
- },
1095
+ {
1096
+ name: 'get_team_events_simple',
1097
+ description: 'Get simplified events for a team in a specific year',
1098
+ inputSchema: {
1099
+ type: 'object',
1100
+ properties: {
1101
+ team_key: {
1102
+ type: 'string',
1103
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1104
+ pattern: '^frc\\d+$',
1105
+ },
1106
+ year: {
1107
+ type: 'number',
1108
+ description: 'Competition year',
1109
+ minimum: 1992,
1110
+ maximum: new Date().getFullYear() + 1,
1111
+ },
1112
+ },
1113
+ required: ['team_key', 'year'],
1061
1114
  },
1062
- required: ['team_key', 'year'],
1063
1115
  },
1064
- },
1065
- {
1066
- name: 'get_team_events_keys',
1067
- description: 'Get event keys for a team in a specific year',
1068
- inputSchema: {
1069
- type: 'object',
1070
- properties: {
1071
- team_key: {
1072
- type: 'string',
1073
- description: 'Team key in format frcXXXX (e.g., frc86)',
1074
- pattern: '^frc\\d+$',
1075
- },
1076
- year: {
1077
- type: 'number',
1078
- description: 'Competition year',
1079
- minimum: 1992,
1080
- maximum: new Date().getFullYear() + 1,
1081
- },
1116
+ {
1117
+ name: 'get_team_events_keys',
1118
+ description: 'Get event keys for a team in a specific year',
1119
+ inputSchema: {
1120
+ type: 'object',
1121
+ properties: {
1122
+ team_key: {
1123
+ type: 'string',
1124
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1125
+ pattern: '^frc\\d+$',
1126
+ },
1127
+ year: {
1128
+ type: 'number',
1129
+ description: 'Competition year',
1130
+ minimum: 1992,
1131
+ maximum: new Date().getFullYear() + 1,
1132
+ },
1133
+ },
1134
+ required: ['team_key', 'year'],
1082
1135
  },
1083
- required: ['team_key', 'year'],
1084
1136
  },
1085
- },
1086
- {
1087
- name: 'get_team_event_awards',
1088
- description: 'Get awards won by a team at a specific event',
1089
- inputSchema: {
1090
- type: 'object',
1091
- properties: {
1092
- team_key: {
1093
- type: 'string',
1094
- description: 'Team key in format frcXXXX (e.g., frc86)',
1095
- pattern: '^frc\\d+$',
1096
- },
1097
- event_key: {
1098
- type: 'string',
1099
- description: 'Event key (e.g., 2023casj)',
1100
- },
1137
+ {
1138
+ name: 'get_team_event_awards',
1139
+ description: 'Get awards won by a team at a specific event',
1140
+ inputSchema: {
1141
+ type: 'object',
1142
+ properties: {
1143
+ team_key: {
1144
+ type: 'string',
1145
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1146
+ pattern: '^frc\\d+$',
1147
+ },
1148
+ event_key: {
1149
+ type: 'string',
1150
+ description: 'Event key (e.g., 2023casj)',
1151
+ },
1152
+ },
1153
+ required: ['team_key', 'event_key'],
1101
1154
  },
1102
- required: ['team_key', 'event_key'],
1103
1155
  },
1104
- },
1105
- {
1106
- name: 'get_team_matches_simple',
1107
- description: 'Get simplified matches for a team in a specific year',
1108
- inputSchema: {
1109
- type: 'object',
1110
- properties: {
1111
- team_key: {
1112
- type: 'string',
1113
- description: 'Team key in format frcXXXX (e.g., frc86)',
1114
- pattern: '^frc\\d+$',
1115
- },
1116
- year: {
1117
- type: 'number',
1118
- description: 'Competition year',
1119
- minimum: 1992,
1120
- maximum: new Date().getFullYear() + 1,
1121
- },
1156
+ {
1157
+ name: 'get_team_matches_simple',
1158
+ description: 'Get simplified matches for a team in a specific year',
1159
+ inputSchema: {
1160
+ type: 'object',
1161
+ properties: {
1162
+ team_key: {
1163
+ type: 'string',
1164
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1165
+ pattern: '^frc\\d+$',
1166
+ },
1167
+ year: {
1168
+ type: 'number',
1169
+ description: 'Competition year',
1170
+ minimum: 1992,
1171
+ maximum: new Date().getFullYear() + 1,
1172
+ },
1173
+ },
1174
+ required: ['team_key', 'year'],
1122
1175
  },
1123
- required: ['team_key', 'year'],
1124
1176
  },
1125
- },
1126
- {
1127
- name: 'get_team_matches_keys',
1128
- description: 'Get match keys for a team in a specific year',
1129
- inputSchema: {
1130
- type: 'object',
1131
- properties: {
1132
- team_key: {
1133
- type: 'string',
1134
- description: 'Team key in format frcXXXX (e.g., frc86)',
1135
- pattern: '^frc\\d+$',
1136
- },
1137
- year: {
1138
- type: 'number',
1139
- description: 'Competition year',
1140
- minimum: 1992,
1141
- maximum: new Date().getFullYear() + 1,
1142
- },
1177
+ {
1178
+ name: 'get_team_matches_keys',
1179
+ description: 'Get match keys for a team in a specific year',
1180
+ inputSchema: {
1181
+ type: 'object',
1182
+ properties: {
1183
+ team_key: {
1184
+ type: 'string',
1185
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1186
+ pattern: '^frc\\d+$',
1187
+ },
1188
+ year: {
1189
+ type: 'number',
1190
+ description: 'Competition year',
1191
+ minimum: 1992,
1192
+ maximum: new Date().getFullYear() + 1,
1193
+ },
1194
+ },
1195
+ required: ['team_key', 'year'],
1143
1196
  },
1144
- required: ['team_key', 'year'],
1145
1197
  },
1146
- },
1147
- {
1148
- name: 'get_team_social_media',
1149
- description: 'Get social media information for a team',
1150
- inputSchema: {
1151
- type: 'object',
1152
- properties: {
1153
- team_key: {
1154
- type: 'string',
1155
- description: 'Team key in format frcXXXX (e.g., frc86)',
1156
- pattern: '^frc\\d+$',
1157
- },
1198
+ {
1199
+ name: 'get_team_social_media',
1200
+ description: 'Get social media information for a team',
1201
+ inputSchema: {
1202
+ type: 'object',
1203
+ properties: {
1204
+ team_key: {
1205
+ type: 'string',
1206
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1207
+ pattern: '^frc\\d+$',
1208
+ },
1209
+ },
1210
+ required: ['team_key'],
1158
1211
  },
1159
- required: ['team_key'],
1160
1212
  },
1161
- },
1162
- {
1163
- name: 'get_team_media_by_tag',
1164
- description: 'Get media for a team filtered by tag',
1165
- inputSchema: {
1166
- type: 'object',
1167
- properties: {
1168
- team_key: {
1169
- type: 'string',
1170
- description: 'Team key in format frcXXXX (e.g., frc86)',
1171
- pattern: '^frc\\d+$',
1172
- },
1173
- media_tag: {
1174
- type: 'string',
1175
- description: 'Media tag to filter by',
1176
- },
1213
+ {
1214
+ name: 'get_team_media_by_tag',
1215
+ description: 'Get media for a team filtered by tag',
1216
+ inputSchema: {
1217
+ type: 'object',
1218
+ properties: {
1219
+ team_key: {
1220
+ type: 'string',
1221
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1222
+ pattern: '^frc\\d+$',
1223
+ },
1224
+ media_tag: {
1225
+ type: 'string',
1226
+ description: 'Media tag to filter by',
1227
+ },
1228
+ },
1229
+ required: ['team_key', 'media_tag'],
1177
1230
  },
1178
- required: ['team_key', 'media_tag'],
1179
1231
  },
1180
- },
1181
- {
1182
- name: 'get_team_media_by_tag_year',
1183
- description: 'Get media for a team filtered by tag and year',
1184
- inputSchema: {
1185
- type: 'object',
1186
- properties: {
1187
- team_key: {
1188
- type: 'string',
1189
- description: 'Team key in format frcXXXX (e.g., frc86)',
1190
- pattern: '^frc\\d+$',
1191
- },
1192
- media_tag: {
1193
- type: 'string',
1194
- description: 'Media tag to filter by',
1195
- },
1196
- year: {
1197
- type: 'number',
1198
- description: 'Competition year',
1199
- minimum: 1992,
1200
- maximum: new Date().getFullYear() + 1,
1201
- },
1232
+ {
1233
+ name: 'get_team_media_by_tag_year',
1234
+ description: 'Get media for a team filtered by tag and year',
1235
+ inputSchema: {
1236
+ type: 'object',
1237
+ properties: {
1238
+ team_key: {
1239
+ type: 'string',
1240
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1241
+ pattern: '^frc\\d+$',
1242
+ },
1243
+ media_tag: {
1244
+ type: 'string',
1245
+ description: 'Media tag to filter by',
1246
+ },
1247
+ year: {
1248
+ type: 'number',
1249
+ description: 'Competition year',
1250
+ minimum: 1992,
1251
+ maximum: new Date().getFullYear() + 1,
1252
+ },
1253
+ },
1254
+ required: ['team_key', 'media_tag', 'year'],
1202
1255
  },
1203
- required: ['team_key', 'media_tag', 'year'],
1204
1256
  },
1205
- },
1206
- {
1207
- name: 'get_event_teams_simple',
1208
- description: 'Get simplified teams participating in an event',
1209
- inputSchema: {
1210
- type: 'object',
1211
- properties: {
1212
- event_key: {
1213
- type: 'string',
1214
- description: 'Event key (e.g., 2023casj)',
1215
- },
1257
+ {
1258
+ name: 'get_event_teams_simple',
1259
+ description: 'Get simplified teams participating in an event',
1260
+ inputSchema: {
1261
+ type: 'object',
1262
+ properties: {
1263
+ event_key: {
1264
+ type: 'string',
1265
+ description: 'Event key (e.g., 2023casj)',
1266
+ },
1267
+ },
1268
+ required: ['event_key'],
1216
1269
  },
1217
- required: ['event_key'],
1218
1270
  },
1219
- },
1220
- {
1221
- name: 'get_event_teams_keys',
1222
- description: 'Get team keys participating in an event',
1223
- inputSchema: {
1224
- type: 'object',
1225
- properties: {
1226
- event_key: {
1227
- type: 'string',
1228
- description: 'Event key (e.g., 2023casj)',
1229
- },
1271
+ {
1272
+ name: 'get_event_teams_keys',
1273
+ description: 'Get team keys participating in an event',
1274
+ inputSchema: {
1275
+ type: 'object',
1276
+ properties: {
1277
+ event_key: {
1278
+ type: 'string',
1279
+ description: 'Event key (e.g., 2023casj)',
1280
+ },
1281
+ },
1282
+ required: ['event_key'],
1230
1283
  },
1231
- required: ['event_key'],
1232
1284
  },
1233
- },
1234
- {
1235
- name: 'get_event_matches_simple',
1236
- description: 'Get simplified matches for an event',
1237
- inputSchema: {
1238
- type: 'object',
1239
- properties: {
1240
- event_key: {
1241
- type: 'string',
1242
- description: 'Event key (e.g., 2023casj)',
1243
- },
1285
+ {
1286
+ name: 'get_event_matches_simple',
1287
+ description: 'Get simplified matches for an event',
1288
+ inputSchema: {
1289
+ type: 'object',
1290
+ properties: {
1291
+ event_key: {
1292
+ type: 'string',
1293
+ description: 'Event key (e.g., 2023casj)',
1294
+ },
1295
+ },
1296
+ required: ['event_key'],
1244
1297
  },
1245
- required: ['event_key'],
1246
1298
  },
1247
- },
1248
- {
1249
- name: 'get_event_matches_keys',
1250
- description: 'Get match keys for an event',
1251
- inputSchema: {
1252
- type: 'object',
1253
- properties: {
1254
- event_key: {
1255
- type: 'string',
1256
- description: 'Event key (e.g., 2023casj)',
1257
- },
1299
+ {
1300
+ name: 'get_event_matches_keys',
1301
+ description: 'Get match keys for an event',
1302
+ inputSchema: {
1303
+ type: 'object',
1304
+ properties: {
1305
+ event_key: {
1306
+ type: 'string',
1307
+ description: 'Event key (e.g., 2023casj)',
1308
+ },
1309
+ },
1310
+ required: ['event_key'],
1258
1311
  },
1259
- required: ['event_key'],
1260
1312
  },
1261
- },
1262
- {
1263
- name: 'get_event_predictions',
1264
- description: 'Get TBA-generated predictions for an event',
1265
- inputSchema: {
1266
- type: 'object',
1267
- properties: {
1268
- event_key: {
1269
- type: 'string',
1270
- description: 'Event key (e.g., 2023casj)',
1271
- },
1313
+ {
1314
+ name: 'get_event_predictions',
1315
+ description: 'Get TBA-generated predictions for an event',
1316
+ inputSchema: {
1317
+ type: 'object',
1318
+ properties: {
1319
+ event_key: {
1320
+ type: 'string',
1321
+ description: 'Event key (e.g., 2023casj)',
1322
+ },
1323
+ },
1324
+ required: ['event_key'],
1272
1325
  },
1273
- required: ['event_key'],
1274
1326
  },
1275
- },
1276
- {
1277
- name: 'get_match_zebra',
1278
- description: 'Get Zebra MotionWorks data for a match',
1279
- inputSchema: {
1280
- type: 'object',
1281
- properties: {
1282
- match_key: {
1283
- type: 'string',
1284
- description: 'Match key (e.g., 2023casj_qm1)',
1285
- },
1327
+ {
1328
+ name: 'get_match_zebra',
1329
+ description: 'Get Zebra MotionWorks data for a match',
1330
+ inputSchema: {
1331
+ type: 'object',
1332
+ properties: {
1333
+ match_key: {
1334
+ type: 'string',
1335
+ description: 'Match key (e.g., 2023casj_qm1)',
1336
+ },
1337
+ },
1338
+ required: ['match_key'],
1286
1339
  },
1287
- required: ['match_key'],
1288
1340
  },
1289
- },
1290
- {
1291
- name: 'get_team_history',
1292
- description: 'Get historical data for a team across all years',
1293
- inputSchema: {
1294
- type: 'object',
1295
- properties: {
1296
- team_key: {
1297
- type: 'string',
1298
- description: 'Team key in format frcXXXX (e.g., frc86)',
1299
- pattern: '^frc\\d+$',
1300
- },
1341
+ {
1342
+ name: 'get_team_history',
1343
+ description: 'Get historical data for a team across all years',
1344
+ inputSchema: {
1345
+ type: 'object',
1346
+ properties: {
1347
+ team_key: {
1348
+ type: 'string',
1349
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1350
+ pattern: '^frc\\d+$',
1351
+ },
1352
+ },
1353
+ required: ['team_key'],
1301
1354
  },
1302
- required: ['team_key'],
1303
1355
  },
1304
- },
1305
- {
1306
- name: 'get_team_event_statuses',
1307
- description: 'Get team event statuses for all events in a year',
1308
- inputSchema: {
1309
- type: 'object',
1310
- properties: {
1311
- team_key: {
1312
- type: 'string',
1313
- description: 'Team key in format frcXXXX (e.g., frc86)',
1314
- pattern: '^frc\\d+$',
1315
- },
1316
- year: {
1317
- type: 'number',
1318
- description: 'Competition year',
1319
- minimum: 1992,
1320
- maximum: new Date().getFullYear() + 1,
1321
- },
1356
+ {
1357
+ name: 'get_team_event_statuses',
1358
+ description: 'Get team event statuses for all events in a year',
1359
+ inputSchema: {
1360
+ type: 'object',
1361
+ properties: {
1362
+ team_key: {
1363
+ type: 'string',
1364
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1365
+ pattern: '^frc\\d+$',
1366
+ },
1367
+ year: {
1368
+ type: 'number',
1369
+ description: 'Competition year',
1370
+ minimum: 1992,
1371
+ maximum: new Date().getFullYear() + 1,
1372
+ },
1373
+ },
1374
+ required: ['team_key', 'year'],
1322
1375
  },
1323
- required: ['team_key', 'year'],
1324
1376
  },
1325
- },
1326
- {
1327
- name: 'get_team_event_matches_simple',
1328
- description: 'Get simplified matches for a team at a specific event',
1329
- inputSchema: {
1330
- type: 'object',
1331
- properties: {
1332
- team_key: {
1333
- type: 'string',
1334
- description: 'Team key in format frcXXXX (e.g., frc86)',
1335
- pattern: '^frc\\d+$',
1336
- },
1337
- event_key: {
1338
- type: 'string',
1339
- description: 'Event key (e.g., 2023casj)',
1340
- },
1377
+ {
1378
+ name: 'get_team_event_matches_simple',
1379
+ description: 'Get simplified matches for a team at a specific event',
1380
+ inputSchema: {
1381
+ type: 'object',
1382
+ properties: {
1383
+ team_key: {
1384
+ type: 'string',
1385
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1386
+ pattern: '^frc\\d+$',
1387
+ },
1388
+ event_key: {
1389
+ type: 'string',
1390
+ description: 'Event key (e.g., 2023casj)',
1391
+ },
1392
+ },
1393
+ required: ['team_key', 'event_key'],
1341
1394
  },
1342
- required: ['team_key', 'event_key'],
1343
1395
  },
1344
- },
1345
- {
1346
- name: 'get_team_event_matches_keys',
1347
- description: 'Get match keys for a team at a specific event',
1348
- inputSchema: {
1349
- type: 'object',
1350
- properties: {
1351
- team_key: {
1352
- type: 'string',
1353
- description: 'Team key in format frcXXXX (e.g., frc86)',
1354
- pattern: '^frc\\d+$',
1355
- },
1356
- event_key: {
1357
- type: 'string',
1358
- description: 'Event key (e.g., 2023casj)',
1359
- },
1396
+ {
1397
+ name: 'get_team_event_matches_keys',
1398
+ description: 'Get match keys for a team at a specific event',
1399
+ inputSchema: {
1400
+ type: 'object',
1401
+ properties: {
1402
+ team_key: {
1403
+ type: 'string',
1404
+ description: 'Team key in format frcXXXX (e.g., frc86)',
1405
+ pattern: '^frc\\d+$',
1406
+ },
1407
+ event_key: {
1408
+ type: 'string',
1409
+ description: 'Event key (e.g., 2023casj)',
1410
+ },
1411
+ },
1412
+ required: ['team_key', 'event_key'],
1360
1413
  },
1361
- required: ['team_key', 'event_key'],
1362
1414
  },
1363
- },
1364
- {
1365
- name: 'get_district_events',
1366
- description: 'Get events in a specific district',
1367
- inputSchema: {
1368
- type: 'object',
1369
- properties: {
1370
- district_key: {
1371
- type: 'string',
1372
- description: 'District key (e.g., 2023fim)',
1373
- },
1415
+ {
1416
+ name: 'get_district_events',
1417
+ description: 'Get events in a specific district',
1418
+ inputSchema: {
1419
+ type: 'object',
1420
+ properties: {
1421
+ district_key: {
1422
+ type: 'string',
1423
+ description: 'District key (e.g., 2023fim)',
1424
+ },
1425
+ },
1426
+ required: ['district_key'],
1374
1427
  },
1375
- required: ['district_key'],
1376
1428
  },
1377
- },
1378
- {
1379
- name: 'get_district_events_simple',
1380
- description: 'Get simplified events in a specific district',
1381
- inputSchema: {
1382
- type: 'object',
1383
- properties: {
1384
- district_key: {
1385
- type: 'string',
1386
- description: 'District key (e.g., 2023fim)',
1387
- },
1429
+ {
1430
+ name: 'get_district_events_simple',
1431
+ description: 'Get simplified events in a specific district',
1432
+ inputSchema: {
1433
+ type: 'object',
1434
+ properties: {
1435
+ district_key: {
1436
+ type: 'string',
1437
+ description: 'District key (e.g., 2023fim)',
1438
+ },
1439
+ },
1440
+ required: ['district_key'],
1388
1441
  },
1389
- required: ['district_key'],
1390
1442
  },
1391
- },
1392
- {
1393
- name: 'get_district_events_keys',
1394
- description: 'Get event keys in a specific district',
1395
- inputSchema: {
1396
- type: 'object',
1397
- properties: {
1398
- district_key: {
1399
- type: 'string',
1400
- description: 'District key (e.g., 2023fim)',
1401
- },
1443
+ {
1444
+ name: 'get_district_events_keys',
1445
+ description: 'Get event keys in a specific district',
1446
+ inputSchema: {
1447
+ type: 'object',
1448
+ properties: {
1449
+ district_key: {
1450
+ type: 'string',
1451
+ description: 'District key (e.g., 2023fim)',
1452
+ },
1453
+ },
1454
+ required: ['district_key'],
1402
1455
  },
1403
- required: ['district_key'],
1404
1456
  },
1405
- },
1406
- {
1407
- name: 'get_district_teams',
1408
- description: 'Get teams in a specific district',
1409
- inputSchema: {
1410
- type: 'object',
1411
- properties: {
1412
- district_key: {
1413
- type: 'string',
1414
- description: 'District key (e.g., 2023fim)',
1415
- },
1457
+ {
1458
+ name: 'get_district_teams',
1459
+ description: 'Get teams in a specific district',
1460
+ inputSchema: {
1461
+ type: 'object',
1462
+ properties: {
1463
+ district_key: {
1464
+ type: 'string',
1465
+ description: 'District key (e.g., 2023fim)',
1466
+ },
1467
+ },
1468
+ required: ['district_key'],
1416
1469
  },
1417
- required: ['district_key'],
1418
1470
  },
1419
- },
1420
- {
1421
- name: 'get_district_teams_simple',
1422
- description: 'Get simplified teams in a specific district',
1423
- inputSchema: {
1424
- type: 'object',
1425
- properties: {
1426
- district_key: {
1427
- type: 'string',
1428
- description: 'District key (e.g., 2023fim)',
1429
- },
1471
+ {
1472
+ name: 'get_district_teams_simple',
1473
+ description: 'Get simplified teams in a specific district',
1474
+ inputSchema: {
1475
+ type: 'object',
1476
+ properties: {
1477
+ district_key: {
1478
+ type: 'string',
1479
+ description: 'District key (e.g., 2023fim)',
1480
+ },
1481
+ },
1482
+ required: ['district_key'],
1430
1483
  },
1431
- required: ['district_key'],
1432
1484
  },
1433
- },
1434
- {
1435
- name: 'get_district_teams_keys',
1436
- description: 'Get team keys in a specific district',
1437
- inputSchema: {
1438
- type: 'object',
1439
- properties: {
1440
- district_key: {
1441
- type: 'string',
1442
- description: 'District key (e.g., 2023fim)',
1443
- },
1485
+ {
1486
+ name: 'get_district_teams_keys',
1487
+ description: 'Get team keys in a specific district',
1488
+ inputSchema: {
1489
+ type: 'object',
1490
+ properties: {
1491
+ district_key: {
1492
+ type: 'string',
1493
+ description: 'District key (e.g., 2023fim)',
1494
+ },
1495
+ },
1496
+ required: ['district_key'],
1444
1497
  },
1445
- required: ['district_key'],
1446
1498
  },
1447
- },
1448
- ],
1449
- };
1450
- });
1451
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
1452
- const { name, arguments: args } = request.params;
1453
- try {
1454
- switch (name) {
1455
- case 'get_team': {
1456
- const { team_key } = z
1457
- .object({ team_key: TeamKeySchema })
1458
- .parse(args);
1459
- const data = await makeApiRequest(`/team/${team_key}`);
1460
- const team = TeamSchema.parse(data);
1461
- return {
1462
- content: [
1463
- {
1464
- type: 'text',
1465
- text: JSON.stringify(team, null, 2),
1466
- },
1467
- ],
1468
- };
1469
- }
1470
- case 'get_team_events': {
1471
- const { team_key, year } = z
1472
- .object({
1473
- team_key: TeamKeySchema,
1474
- year: YearSchema,
1475
- })
1476
- .parse(args);
1477
- const data = await makeApiRequest(`/team/${team_key}/events/${year}`);
1478
- const events = z.array(EventSchema).parse(data);
1479
- return {
1480
- content: [
1481
- {
1482
- type: 'text',
1483
- text: JSON.stringify(events, null, 2),
1484
- },
1485
- ],
1486
- };
1487
- }
1488
- case 'get_team_awards': {
1489
- const { team_key, year } = z
1490
- .object({
1491
- team_key: TeamKeySchema,
1492
- year: YearSchema,
1493
- })
1494
- .parse(args);
1495
- const data = await makeApiRequest(`/team/${team_key}/awards/${year}`);
1496
- const awards = z.array(AwardSchema).parse(data);
1497
- return {
1498
- content: [
1499
- {
1500
- type: 'text',
1501
- text: JSON.stringify(awards, null, 2),
1502
- },
1503
- ],
1504
- };
1505
- }
1506
- case 'get_team_matches': {
1507
- const { team_key, year } = z
1508
- .object({
1509
- team_key: TeamKeySchema,
1510
- year: YearSchema,
1511
- })
1512
- .parse(args);
1513
- const data = await makeApiRequest(`/team/${team_key}/matches/${year}`);
1514
- const matches = z.array(MatchSchema).parse(data);
1515
- return {
1516
- content: [
1517
- {
1518
- type: 'text',
1519
- text: JSON.stringify(matches, null, 2),
1520
- },
1521
- ],
1522
- };
1523
- }
1524
- case 'get_events': {
1525
- const { year } = z.object({ year: YearSchema }).parse(args);
1526
- const data = await makeApiRequest(`/events/${year}`);
1527
- const events = z.array(EventSchema).parse(data);
1528
- return {
1529
- content: [
1530
- {
1531
- type: 'text',
1532
- text: JSON.stringify(events, null, 2),
1533
- },
1534
- ],
1535
- };
1536
- }
1537
- case 'get_event': {
1538
- const { event_key } = z
1539
- .object({ event_key: EventKeySchema })
1540
- .parse(args);
1541
- const data = await makeApiRequest(`/event/${event_key}`);
1542
- const event = EventSchema.parse(data);
1543
- return {
1544
- content: [
1545
- {
1546
- type: 'text',
1547
- text: JSON.stringify(event, null, 2),
1548
- },
1549
- ],
1550
- };
1551
- }
1552
- case 'get_event_teams': {
1553
- const { event_key } = z
1554
- .object({ event_key: EventKeySchema })
1555
- .parse(args);
1556
- const data = await makeApiRequest(`/event/${event_key}/teams`);
1557
- const teams = z.array(TeamSchema).parse(data);
1558
- return {
1559
- content: [
1560
- {
1561
- type: 'text',
1562
- text: JSON.stringify(teams, null, 2),
1563
- },
1564
- ],
1565
- };
1566
- }
1567
- case 'get_event_rankings': {
1568
- const { event_key } = z
1569
- .object({ event_key: EventKeySchema })
1570
- .parse(args);
1571
- const data = await makeApiRequest(`/event/${event_key}/rankings`);
1572
- const rankings = RankingSchema.parse(data);
1573
- return {
1574
- content: [
1575
- {
1576
- type: 'text',
1577
- text: JSON.stringify(rankings, null, 2),
1578
- },
1579
- ],
1580
- };
1581
- }
1582
- case 'get_event_matches': {
1583
- const { event_key } = z
1584
- .object({ event_key: EventKeySchema })
1585
- .parse(args);
1586
- const data = await makeApiRequest(`/event/${event_key}/matches`);
1587
- const matches = z.array(MatchSchema).parse(data);
1588
- return {
1589
- content: [
1590
- {
1591
- type: 'text',
1592
- text: JSON.stringify(matches, null, 2),
1593
- },
1594
- ],
1595
- };
1596
- }
1597
- case 'get_event_alliances': {
1598
- const { event_key } = z
1599
- .object({ event_key: EventKeySchema })
1600
- .parse(args);
1601
- const data = await makeApiRequest(`/event/${event_key}/alliances`);
1602
- const alliances = z.array(AllianceSchema).parse(data);
1603
- return {
1604
- content: [
1605
- {
1606
- type: 'text',
1607
- text: JSON.stringify(alliances, null, 2),
1608
- },
1609
- ],
1610
- };
1611
- }
1612
- case 'get_event_insights': {
1613
- const { event_key } = z
1614
- .object({ event_key: EventKeySchema })
1615
- .parse(args);
1616
- const data = await makeApiRequest(`/event/${event_key}/insights`);
1617
- const insights = InsightsSchema.parse(data);
1618
- return {
1619
- content: [
1620
- {
1621
- type: 'text',
1622
- text: JSON.stringify(insights, null, 2),
1623
- },
1624
- ],
1625
- };
1626
- }
1627
- case 'get_event_district_points': {
1628
- const { event_key } = z
1629
- .object({ event_key: EventKeySchema })
1630
- .parse(args);
1631
- const data = await makeApiRequest(`/event/${event_key}/district_points`);
1632
- const districtPoints = DistrictPointsSchema.parse(data);
1633
- return {
1634
- content: [
1635
- {
1636
- type: 'text',
1637
- text: JSON.stringify(districtPoints, null, 2),
1638
- },
1639
- ],
1640
- };
1641
- }
1642
- case 'get_team_years_participated': {
1643
- const { team_key } = z
1644
- .object({ team_key: TeamKeySchema })
1645
- .parse(args);
1646
- const data = await makeApiRequest(`/team/${team_key}/years_participated`);
1647
- const years = z.array(z.number()).parse(data);
1648
- return {
1649
- content: [
1650
- {
1651
- type: 'text',
1652
- text: JSON.stringify(years, null, 2),
1653
- },
1654
- ],
1655
- };
1656
- }
1657
- case 'get_team_districts': {
1658
- const { team_key } = z
1659
- .object({ team_key: TeamKeySchema })
1660
- .parse(args);
1661
- const data = await makeApiRequest(`/team/${team_key}/districts`);
1662
- const districts = z.array(DistrictSchema).parse(data);
1663
- return {
1664
- content: [
1665
- {
1666
- type: 'text',
1667
- text: JSON.stringify(districts, null, 2),
1668
- },
1669
- ],
1670
- };
1671
- }
1672
- case 'get_team_robots': {
1673
- const { team_key } = z
1674
- .object({ team_key: TeamKeySchema })
1675
- .parse(args);
1676
- const data = await makeApiRequest(`/team/${team_key}/robots`);
1677
- const robots = z.array(RobotSchema).parse(data);
1678
- return {
1679
- content: [
1680
- {
1681
- type: 'text',
1682
- text: JSON.stringify(robots, null, 2),
1683
- },
1684
- ],
1685
- };
1686
- }
1687
- case 'get_team_media': {
1688
- const { team_key, year } = z
1689
- .object({
1690
- team_key: TeamKeySchema,
1691
- year: YearSchema,
1692
- })
1693
- .parse(args);
1694
- const data = await makeApiRequest(`/team/${team_key}/media/${year}`);
1695
- const media = z.array(MediaSchema).parse(data);
1696
- return {
1697
- content: [
1698
- {
1699
- type: 'text',
1700
- text: JSON.stringify(media, null, 2),
1701
- },
1702
- ],
1703
- };
1704
- }
1705
- case 'get_team_event_matches': {
1706
- const { team_key, event_key } = z
1707
- .object({
1708
- team_key: TeamKeySchema,
1709
- event_key: EventKeySchema,
1710
- })
1711
- .parse(args);
1712
- const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches`);
1713
- const matches = z.array(MatchSchema).parse(data);
1714
- return {
1715
- content: [
1716
- {
1717
- type: 'text',
1718
- text: JSON.stringify(matches, null, 2),
1719
- },
1720
- ],
1721
- };
1722
- }
1723
- case 'get_teams': {
1724
- const { page_num } = z
1725
- .object({ page_num: z.number().min(0) })
1726
- .parse(args);
1727
- const data = await makeApiRequest(`/teams/${page_num}`);
1728
- const teams = z.array(TeamSchema).parse(data);
1729
- return {
1730
- content: [
1731
- {
1732
- type: 'text',
1733
- text: JSON.stringify(teams, null, 2),
1734
- },
1735
- ],
1736
- };
1737
- }
1738
- case 'get_status': {
1739
- const data = await makeApiRequest('/status');
1740
- const status = StatusSchema.parse(data);
1741
- return {
1742
- content: [
1743
- {
1744
- type: 'text',
1745
- text: JSON.stringify(status, null, 2),
1746
- },
1747
- ],
1748
- };
1749
- }
1750
- case 'get_match': {
1751
- const { match_key } = z.object({ match_key: z.string() }).parse(args);
1752
- const data = await makeApiRequest(`/match/${match_key}`);
1753
- const match = MatchSchema.parse(data);
1754
- return {
1755
- content: [
1756
- {
1757
- type: 'text',
1758
- text: JSON.stringify(match, null, 2),
1759
- },
1760
- ],
1761
- };
1762
- }
1763
- case 'get_event_oprs': {
1764
- const { event_key } = z
1765
- .object({ event_key: EventKeySchema })
1766
- .parse(args);
1767
- const data = await makeApiRequest(`/event/${event_key}/oprs`);
1768
- const oprs = EventOPRsSchema.parse(data);
1769
- return {
1770
- content: [
1771
- {
1772
- type: 'text',
1773
- text: JSON.stringify(oprs, null, 2),
1774
- },
1775
- ],
1776
- };
1777
- }
1778
- case 'get_event_awards': {
1779
- const { event_key } = z
1780
- .object({ event_key: EventKeySchema })
1781
- .parse(args);
1782
- const data = await makeApiRequest(`/event/${event_key}/awards`);
1783
- const awards = z.array(AwardSchema).parse(data);
1784
- return {
1785
- content: [
1786
- {
1787
- type: 'text',
1788
- text: JSON.stringify(awards, null, 2),
1789
- },
1790
- ],
1791
- };
1792
- }
1793
- case 'get_team_awards_all': {
1794
- const { team_key } = z
1795
- .object({ team_key: TeamKeySchema })
1796
- .parse(args);
1797
- const data = await makeApiRequest(`/team/${team_key}/awards`);
1798
- const awards = z.array(AwardSchema).parse(data);
1799
- return {
1800
- content: [
1801
- {
1802
- type: 'text',
1803
- text: JSON.stringify(awards, null, 2),
1804
- },
1805
- ],
1806
- };
1807
- }
1808
- case 'get_team_events_all': {
1809
- const { team_key } = z
1810
- .object({ team_key: TeamKeySchema })
1811
- .parse(args);
1812
- const data = await makeApiRequest(`/team/${team_key}/events`);
1813
- const events = z.array(EventSchema).parse(data);
1814
- return {
1815
- content: [
1816
- {
1817
- type: 'text',
1818
- text: JSON.stringify(events, null, 2),
1819
- },
1820
- ],
1821
- };
1822
- }
1823
- case 'get_team_event_status': {
1824
- const { team_key, event_key } = z
1825
- .object({
1826
- team_key: TeamKeySchema,
1827
- event_key: EventKeySchema,
1828
- })
1829
- .parse(args);
1830
- const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/status`);
1831
- const status = TeamEventStatusSchema.parse(data);
1832
- return {
1833
- content: [
1834
- {
1835
- type: 'text',
1836
- text: JSON.stringify(status, null, 2),
1837
- },
1838
- ],
1839
- };
1840
- }
1841
- case 'get_districts': {
1842
- const { year } = z.object({ year: YearSchema }).parse(args);
1843
- const data = await makeApiRequest(`/districts/${year}`);
1844
- const districts = z.array(DistrictSchema).parse(data);
1845
- return {
1846
- content: [
1847
- {
1848
- type: 'text',
1849
- text: JSON.stringify(districts, null, 2),
1850
- },
1851
- ],
1852
- };
1853
- }
1854
- case 'get_district_rankings': {
1855
- const { district_key } = z
1856
- .object({ district_key: z.string() })
1857
- .parse(args);
1858
- const data = await makeApiRequest(`/district/${district_key}/rankings`);
1859
- const rankings = z.array(DistrictRankingSchema).parse(data);
1860
- return {
1861
- content: [
1862
- {
1863
- type: 'text',
1864
- text: JSON.stringify(rankings, null, 2),
1865
- },
1866
- ],
1867
- };
1868
- }
1869
- case 'get_teams_simple': {
1870
- const { page_num } = z
1871
- .object({ page_num: z.number().min(0) })
1872
- .parse(args);
1873
- const data = await makeApiRequest(`/teams/${page_num}/simple`);
1874
- const teams = z.array(TeamSimpleSchema).parse(data);
1875
- return {
1876
- content: [
1877
- {
1878
- type: 'text',
1879
- text: JSON.stringify(teams, null, 2),
1880
- },
1881
- ],
1882
- };
1883
- }
1884
- case 'get_teams_keys': {
1885
- const { page_num } = z
1886
- .object({ page_num: z.number().min(0) })
1887
- .parse(args);
1888
- const data = await makeApiRequest(`/teams/${page_num}/keys`);
1889
- const keys = z.array(z.string()).parse(data);
1890
- return {
1891
- content: [
1892
- {
1893
- type: 'text',
1894
- text: JSON.stringify(keys, null, 2),
1895
- },
1896
- ],
1897
- };
1898
- }
1899
- case 'get_teams_by_year': {
1900
- const { year, page_num } = z
1901
- .object({
1902
- year: YearSchema,
1903
- page_num: z.number().min(0),
1904
- })
1905
- .parse(args);
1906
- const data = await makeApiRequest(`/teams/${year}/${page_num}`);
1907
- const teams = z.array(TeamSchema).parse(data);
1908
- return {
1909
- content: [
1910
- {
1911
- type: 'text',
1912
- text: JSON.stringify(teams, null, 2),
1913
- },
1914
- ],
1915
- };
1916
- }
1917
- case 'get_teams_by_year_simple': {
1918
- const { year, page_num } = z
1919
- .object({
1920
- year: YearSchema,
1921
- page_num: z.number().min(0),
1922
- })
1923
- .parse(args);
1924
- const data = await makeApiRequest(`/teams/${year}/${page_num}/simple`);
1925
- const teams = z.array(TeamSimpleSchema).parse(data);
1926
- return {
1927
- content: [
1928
- {
1929
- type: 'text',
1930
- text: JSON.stringify(teams, null, 2),
1931
- },
1932
- ],
1933
- };
1934
- }
1935
- case 'get_teams_by_year_keys': {
1936
- const { year, page_num } = z
1937
- .object({
1938
- year: YearSchema,
1939
- page_num: z.number().min(0),
1940
- })
1941
- .parse(args);
1942
- const data = await makeApiRequest(`/teams/${year}/${page_num}/keys`);
1943
- const keys = z.array(z.string()).parse(data);
1944
- return {
1945
- content: [
1946
- {
1947
- type: 'text',
1948
- text: JSON.stringify(keys, null, 2),
1949
- },
1950
- ],
1951
- };
1952
- }
1953
- case 'get_team_simple': {
1954
- const { team_key } = z
1955
- .object({ team_key: TeamKeySchema })
1956
- .parse(args);
1957
- const data = await makeApiRequest(`/team/${team_key}/simple`);
1958
- const team = TeamSimpleSchema.parse(data);
1959
- return {
1960
- content: [
1961
- {
1962
- type: 'text',
1963
- text: JSON.stringify(team, null, 2),
1964
- },
1965
- ],
1966
- };
1967
- }
1968
- case 'get_event_simple': {
1969
- const { event_key } = z
1970
- .object({ event_key: EventKeySchema })
1971
- .parse(args);
1972
- const data = await makeApiRequest(`/event/${event_key}/simple`);
1973
- const event = EventSimpleSchema.parse(data);
1974
- return {
1975
- content: [
1976
- {
1977
- type: 'text',
1978
- text: JSON.stringify(event, null, 2),
1979
- },
1980
- ],
1981
- };
1982
- }
1983
- case 'get_events_simple': {
1984
- const { year } = z.object({ year: YearSchema }).parse(args);
1985
- const data = await makeApiRequest(`/events/${year}/simple`);
1986
- const events = z.array(EventSimpleSchema).parse(data);
1987
- return {
1988
- content: [
1989
- {
1990
- type: 'text',
1991
- text: JSON.stringify(events, null, 2),
1992
- },
1993
- ],
1994
- };
1995
- }
1996
- case 'get_events_keys': {
1997
- const { year } = z.object({ year: YearSchema }).parse(args);
1998
- const data = await makeApiRequest(`/events/${year}/keys`);
1999
- const keys = z.array(z.string()).parse(data);
2000
- return {
2001
- content: [
2002
- {
2003
- type: 'text',
2004
- text: JSON.stringify(keys, null, 2),
2005
- },
2006
- ],
2007
- };
2008
- }
2009
- case 'get_match_simple': {
2010
- const { match_key } = z.object({ match_key: z.string() }).parse(args);
2011
- const data = await makeApiRequest(`/match/${match_key}/simple`);
2012
- const match = MatchSimpleSchema.parse(data);
2013
- return {
2014
- content: [
2015
- {
2016
- type: 'text',
2017
- text: JSON.stringify(match, null, 2),
2018
- },
2019
- ],
2020
- };
2021
- }
2022
- case 'get_team_events_simple': {
2023
- const { team_key, year } = z
2024
- .object({
2025
- team_key: TeamKeySchema,
2026
- year: YearSchema,
2027
- })
2028
- .parse(args);
2029
- const data = await makeApiRequest(`/team/${team_key}/events/${year}/simple`);
2030
- const events = z.array(EventSimpleSchema).parse(data);
2031
- return {
2032
- content: [
2033
- {
2034
- type: 'text',
2035
- text: JSON.stringify(events, null, 2),
2036
- },
2037
- ],
2038
- };
2039
- }
2040
- case 'get_team_events_keys': {
2041
- const { team_key, year } = z
2042
- .object({
2043
- team_key: TeamKeySchema,
2044
- year: YearSchema,
2045
- })
2046
- .parse(args);
2047
- const data = await makeApiRequest(`/team/${team_key}/events/${year}/keys`);
2048
- const keys = z.array(z.string()).parse(data);
2049
- return {
2050
- content: [
2051
- {
2052
- type: 'text',
2053
- text: JSON.stringify(keys, null, 2),
2054
- },
2055
- ],
2056
- };
2057
- }
2058
- case 'get_team_event_awards': {
2059
- const { team_key, event_key } = z
2060
- .object({
2061
- team_key: TeamKeySchema,
2062
- event_key: EventKeySchema,
2063
- })
2064
- .parse(args);
2065
- const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/awards`);
2066
- const awards = z.array(AwardSchema).parse(data);
2067
- return {
2068
- content: [
2069
- {
2070
- type: 'text',
2071
- text: JSON.stringify(awards, null, 2),
2072
- },
2073
- ],
2074
- };
2075
- }
2076
- case 'get_team_matches_simple': {
2077
- const { team_key, year } = z
2078
- .object({
2079
- team_key: TeamKeySchema,
2080
- year: YearSchema,
2081
- })
2082
- .parse(args);
2083
- const data = await makeApiRequest(`/team/${team_key}/matches/${year}/simple`);
2084
- const matches = z.array(MatchSimpleSchema).parse(data);
2085
- return {
2086
- content: [
2087
- {
2088
- type: 'text',
2089
- text: JSON.stringify(matches, null, 2),
2090
- },
2091
- ],
2092
- };
2093
- }
2094
- case 'get_team_matches_keys': {
2095
- const { team_key, year } = z
2096
- .object({
2097
- team_key: TeamKeySchema,
2098
- year: YearSchema,
2099
- })
2100
- .parse(args);
2101
- const data = await makeApiRequest(`/team/${team_key}/matches/${year}/keys`);
2102
- const keys = z.array(z.string()).parse(data);
2103
- return {
2104
- content: [
2105
- {
2106
- type: 'text',
2107
- text: JSON.stringify(keys, null, 2),
2108
- },
2109
- ],
2110
- };
2111
- }
2112
- case 'get_team_social_media': {
2113
- const { team_key } = z
2114
- .object({ team_key: TeamKeySchema })
2115
- .parse(args);
2116
- const data = await makeApiRequest(`/team/${team_key}/social_media`);
2117
- const media = z.array(MediaSchema).parse(data);
2118
- return {
2119
- content: [
2120
- {
2121
- type: 'text',
2122
- text: JSON.stringify(media, null, 2),
2123
- },
2124
- ],
2125
- };
2126
- }
2127
- case 'get_team_media_by_tag': {
2128
- const { team_key, media_tag } = z
2129
- .object({
2130
- team_key: TeamKeySchema,
2131
- media_tag: z.string(),
2132
- })
2133
- .parse(args);
2134
- const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}`);
2135
- const media = z.array(MediaSchema).parse(data);
2136
- return {
2137
- content: [
2138
- {
2139
- type: 'text',
2140
- text: JSON.stringify(media, null, 2),
2141
- },
2142
- ],
2143
- };
2144
- }
2145
- case 'get_team_media_by_tag_year': {
2146
- const { team_key, media_tag, year } = z
2147
- .object({
2148
- team_key: TeamKeySchema,
2149
- media_tag: z.string(),
2150
- year: YearSchema,
2151
- })
2152
- .parse(args);
2153
- const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}/${year}`);
2154
- const media = z.array(MediaSchema).parse(data);
2155
- return {
2156
- content: [
2157
- {
2158
- type: 'text',
2159
- text: JSON.stringify(media, null, 2),
2160
- },
2161
- ],
2162
- };
2163
- }
2164
- case 'get_event_teams_simple': {
2165
- const { event_key } = z
2166
- .object({ event_key: EventKeySchema })
2167
- .parse(args);
2168
- const data = await makeApiRequest(`/event/${event_key}/teams/simple`);
2169
- const teams = z.array(TeamSimpleSchema).parse(data);
2170
- return {
2171
- content: [
2172
- {
2173
- type: 'text',
2174
- text: JSON.stringify(teams, null, 2),
2175
- },
2176
- ],
2177
- };
2178
- }
2179
- case 'get_event_teams_keys': {
2180
- const { event_key } = z
2181
- .object({ event_key: EventKeySchema })
2182
- .parse(args);
2183
- const data = await makeApiRequest(`/event/${event_key}/teams/keys`);
2184
- const keys = z.array(z.string()).parse(data);
2185
- return {
2186
- content: [
2187
- {
2188
- type: 'text',
2189
- text: JSON.stringify(keys, null, 2),
2190
- },
2191
- ],
2192
- };
2193
- }
2194
- case 'get_event_matches_simple': {
2195
- const { event_key } = z
2196
- .object({ event_key: EventKeySchema })
2197
- .parse(args);
2198
- const data = await makeApiRequest(`/event/${event_key}/matches/simple`);
2199
- const matches = z.array(MatchSimpleSchema).parse(data);
2200
- return {
2201
- content: [
2202
- {
2203
- type: 'text',
2204
- text: JSON.stringify(matches, null, 2),
2205
- },
2206
- ],
2207
- };
2208
- }
2209
- case 'get_event_matches_keys': {
2210
- const { event_key } = z
2211
- .object({ event_key: EventKeySchema })
2212
- .parse(args);
2213
- const data = await makeApiRequest(`/event/${event_key}/matches/keys`);
2214
- const keys = z.array(z.string()).parse(data);
2215
- return {
2216
- content: [
2217
- {
2218
- type: 'text',
2219
- text: JSON.stringify(keys, null, 2),
2220
- },
2221
- ],
2222
- };
2223
- }
2224
- case 'get_team_history': {
2225
- const { team_key } = z
2226
- .object({ team_key: TeamKeySchema })
2227
- .parse(args);
2228
- const data = await makeApiRequest(`/team/${team_key}/history`);
2229
- const history = TeamHistorySchema.parse(data);
2230
- return {
2231
- content: [
2232
- {
2233
- type: 'text',
2234
- text: JSON.stringify(history, null, 2),
2235
- },
2236
- ],
2237
- };
2238
- }
2239
- case 'get_team_event_statuses': {
2240
- const { team_key, year } = z
2241
- .object({
2242
- team_key: TeamKeySchema,
2243
- year: YearSchema,
2244
- })
2245
- .parse(args);
2246
- const data = await makeApiRequest(`/team/${team_key}/events/${year}/statuses`);
2247
- const statuses = z
2248
- .record(z.string(), TeamEventStatusSchema)
2249
- .parse(data);
2250
- return {
2251
- content: [
2252
- {
2253
- type: 'text',
2254
- text: JSON.stringify(statuses, null, 2),
2255
- },
2256
- ],
2257
- };
2258
- }
2259
- case 'get_team_event_matches_simple': {
2260
- const { team_key, event_key } = z
2261
- .object({
2262
- team_key: TeamKeySchema,
2263
- event_key: EventKeySchema,
2264
- })
2265
- .parse(args);
2266
- const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/simple`);
2267
- const matches = z.array(MatchSimpleSchema).parse(data);
2268
- return {
2269
- content: [
2270
- {
2271
- type: 'text',
2272
- text: JSON.stringify(matches, null, 2),
2273
- },
2274
- ],
2275
- };
2276
- }
2277
- case 'get_team_event_matches_keys': {
2278
- const { team_key, event_key } = z
2279
- .object({
2280
- team_key: TeamKeySchema,
2281
- event_key: EventKeySchema,
2282
- })
2283
- .parse(args);
2284
- const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/keys`);
2285
- const keys = z.array(z.string()).parse(data);
2286
- return {
2287
- content: [
2288
- {
2289
- type: 'text',
2290
- text: JSON.stringify(keys, null, 2),
2291
- },
2292
- ],
2293
- };
2294
- }
2295
- case 'get_district_events': {
2296
- const { district_key } = z
2297
- .object({ district_key: z.string() })
2298
- .parse(args);
2299
- const data = await makeApiRequest(`/district/${district_key}/events`);
2300
- const events = z.array(EventSchema).parse(data);
2301
- return {
2302
- content: [
2303
- {
2304
- type: 'text',
2305
- text: JSON.stringify(events, null, 2),
2306
- },
2307
- ],
2308
- };
2309
- }
2310
- case 'get_district_events_simple': {
2311
- const { district_key } = z
2312
- .object({ district_key: z.string() })
2313
- .parse(args);
2314
- const data = await makeApiRequest(`/district/${district_key}/events/simple`);
2315
- const events = z.array(EventSimpleSchema).parse(data);
2316
- return {
2317
- content: [
2318
- {
2319
- type: 'text',
2320
- text: JSON.stringify(events, null, 2),
2321
- },
2322
- ],
2323
- };
2324
- }
2325
- case 'get_district_events_keys': {
2326
- const { district_key } = z
2327
- .object({ district_key: z.string() })
2328
- .parse(args);
2329
- const data = await makeApiRequest(`/district/${district_key}/events/keys`);
2330
- const keys = z.array(z.string()).parse(data);
2331
- return {
2332
- content: [
2333
- {
2334
- type: 'text',
2335
- text: JSON.stringify(keys, null, 2),
2336
- },
2337
- ],
2338
- };
2339
- }
2340
- case 'get_district_teams': {
2341
- const { district_key } = z
2342
- .object({ district_key: z.string() })
2343
- .parse(args);
2344
- const data = await makeApiRequest(`/district/${district_key}/teams`);
2345
- const teams = z.array(TeamSchema).parse(data);
2346
- return {
2347
- content: [
2348
- {
2349
- type: 'text',
2350
- text: JSON.stringify(teams, null, 2),
2351
- },
2352
- ],
2353
- };
2354
- }
2355
- case 'get_district_teams_simple': {
2356
- const { district_key } = z
2357
- .object({ district_key: z.string() })
2358
- .parse(args);
2359
- const data = await makeApiRequest(`/district/${district_key}/teams/simple`);
2360
- const teams = z.array(TeamSimpleSchema).parse(data);
2361
- return {
2362
- content: [
2363
- {
2364
- type: 'text',
2365
- text: JSON.stringify(teams, null, 2),
2366
- },
2367
- ],
2368
- };
2369
- }
2370
- case 'get_district_teams_keys': {
2371
- const { district_key } = z
2372
- .object({ district_key: z.string() })
2373
- .parse(args);
2374
- const data = await makeApiRequest(`/district/${district_key}/teams/keys`);
2375
- const keys = z.array(z.string()).parse(data);
2376
- return {
2377
- content: [
2378
- {
2379
- type: 'text',
2380
- text: JSON.stringify(keys, null, 2),
2381
- },
2382
- ],
2383
- };
2384
- }
2385
- case 'get_match_zebra': {
2386
- const { match_key } = z.object({ match_key: z.string() }).parse(args);
2387
- const data = await makeApiRequest(`/match/${match_key}/zebra`);
2388
- const zebra = ZebraSchema.parse(data);
2389
- return {
2390
- content: [
2391
- {
2392
- type: 'text',
2393
- text: JSON.stringify(zebra, null, 2),
2394
- },
2395
- ],
2396
- };
2397
- }
2398
- case 'get_event_predictions': {
2399
- const { event_key } = z
2400
- .object({ event_key: EventKeySchema })
2401
- .parse(args);
2402
- const data = await makeApiRequest(`/event/${event_key}/predictions`);
2403
- const predictions = PredictionSchema.parse(data);
2404
- return {
2405
- content: [
2406
- {
2407
- type: 'text',
2408
- text: JSON.stringify(predictions, null, 2),
2409
- },
2410
- ],
2411
- };
1499
+ ],
1500
+ };
1501
+ });
1502
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1503
+ const { name, arguments: args } = request.params;
1504
+ await log('debug', `Processing tool request: ${name}`);
1505
+ try {
1506
+ switch (name) {
1507
+ case 'get_team': {
1508
+ const { team_key } = z
1509
+ .object({ team_key: TeamKeySchema })
1510
+ .parse(args);
1511
+ const data = await makeApiRequest(`/team/${team_key}`);
1512
+ const team = TeamSchema.parse(data);
1513
+ return {
1514
+ content: [
1515
+ {
1516
+ type: 'text',
1517
+ text: JSON.stringify(team, null, 2),
1518
+ },
1519
+ ],
1520
+ };
1521
+ }
1522
+ case 'get_team_events': {
1523
+ const { team_key, year } = z
1524
+ .object({
1525
+ team_key: TeamKeySchema,
1526
+ year: YearSchema,
1527
+ })
1528
+ .parse(args);
1529
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}`);
1530
+ const events = z.array(EventSchema).parse(data);
1531
+ return {
1532
+ content: [
1533
+ {
1534
+ type: 'text',
1535
+ text: JSON.stringify(events, null, 2),
1536
+ },
1537
+ ],
1538
+ };
1539
+ }
1540
+ case 'get_team_awards': {
1541
+ const { team_key, year } = z
1542
+ .object({
1543
+ team_key: TeamKeySchema,
1544
+ year: YearSchema,
1545
+ })
1546
+ .parse(args);
1547
+ const data = await makeApiRequest(`/team/${team_key}/awards/${year}`);
1548
+ const awards = z.array(AwardSchema).parse(data);
1549
+ return {
1550
+ content: [
1551
+ {
1552
+ type: 'text',
1553
+ text: JSON.stringify(awards, null, 2),
1554
+ },
1555
+ ],
1556
+ };
1557
+ }
1558
+ case 'get_team_matches': {
1559
+ const { team_key, year } = z
1560
+ .object({
1561
+ team_key: TeamKeySchema,
1562
+ year: YearSchema,
1563
+ })
1564
+ .parse(args);
1565
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}`);
1566
+ const matches = z.array(MatchSchema).parse(data);
1567
+ return {
1568
+ content: [
1569
+ {
1570
+ type: 'text',
1571
+ text: JSON.stringify(matches, null, 2),
1572
+ },
1573
+ ],
1574
+ };
1575
+ }
1576
+ case 'get_events': {
1577
+ const { year } = z.object({ year: YearSchema }).parse(args);
1578
+ const data = await makeApiRequest(`/events/${year}`);
1579
+ const events = z.array(EventSchema).parse(data);
1580
+ return {
1581
+ content: [
1582
+ {
1583
+ type: 'text',
1584
+ text: JSON.stringify(events, null, 2),
1585
+ },
1586
+ ],
1587
+ };
1588
+ }
1589
+ case 'get_event': {
1590
+ const { event_key } = z
1591
+ .object({ event_key: EventKeySchema })
1592
+ .parse(args);
1593
+ const data = await makeApiRequest(`/event/${event_key}`);
1594
+ const event = EventSchema.parse(data);
1595
+ return {
1596
+ content: [
1597
+ {
1598
+ type: 'text',
1599
+ text: JSON.stringify(event, null, 2),
1600
+ },
1601
+ ],
1602
+ };
1603
+ }
1604
+ case 'get_event_teams': {
1605
+ const { event_key } = z
1606
+ .object({ event_key: EventKeySchema })
1607
+ .parse(args);
1608
+ const data = await makeApiRequest(`/event/${event_key}/teams`);
1609
+ const teams = z.array(TeamSchema).parse(data);
1610
+ return {
1611
+ content: [
1612
+ {
1613
+ type: 'text',
1614
+ text: JSON.stringify(teams, null, 2),
1615
+ },
1616
+ ],
1617
+ };
1618
+ }
1619
+ case 'get_event_rankings': {
1620
+ const { event_key } = z
1621
+ .object({ event_key: EventKeySchema })
1622
+ .parse(args);
1623
+ const data = await makeApiRequest(`/event/${event_key}/rankings`);
1624
+ const rankings = RankingSchema.parse(data);
1625
+ return {
1626
+ content: [
1627
+ {
1628
+ type: 'text',
1629
+ text: JSON.stringify(rankings, null, 2),
1630
+ },
1631
+ ],
1632
+ };
1633
+ }
1634
+ case 'get_event_matches': {
1635
+ const { event_key } = z
1636
+ .object({ event_key: EventKeySchema })
1637
+ .parse(args);
1638
+ const data = await makeApiRequest(`/event/${event_key}/matches`);
1639
+ const matches = z.array(MatchSchema).parse(data);
1640
+ return {
1641
+ content: [
1642
+ {
1643
+ type: 'text',
1644
+ text: JSON.stringify(matches, null, 2),
1645
+ },
1646
+ ],
1647
+ };
1648
+ }
1649
+ case 'get_event_alliances': {
1650
+ const { event_key } = z
1651
+ .object({ event_key: EventKeySchema })
1652
+ .parse(args);
1653
+ const data = await makeApiRequest(`/event/${event_key}/alliances`);
1654
+ const alliances = z.array(AllianceSchema).parse(data);
1655
+ return {
1656
+ content: [
1657
+ {
1658
+ type: 'text',
1659
+ text: JSON.stringify(alliances, null, 2),
1660
+ },
1661
+ ],
1662
+ };
1663
+ }
1664
+ case 'get_event_insights': {
1665
+ const { event_key } = z
1666
+ .object({ event_key: EventKeySchema })
1667
+ .parse(args);
1668
+ const data = await makeApiRequest(`/event/${event_key}/insights`);
1669
+ const insights = InsightsSchema.parse(data);
1670
+ return {
1671
+ content: [
1672
+ {
1673
+ type: 'text',
1674
+ text: JSON.stringify(insights, null, 2),
1675
+ },
1676
+ ],
1677
+ };
1678
+ }
1679
+ case 'get_event_district_points': {
1680
+ const { event_key } = z
1681
+ .object({ event_key: EventKeySchema })
1682
+ .parse(args);
1683
+ const data = await makeApiRequest(`/event/${event_key}/district_points`);
1684
+ const districtPoints = DistrictPointsSchema.parse(data);
1685
+ return {
1686
+ content: [
1687
+ {
1688
+ type: 'text',
1689
+ text: JSON.stringify(districtPoints, null, 2),
1690
+ },
1691
+ ],
1692
+ };
1693
+ }
1694
+ case 'get_team_years_participated': {
1695
+ const { team_key } = z
1696
+ .object({ team_key: TeamKeySchema })
1697
+ .parse(args);
1698
+ const data = await makeApiRequest(`/team/${team_key}/years_participated`);
1699
+ const years = z.array(z.number()).parse(data);
1700
+ return {
1701
+ content: [
1702
+ {
1703
+ type: 'text',
1704
+ text: JSON.stringify(years, null, 2),
1705
+ },
1706
+ ],
1707
+ };
1708
+ }
1709
+ case 'get_team_districts': {
1710
+ const { team_key } = z
1711
+ .object({ team_key: TeamKeySchema })
1712
+ .parse(args);
1713
+ const data = await makeApiRequest(`/team/${team_key}/districts`);
1714
+ const districts = z.array(DistrictSchema).parse(data);
1715
+ return {
1716
+ content: [
1717
+ {
1718
+ type: 'text',
1719
+ text: JSON.stringify(districts, null, 2),
1720
+ },
1721
+ ],
1722
+ };
1723
+ }
1724
+ case 'get_team_robots': {
1725
+ const { team_key } = z
1726
+ .object({ team_key: TeamKeySchema })
1727
+ .parse(args);
1728
+ const data = await makeApiRequest(`/team/${team_key}/robots`);
1729
+ const robots = z.array(RobotSchema).parse(data);
1730
+ return {
1731
+ content: [
1732
+ {
1733
+ type: 'text',
1734
+ text: JSON.stringify(robots, null, 2),
1735
+ },
1736
+ ],
1737
+ };
1738
+ }
1739
+ case 'get_team_media': {
1740
+ const { team_key, year } = z
1741
+ .object({
1742
+ team_key: TeamKeySchema,
1743
+ year: YearSchema,
1744
+ })
1745
+ .parse(args);
1746
+ const data = await makeApiRequest(`/team/${team_key}/media/${year}`);
1747
+ const media = z.array(MediaSchema).parse(data);
1748
+ return {
1749
+ content: [
1750
+ {
1751
+ type: 'text',
1752
+ text: JSON.stringify(media, null, 2),
1753
+ },
1754
+ ],
1755
+ };
1756
+ }
1757
+ case 'get_team_event_matches': {
1758
+ const { team_key, event_key } = z
1759
+ .object({
1760
+ team_key: TeamKeySchema,
1761
+ event_key: EventKeySchema,
1762
+ })
1763
+ .parse(args);
1764
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches`);
1765
+ const matches = z.array(MatchSchema).parse(data);
1766
+ return {
1767
+ content: [
1768
+ {
1769
+ type: 'text',
1770
+ text: JSON.stringify(matches, null, 2),
1771
+ },
1772
+ ],
1773
+ };
1774
+ }
1775
+ case 'get_teams': {
1776
+ const { page_num } = z
1777
+ .object({ page_num: z.number().min(0) })
1778
+ .parse(args);
1779
+ const data = await makeApiRequest(`/teams/${page_num}`);
1780
+ const teams = z.array(TeamSchema).parse(data);
1781
+ return {
1782
+ content: [
1783
+ {
1784
+ type: 'text',
1785
+ text: JSON.stringify(teams, null, 2),
1786
+ },
1787
+ ],
1788
+ };
1789
+ }
1790
+ case 'get_status': {
1791
+ const data = await makeApiRequest('/status');
1792
+ const status = StatusSchema.parse(data);
1793
+ return {
1794
+ content: [
1795
+ {
1796
+ type: 'text',
1797
+ text: JSON.stringify(status, null, 2),
1798
+ },
1799
+ ],
1800
+ };
1801
+ }
1802
+ case 'get_match': {
1803
+ const { match_key } = z
1804
+ .object({ match_key: z.string() })
1805
+ .parse(args);
1806
+ const data = await makeApiRequest(`/match/${match_key}`);
1807
+ const match = MatchSchema.parse(data);
1808
+ return {
1809
+ content: [
1810
+ {
1811
+ type: 'text',
1812
+ text: JSON.stringify(match, null, 2),
1813
+ },
1814
+ ],
1815
+ };
1816
+ }
1817
+ case 'get_event_oprs': {
1818
+ const { event_key } = z
1819
+ .object({ event_key: EventKeySchema })
1820
+ .parse(args);
1821
+ const data = await makeApiRequest(`/event/${event_key}/oprs`);
1822
+ const oprs = EventOPRsSchema.parse(data);
1823
+ return {
1824
+ content: [
1825
+ {
1826
+ type: 'text',
1827
+ text: JSON.stringify(oprs, null, 2),
1828
+ },
1829
+ ],
1830
+ };
1831
+ }
1832
+ case 'get_event_awards': {
1833
+ const { event_key } = z
1834
+ .object({ event_key: EventKeySchema })
1835
+ .parse(args);
1836
+ const data = await makeApiRequest(`/event/${event_key}/awards`);
1837
+ const awards = z.array(AwardSchema).parse(data);
1838
+ return {
1839
+ content: [
1840
+ {
1841
+ type: 'text',
1842
+ text: JSON.stringify(awards, null, 2),
1843
+ },
1844
+ ],
1845
+ };
1846
+ }
1847
+ case 'get_team_awards_all': {
1848
+ const { team_key } = z
1849
+ .object({ team_key: TeamKeySchema })
1850
+ .parse(args);
1851
+ const data = await makeApiRequest(`/team/${team_key}/awards`);
1852
+ const awards = z.array(AwardSchema).parse(data);
1853
+ return {
1854
+ content: [
1855
+ {
1856
+ type: 'text',
1857
+ text: JSON.stringify(awards, null, 2),
1858
+ },
1859
+ ],
1860
+ };
1861
+ }
1862
+ case 'get_team_events_all': {
1863
+ const { team_key } = z
1864
+ .object({ team_key: TeamKeySchema })
1865
+ .parse(args);
1866
+ const data = await makeApiRequest(`/team/${team_key}/events`);
1867
+ const events = z.array(EventSchema).parse(data);
1868
+ return {
1869
+ content: [
1870
+ {
1871
+ type: 'text',
1872
+ text: JSON.stringify(events, null, 2),
1873
+ },
1874
+ ],
1875
+ };
1876
+ }
1877
+ case 'get_team_event_status': {
1878
+ const { team_key, event_key } = z
1879
+ .object({
1880
+ team_key: TeamKeySchema,
1881
+ event_key: EventKeySchema,
1882
+ })
1883
+ .parse(args);
1884
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/status`);
1885
+ const status = TeamEventStatusSchema.parse(data);
1886
+ return {
1887
+ content: [
1888
+ {
1889
+ type: 'text',
1890
+ text: JSON.stringify(status, null, 2),
1891
+ },
1892
+ ],
1893
+ };
1894
+ }
1895
+ case 'get_districts': {
1896
+ const { year } = z.object({ year: YearSchema }).parse(args);
1897
+ const data = await makeApiRequest(`/districts/${year}`);
1898
+ const districts = z.array(DistrictSchema).parse(data);
1899
+ return {
1900
+ content: [
1901
+ {
1902
+ type: 'text',
1903
+ text: JSON.stringify(districts, null, 2),
1904
+ },
1905
+ ],
1906
+ };
1907
+ }
1908
+ case 'get_district_rankings': {
1909
+ const { district_key } = z
1910
+ .object({ district_key: z.string() })
1911
+ .parse(args);
1912
+ const data = await makeApiRequest(`/district/${district_key}/rankings`);
1913
+ const rankings = z.array(DistrictRankingSchema).parse(data);
1914
+ return {
1915
+ content: [
1916
+ {
1917
+ type: 'text',
1918
+ text: JSON.stringify(rankings, null, 2),
1919
+ },
1920
+ ],
1921
+ };
1922
+ }
1923
+ case 'get_teams_simple': {
1924
+ const { page_num } = z
1925
+ .object({ page_num: z.number().min(0) })
1926
+ .parse(args);
1927
+ const data = await makeApiRequest(`/teams/${page_num}/simple`);
1928
+ const teams = z.array(TeamSimpleSchema).parse(data);
1929
+ return {
1930
+ content: [
1931
+ {
1932
+ type: 'text',
1933
+ text: JSON.stringify(teams, null, 2),
1934
+ },
1935
+ ],
1936
+ };
1937
+ }
1938
+ case 'get_teams_keys': {
1939
+ const { page_num } = z
1940
+ .object({ page_num: z.number().min(0) })
1941
+ .parse(args);
1942
+ const data = await makeApiRequest(`/teams/${page_num}/keys`);
1943
+ const keys = z.array(z.string()).parse(data);
1944
+ return {
1945
+ content: [
1946
+ {
1947
+ type: 'text',
1948
+ text: JSON.stringify(keys, null, 2),
1949
+ },
1950
+ ],
1951
+ };
1952
+ }
1953
+ case 'get_teams_by_year': {
1954
+ const { year, page_num } = z
1955
+ .object({
1956
+ year: YearSchema,
1957
+ page_num: z.number().min(0),
1958
+ })
1959
+ .parse(args);
1960
+ const data = await makeApiRequest(`/teams/${year}/${page_num}`);
1961
+ const teams = z.array(TeamSchema).parse(data);
1962
+ return {
1963
+ content: [
1964
+ {
1965
+ type: 'text',
1966
+ text: JSON.stringify(teams, null, 2),
1967
+ },
1968
+ ],
1969
+ };
1970
+ }
1971
+ case 'get_teams_by_year_simple': {
1972
+ const { year, page_num } = z
1973
+ .object({
1974
+ year: YearSchema,
1975
+ page_num: z.number().min(0),
1976
+ })
1977
+ .parse(args);
1978
+ const data = await makeApiRequest(`/teams/${year}/${page_num}/simple`);
1979
+ const teams = z.array(TeamSimpleSchema).parse(data);
1980
+ return {
1981
+ content: [
1982
+ {
1983
+ type: 'text',
1984
+ text: JSON.stringify(teams, null, 2),
1985
+ },
1986
+ ],
1987
+ };
1988
+ }
1989
+ case 'get_teams_by_year_keys': {
1990
+ const { year, page_num } = z
1991
+ .object({
1992
+ year: YearSchema,
1993
+ page_num: z.number().min(0),
1994
+ })
1995
+ .parse(args);
1996
+ const data = await makeApiRequest(`/teams/${year}/${page_num}/keys`);
1997
+ const keys = z.array(z.string()).parse(data);
1998
+ return {
1999
+ content: [
2000
+ {
2001
+ type: 'text',
2002
+ text: JSON.stringify(keys, null, 2),
2003
+ },
2004
+ ],
2005
+ };
2006
+ }
2007
+ case 'get_team_simple': {
2008
+ const { team_key } = z
2009
+ .object({ team_key: TeamKeySchema })
2010
+ .parse(args);
2011
+ const data = await makeApiRequest(`/team/${team_key}/simple`);
2012
+ const team = TeamSimpleSchema.parse(data);
2013
+ return {
2014
+ content: [
2015
+ {
2016
+ type: 'text',
2017
+ text: JSON.stringify(team, null, 2),
2018
+ },
2019
+ ],
2020
+ };
2021
+ }
2022
+ case 'get_event_simple': {
2023
+ const { event_key } = z
2024
+ .object({ event_key: EventKeySchema })
2025
+ .parse(args);
2026
+ const data = await makeApiRequest(`/event/${event_key}/simple`);
2027
+ const event = EventSimpleSchema.parse(data);
2028
+ return {
2029
+ content: [
2030
+ {
2031
+ type: 'text',
2032
+ text: JSON.stringify(event, null, 2),
2033
+ },
2034
+ ],
2035
+ };
2036
+ }
2037
+ case 'get_events_simple': {
2038
+ const { year } = z.object({ year: YearSchema }).parse(args);
2039
+ const data = await makeApiRequest(`/events/${year}/simple`);
2040
+ const events = z.array(EventSimpleSchema).parse(data);
2041
+ return {
2042
+ content: [
2043
+ {
2044
+ type: 'text',
2045
+ text: JSON.stringify(events, null, 2),
2046
+ },
2047
+ ],
2048
+ };
2049
+ }
2050
+ case 'get_events_keys': {
2051
+ const { year } = z.object({ year: YearSchema }).parse(args);
2052
+ const data = await makeApiRequest(`/events/${year}/keys`);
2053
+ const keys = z.array(z.string()).parse(data);
2054
+ return {
2055
+ content: [
2056
+ {
2057
+ type: 'text',
2058
+ text: JSON.stringify(keys, null, 2),
2059
+ },
2060
+ ],
2061
+ };
2062
+ }
2063
+ case 'get_match_simple': {
2064
+ const { match_key } = z
2065
+ .object({ match_key: z.string() })
2066
+ .parse(args);
2067
+ const data = await makeApiRequest(`/match/${match_key}/simple`);
2068
+ const match = MatchSimpleSchema.parse(data);
2069
+ return {
2070
+ content: [
2071
+ {
2072
+ type: 'text',
2073
+ text: JSON.stringify(match, null, 2),
2074
+ },
2075
+ ],
2076
+ };
2077
+ }
2078
+ case 'get_team_events_simple': {
2079
+ const { team_key, year } = z
2080
+ .object({
2081
+ team_key: TeamKeySchema,
2082
+ year: YearSchema,
2083
+ })
2084
+ .parse(args);
2085
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/simple`);
2086
+ const events = z.array(EventSimpleSchema).parse(data);
2087
+ return {
2088
+ content: [
2089
+ {
2090
+ type: 'text',
2091
+ text: JSON.stringify(events, null, 2),
2092
+ },
2093
+ ],
2094
+ };
2095
+ }
2096
+ case 'get_team_events_keys': {
2097
+ const { team_key, year } = z
2098
+ .object({
2099
+ team_key: TeamKeySchema,
2100
+ year: YearSchema,
2101
+ })
2102
+ .parse(args);
2103
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/keys`);
2104
+ const keys = z.array(z.string()).parse(data);
2105
+ return {
2106
+ content: [
2107
+ {
2108
+ type: 'text',
2109
+ text: JSON.stringify(keys, null, 2),
2110
+ },
2111
+ ],
2112
+ };
2113
+ }
2114
+ case 'get_team_event_awards': {
2115
+ const { team_key, event_key } = z
2116
+ .object({
2117
+ team_key: TeamKeySchema,
2118
+ event_key: EventKeySchema,
2119
+ })
2120
+ .parse(args);
2121
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/awards`);
2122
+ const awards = z.array(AwardSchema).parse(data);
2123
+ return {
2124
+ content: [
2125
+ {
2126
+ type: 'text',
2127
+ text: JSON.stringify(awards, null, 2),
2128
+ },
2129
+ ],
2130
+ };
2131
+ }
2132
+ case 'get_team_matches_simple': {
2133
+ const { team_key, year } = z
2134
+ .object({
2135
+ team_key: TeamKeySchema,
2136
+ year: YearSchema,
2137
+ })
2138
+ .parse(args);
2139
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}/simple`);
2140
+ const matches = z.array(MatchSimpleSchema).parse(data);
2141
+ return {
2142
+ content: [
2143
+ {
2144
+ type: 'text',
2145
+ text: JSON.stringify(matches, null, 2),
2146
+ },
2147
+ ],
2148
+ };
2149
+ }
2150
+ case 'get_team_matches_keys': {
2151
+ const { team_key, year } = z
2152
+ .object({
2153
+ team_key: TeamKeySchema,
2154
+ year: YearSchema,
2155
+ })
2156
+ .parse(args);
2157
+ const data = await makeApiRequest(`/team/${team_key}/matches/${year}/keys`);
2158
+ const keys = z.array(z.string()).parse(data);
2159
+ return {
2160
+ content: [
2161
+ {
2162
+ type: 'text',
2163
+ text: JSON.stringify(keys, null, 2),
2164
+ },
2165
+ ],
2166
+ };
2167
+ }
2168
+ case 'get_team_social_media': {
2169
+ const { team_key } = z
2170
+ .object({ team_key: TeamKeySchema })
2171
+ .parse(args);
2172
+ const data = await makeApiRequest(`/team/${team_key}/social_media`);
2173
+ const media = z.array(MediaSchema).parse(data);
2174
+ return {
2175
+ content: [
2176
+ {
2177
+ type: 'text',
2178
+ text: JSON.stringify(media, null, 2),
2179
+ },
2180
+ ],
2181
+ };
2182
+ }
2183
+ case 'get_team_media_by_tag': {
2184
+ const { team_key, media_tag } = z
2185
+ .object({
2186
+ team_key: TeamKeySchema,
2187
+ media_tag: z.string(),
2188
+ })
2189
+ .parse(args);
2190
+ const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}`);
2191
+ const media = z.array(MediaSchema).parse(data);
2192
+ return {
2193
+ content: [
2194
+ {
2195
+ type: 'text',
2196
+ text: JSON.stringify(media, null, 2),
2197
+ },
2198
+ ],
2199
+ };
2200
+ }
2201
+ case 'get_team_media_by_tag_year': {
2202
+ const { team_key, media_tag, year } = z
2203
+ .object({
2204
+ team_key: TeamKeySchema,
2205
+ media_tag: z.string(),
2206
+ year: YearSchema,
2207
+ })
2208
+ .parse(args);
2209
+ const data = await makeApiRequest(`/team/${team_key}/media/tag/${media_tag}/${year}`);
2210
+ const media = z.array(MediaSchema).parse(data);
2211
+ return {
2212
+ content: [
2213
+ {
2214
+ type: 'text',
2215
+ text: JSON.stringify(media, null, 2),
2216
+ },
2217
+ ],
2218
+ };
2219
+ }
2220
+ case 'get_event_teams_simple': {
2221
+ const { event_key } = z
2222
+ .object({ event_key: EventKeySchema })
2223
+ .parse(args);
2224
+ const data = await makeApiRequest(`/event/${event_key}/teams/simple`);
2225
+ const teams = z.array(TeamSimpleSchema).parse(data);
2226
+ return {
2227
+ content: [
2228
+ {
2229
+ type: 'text',
2230
+ text: JSON.stringify(teams, null, 2),
2231
+ },
2232
+ ],
2233
+ };
2234
+ }
2235
+ case 'get_event_teams_keys': {
2236
+ const { event_key } = z
2237
+ .object({ event_key: EventKeySchema })
2238
+ .parse(args);
2239
+ const data = await makeApiRequest(`/event/${event_key}/teams/keys`);
2240
+ const keys = z.array(z.string()).parse(data);
2241
+ return {
2242
+ content: [
2243
+ {
2244
+ type: 'text',
2245
+ text: JSON.stringify(keys, null, 2),
2246
+ },
2247
+ ],
2248
+ };
2249
+ }
2250
+ case 'get_event_matches_simple': {
2251
+ const { event_key } = z
2252
+ .object({ event_key: EventKeySchema })
2253
+ .parse(args);
2254
+ const data = await makeApiRequest(`/event/${event_key}/matches/simple`);
2255
+ const matches = z.array(MatchSimpleSchema).parse(data);
2256
+ return {
2257
+ content: [
2258
+ {
2259
+ type: 'text',
2260
+ text: JSON.stringify(matches, null, 2),
2261
+ },
2262
+ ],
2263
+ };
2264
+ }
2265
+ case 'get_event_matches_keys': {
2266
+ const { event_key } = z
2267
+ .object({ event_key: EventKeySchema })
2268
+ .parse(args);
2269
+ const data = await makeApiRequest(`/event/${event_key}/matches/keys`);
2270
+ const keys = z.array(z.string()).parse(data);
2271
+ return {
2272
+ content: [
2273
+ {
2274
+ type: 'text',
2275
+ text: JSON.stringify(keys, null, 2),
2276
+ },
2277
+ ],
2278
+ };
2279
+ }
2280
+ case 'get_team_history': {
2281
+ const { team_key } = z
2282
+ .object({ team_key: TeamKeySchema })
2283
+ .parse(args);
2284
+ const data = await makeApiRequest(`/team/${team_key}/history`);
2285
+ const history = TeamHistorySchema.parse(data);
2286
+ return {
2287
+ content: [
2288
+ {
2289
+ type: 'text',
2290
+ text: JSON.stringify(history, null, 2),
2291
+ },
2292
+ ],
2293
+ };
2294
+ }
2295
+ case 'get_team_event_statuses': {
2296
+ const { team_key, year } = z
2297
+ .object({
2298
+ team_key: TeamKeySchema,
2299
+ year: YearSchema,
2300
+ })
2301
+ .parse(args);
2302
+ const data = await makeApiRequest(`/team/${team_key}/events/${year}/statuses`);
2303
+ const statuses = z
2304
+ .record(z.string(), TeamEventStatusSchema)
2305
+ .parse(data);
2306
+ return {
2307
+ content: [
2308
+ {
2309
+ type: 'text',
2310
+ text: JSON.stringify(statuses, null, 2),
2311
+ },
2312
+ ],
2313
+ };
2314
+ }
2315
+ case 'get_team_event_matches_simple': {
2316
+ const { team_key, event_key } = z
2317
+ .object({
2318
+ team_key: TeamKeySchema,
2319
+ event_key: EventKeySchema,
2320
+ })
2321
+ .parse(args);
2322
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/simple`);
2323
+ const matches = z.array(MatchSimpleSchema).parse(data);
2324
+ return {
2325
+ content: [
2326
+ {
2327
+ type: 'text',
2328
+ text: JSON.stringify(matches, null, 2),
2329
+ },
2330
+ ],
2331
+ };
2332
+ }
2333
+ case 'get_team_event_matches_keys': {
2334
+ const { team_key, event_key } = z
2335
+ .object({
2336
+ team_key: TeamKeySchema,
2337
+ event_key: EventKeySchema,
2338
+ })
2339
+ .parse(args);
2340
+ const data = await makeApiRequest(`/team/${team_key}/event/${event_key}/matches/keys`);
2341
+ const keys = z.array(z.string()).parse(data);
2342
+ return {
2343
+ content: [
2344
+ {
2345
+ type: 'text',
2346
+ text: JSON.stringify(keys, null, 2),
2347
+ },
2348
+ ],
2349
+ };
2350
+ }
2351
+ case 'get_district_events': {
2352
+ const { district_key } = z
2353
+ .object({ district_key: z.string() })
2354
+ .parse(args);
2355
+ const data = await makeApiRequest(`/district/${district_key}/events`);
2356
+ const events = z.array(EventSchema).parse(data);
2357
+ return {
2358
+ content: [
2359
+ {
2360
+ type: 'text',
2361
+ text: JSON.stringify(events, null, 2),
2362
+ },
2363
+ ],
2364
+ };
2365
+ }
2366
+ case 'get_district_events_simple': {
2367
+ const { district_key } = z
2368
+ .object({ district_key: z.string() })
2369
+ .parse(args);
2370
+ const data = await makeApiRequest(`/district/${district_key}/events/simple`);
2371
+ const events = z.array(EventSimpleSchema).parse(data);
2372
+ return {
2373
+ content: [
2374
+ {
2375
+ type: 'text',
2376
+ text: JSON.stringify(events, null, 2),
2377
+ },
2378
+ ],
2379
+ };
2380
+ }
2381
+ case 'get_district_events_keys': {
2382
+ const { district_key } = z
2383
+ .object({ district_key: z.string() })
2384
+ .parse(args);
2385
+ const data = await makeApiRequest(`/district/${district_key}/events/keys`);
2386
+ const keys = z.array(z.string()).parse(data);
2387
+ return {
2388
+ content: [
2389
+ {
2390
+ type: 'text',
2391
+ text: JSON.stringify(keys, null, 2),
2392
+ },
2393
+ ],
2394
+ };
2395
+ }
2396
+ case 'get_district_teams': {
2397
+ const { district_key } = z
2398
+ .object({ district_key: z.string() })
2399
+ .parse(args);
2400
+ const data = await makeApiRequest(`/district/${district_key}/teams`);
2401
+ const teams = z.array(TeamSchema).parse(data);
2402
+ return {
2403
+ content: [
2404
+ {
2405
+ type: 'text',
2406
+ text: JSON.stringify(teams, null, 2),
2407
+ },
2408
+ ],
2409
+ };
2410
+ }
2411
+ case 'get_district_teams_simple': {
2412
+ const { district_key } = z
2413
+ .object({ district_key: z.string() })
2414
+ .parse(args);
2415
+ const data = await makeApiRequest(`/district/${district_key}/teams/simple`);
2416
+ const teams = z.array(TeamSimpleSchema).parse(data);
2417
+ return {
2418
+ content: [
2419
+ {
2420
+ type: 'text',
2421
+ text: JSON.stringify(teams, null, 2),
2422
+ },
2423
+ ],
2424
+ };
2425
+ }
2426
+ case 'get_district_teams_keys': {
2427
+ const { district_key } = z
2428
+ .object({ district_key: z.string() })
2429
+ .parse(args);
2430
+ const data = await makeApiRequest(`/district/${district_key}/teams/keys`);
2431
+ const keys = z.array(z.string()).parse(data);
2432
+ return {
2433
+ content: [
2434
+ {
2435
+ type: 'text',
2436
+ text: JSON.stringify(keys, null, 2),
2437
+ },
2438
+ ],
2439
+ };
2440
+ }
2441
+ case 'get_match_zebra': {
2442
+ const { match_key } = z
2443
+ .object({ match_key: z.string() })
2444
+ .parse(args);
2445
+ const data = await makeApiRequest(`/match/${match_key}/zebra`);
2446
+ const zebra = ZebraSchema.parse(data);
2447
+ return {
2448
+ content: [
2449
+ {
2450
+ type: 'text',
2451
+ text: JSON.stringify(zebra, null, 2),
2452
+ },
2453
+ ],
2454
+ };
2455
+ }
2456
+ case 'get_event_predictions': {
2457
+ const { event_key } = z
2458
+ .object({ event_key: EventKeySchema })
2459
+ .parse(args);
2460
+ const data = await makeApiRequest(`/event/${event_key}/predictions`);
2461
+ const predictions = PredictionSchema.parse(data);
2462
+ return {
2463
+ content: [
2464
+ {
2465
+ type: 'text',
2466
+ text: JSON.stringify(predictions, null, 2),
2467
+ },
2468
+ ],
2469
+ };
2470
+ }
2471
+ default:
2472
+ throw new Error(`Unknown tool: ${name}`);
2412
2473
  }
2413
- default:
2414
- throw new Error(`Unknown tool: ${name}`);
2415
2474
  }
2475
+ catch (error) {
2476
+ const errorMessage = `Tool execution error for '${name}': ${error instanceof Error ? error.message : String(error)}`;
2477
+ await log('error', errorMessage);
2478
+ return {
2479
+ content: [
2480
+ {
2481
+ type: 'text',
2482
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`,
2483
+ },
2484
+ ],
2485
+ isError: true,
2486
+ };
2487
+ }
2488
+ });
2489
+ await log('info', 'Setting up transport connection ...');
2490
+ try {
2491
+ const transport = new StdioServerTransport();
2492
+ await server.connect(transport);
2493
+ await log('info', 'The Blue Alliance MCP Server running on stdio');
2416
2494
  }
2417
2495
  catch (error) {
2418
- return {
2419
- content: [
2420
- {
2421
- type: 'text',
2422
- text: `Error: ${error instanceof Error ? error.message : String(error)}`,
2423
- },
2424
- ],
2425
- isError: true,
2426
- };
2496
+ const errorMessage = 'Failed to connect to transport';
2497
+ await log('error', `${errorMessage}: ${error instanceof Error ? error.message : error}`);
2498
+ throw new Error(errorMessage);
2427
2499
  }
2428
- });
2429
- const transport = new StdioServerTransport();
2430
- await server.connect(transport);
2431
- console.error('The Blue Alliance MCP Server running on stdio');
2500
+ // Set up error handlers for the server
2501
+ process.on('uncaughtException', (error) => {
2502
+ console.error('Uncaught exception in MCP server:', error);
2503
+ process.exit(1);
2504
+ });
2505
+ process.on('unhandledRejection', (reason, promise) => {
2506
+ console.error('Unhandled rejection in MCP server:', reason, 'at promise:', promise);
2507
+ process.exit(1);
2508
+ });
2509
+ }
2510
+ catch (error) {
2511
+ const errorMessage = 'Fatal error during server initialization';
2512
+ // Use console.error as fallback since server may not be available yet
2513
+ console.error(`${errorMessage}: ${error instanceof Error ? error.message : error}`);
2514
+ throw error;
2515
+ }
2432
2516
  }
2433
2517
  // Only run the server if this file is executed directly
2434
2518
  // Check if this is the main module by comparing file paths
2435
2519
  const isMainModule = process.argv[1] && process.argv[1].endsWith('index.js');
2436
2520
  if (isMainModule) {
2437
2521
  runServer().catch((error) => {
2438
- console.error('Fatal error running server:', error);
2522
+ console.error(`Fatal error running server: ${error instanceof Error ? error.message : error}`);
2523
+ console.error(`Stack trace: ${error instanceof Error ? error.stack : 'No stack trace available'}`);
2524
+ console.error('Server will now exit');
2439
2525
  process.exit(1);
2440
2526
  });
2441
2527
  }