Skip to main content
Glama

get_match

Retrieve detailed match information from The Blue Alliance API for FIRST Robotics Competition data. Use this tool to access comprehensive FRC match details by providing a specific match key.

Instructions

Get detailed information about a specific match

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
match_keyYesMatch key (e.g., 2023casj_qm1)

Implementation Reference

  • The handler logic for the 'get_match' tool. Parses input args, fetches match data from TBA API using makeApiRequest, validates with MatchSchema, and returns JSON stringified response.
    case 'get_match': {
      const { match_key } = z.object({ match_key: z.string() }).parse(args);
      const data = await makeApiRequest(`/match/${match_key}`);
      const match = MatchSchema.parse(data);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(match, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'get_match' tool, specifying the required 'match_key' parameter.
    {
      name: 'get_match',
      description: 'Get detailed information about a specific match',
      inputSchema: {
        type: 'object',
        properties: {
          match_key: {
            type: 'string',
            description: 'Match key (e.g., 2023casj_qm1)',
          },
        },
        required: ['match_key'],
      },
    },
  • Output validation schema (MatchSchema) used in the 'get_match' handler to parse the API response.
    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(),
    });
  • src/index.ts:45-68 (registration)
    MCP server request handlers registration. ListTools returns the tools array (including 'get_match' schema). CallTool dispatches to handleToolCall based on tool name.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
    
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      await log('debug', `Processing tool request: ${name}`, server);
    
      try {
        return await handleToolCall(name, args);
      } catch (error) {
        const errorMessage = `Tool execution error for '${name}': ${error instanceof Error ? error.message : String(error)}`;
        await log('error', errorMessage, server);
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    });

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