Skip to main content
Glama

get_team_event_matches

Retrieve match data for a specific FIRST Robotics Competition team at a particular event using The Blue Alliance API.

Instructions

Get matches for a team at a specific event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team_keyYesTeam key in format frcXXXX (e.g., frc86)
event_keyYesEvent key (e.g., 2023casj)

Implementation Reference

  • Handler implementation for get_team_event_matches: validates team_key and event_key, fetches matches from TBA API /team/{team_key}/event/{event_key}/matches, parses with MatchSchema, returns JSON string.
    case 'get_team_event_matches': {
      const { team_key, event_key } = z
        .object({
          team_key: TeamKeySchema,
          event_key: EventKeySchema,
        })
        .parse(args);
      const data = await makeApiRequest(
        `/team/${team_key}/event/${event_key}/matches`,
      );
      const matches = z.array(MatchSchema).parse(data);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(matches, null, 2),
          },
        ],
      };
    }
  • src/tools.ts:262-280 (registration)
    Tool registration in the exported tools array: defines name, description, and inputSchema for MCP tool list.
    {
      name: 'get_team_event_matches',
      description: 'Get matches for a team at a specific event',
      inputSchema: {
        type: 'object',
        properties: {
          team_key: {
            type: 'string',
            description: 'Team key in format frcXXXX (e.g., frc86)',
            pattern: '^frc\\d+$',
          },
          event_key: {
            type: 'string',
            description: 'Event key (e.g., 2023casj)',
          },
        },
        required: ['team_key', 'event_key'],
      },
    },
  • Zod schemas for input validation: TeamKeySchema and EventKeySchema used in the handler.
    export const TeamKeySchema = z
      .string()
      .regex(/^frc\d+$/, 'Team key must be in format frcXXXX');
    
    export const EventKeySchema = z.string();
  • Zod schema for output parsing: MatchSchema used to validate the array of matches returned by the API.
    export const MatchSchema = z.object({
      key: z.string(),
      comp_level: z.string(),
      set_number: z.number(),
      match_number: z.number(),
      alliances: z.object({
        red: z.object({
          score: z.number(),
          team_keys: z.array(z.string()),
          surrogate_team_keys: z.array(z.string()).nullish(),
          dq_team_keys: z.array(z.string()).nullish(),
        }),
        blue: z.object({
          score: z.number(),
          team_keys: z.array(z.string()),
          surrogate_team_keys: z.array(z.string()).nullish(),
          dq_team_keys: z.array(z.string()).nullish(),
        }),
      }),
      winning_alliance: z.string().nullish(),
      event_key: z.string(),
      time: z.number().nullish(),
      actual_time: z.number().nullish(),
      predicted_time: z.number().nullish(),
      post_result_time: z.number().nullish(),
      score_breakdown: z.record(z.string(), z.any()).nullish(),
      videos: z
        .array(
          z.object({
            type: z.string(),
            key: z.string(),
          }),
        )
        .nullish(),
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/withinfocus/tba'

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