Skip to main content
Glama

get_event_predictions

Retrieve predictive data for FIRST Robotics Competition events to forecast outcomes and analyze team performance.

Instructions

Get TBA-generated predictions for an event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_keyYesEvent key (e.g., 2023casj)

Implementation Reference

  • The switch case handler that executes the get_event_predictions tool: validates event_key input, fetches predictions from TBA API endpoint `/event/{event_key}/predictions`, parses with PredictionSchema, and returns JSON-formatted response.
    case 'get_event_predictions': {
      const { event_key } = z.object({ event_key: EventKeySchema }).parse(args);
      const data = await makeApiRequest(`/event/${event_key}/predictions`);
      const predictions = PredictionSchema.parse(data);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(predictions, null, 2),
          },
        ],
      };
    }
  • Tool definition in the exported tools array, including name, description, and inputSchema for MCP tool registration and input validation (requires event_key string).
    {
      name: 'get_event_predictions',
      description: 'Get TBA-generated predictions for an event',
      inputSchema: {
        type: 'object',
        properties: {
          event_key: {
            type: 'string',
            description: 'Event key (e.g., 2023casj)',
          },
        },
        required: ['event_key'],
      },
    },
  • Zod schema used to parse and validate the TBA API predictions response data, including match_predictions, ranking_predictions, and stat_mean_vars.
    export const PredictionSchema = z.object({
      match_predictions: z
        .record(
          z.string(),
          z.object({
            red: z
              .object({
                score: z.number(),
              })
              .optional(),
            blue: z
              .object({
                score: z.number(),
              })
              .optional(),
          }),
        )
        .or(z.any())
        .nullish(),
      ranking_predictions: z
        .record(
          z.string(),
          z.object({
            rank: z.number(),
          }),
        )
        .or(z.array(z.any()))
        .nullish(),
      stat_mean_vars: z.record(z.string(), z.any()).nullish(),
    });
  • src/index.ts:45-47 (registration)
    MCP server registration of all tools via setRequestHandler for ListToolsRequestSchema, returning the tools array which includes get_event_predictions.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });

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