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
| Name | Required | Description | Default |
|---|---|---|---|
| event_key | Yes | Event key (e.g., 2023casj) |
Implementation Reference
- src/handlers.ts:1023-1035 (handler)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), }, ], }; }
- src/tools.ts:811-824 (schema)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'], }, },
- src/schemas.ts:435-464 (schema)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 }; });