get_events
Retrieve FIRST Robotics Competition events for a specified year using The Blue Alliance API to access comprehensive FRC data.
Instructions
Get all FRC events for a specific year
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | Competition year |
Implementation Reference
- src/handlers.ts:109-121 (handler)Handler implementation for the 'get_events' tool. Validates input with YearSchema, calls TBA API /events/${year}, validates output with EventSchema array, returns JSON string.case 'get_events': { const { year } = z.object({ year: YearSchema }).parse(args); const data = await makeApiRequest(`/events/${year}`); const events = z.array(EventSchema).parse(data); return { content: [ { type: 'text', text: JSON.stringify(events, null, 2), }, ], }; }
- src/tools.ts:82-97 (schema)MCP tool schema definition for 'get_events', specifying input schema with required 'year' number parameter.{ name: 'get_events', description: 'Get all FRC events for a specific year', inputSchema: { type: 'object', properties: { year: { type: 'number', description: 'Competition year', minimum: 1992, maximum: new Date().getFullYear() + 1, }, }, required: ['year'], }, },
- src/index.ts:45-47 (registration)Server registration for listTools request, returning the tools array that includes 'get_events'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/schemas.ts:10-14 (schema)Zod schema for input validation of the 'year' parameter used in handler.export const YearSchema = z .number() .int() .min(1992) .max(new Date().getFullYear() + 1);
- src/schemas.ts:38-85 (schema)Zod schema for output validation of individual event objects returned by the tool.export const EventSchema = z.object({ key: z.string(), name: z.string(), event_code: z.string(), event_type: z.number(), district: z .object({ abbreviation: z.string(), display_name: z.string(), key: z.string(), year: z.number(), }) .nullish(), city: z.string().nullish(), state_prov: z.string().nullish(), country: z.string().nullish(), start_date: z.string(), end_date: z.string(), year: z.number(), short_name: z.string().nullish(), event_type_string: z.string(), week: z.number().nullish(), address: z.string().nullish(), postal_code: z.string().nullish(), gmaps_place_id: z.string().nullish(), gmaps_url: z.string().nullish(), lat: z.number().nullish(), lng: z.number().nullish(), location_name: z.string().nullish(), timezone: z.string().nullish(), website: z.string().nullish(), first_event_id: z.string().nullish(), first_event_code: z.string().nullish(), webcasts: z .array( z.object({ type: z.string(), channel: z.string(), date: z.string().nullish(), file: z.string().nullish(), }), ) .nullish(), division_keys: z.array(z.string()).nullish(), parent_event_key: z.string().nullish(), playoff_type: z.number().nullish(), playoff_type_string: z.string().nullish(), });