get_district_events
Retrieve FIRST Robotics Competition events for a specific district using The Blue Alliance API. Input a district key to access event data.
Instructions
Get events in a specific district
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| district_key | Yes | District key (e.g., 2023fim) |
Implementation Reference
- src/handlers.ts:907-921 (handler)Handler implementation for the get_district_events tool. Validates input, fetches district events from TBA API, parses with EventSchema array, and returns JSON stringified response.case 'get_district_events': { const { district_key } = z .object({ district_key: z.string() }) .parse(args); const data = await makeApiRequest(`/district/${district_key}/events`); const events = z.array(EventSchema).parse(data); return { content: [ { type: 'text', text: JSON.stringify(events, null, 2), }, ], }; }
- src/tools.ts:913-926 (registration)Tool registration in the tools array exported for MCP server, including name, description, and input schema definition.{ name: 'get_district_events', description: 'Get events in a specific district', inputSchema: { type: 'object', properties: { district_key: { type: 'string', description: 'District key (e.g., 2023fim)', }, }, required: ['district_key'], }, },
- src/schemas.ts:38-85 (schema)Zod schema for Event objects used to parse the API response in the handler.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(), });