get_districts
Retrieve all FIRST Robotics Competition districts for a specific year to organize and access regional competition data.
Instructions
Get all districts for a specific year
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | Competition year |
Implementation Reference
- src/handlers.ts:423-435 (handler)The handler case in handleToolCall function that implements the logic for 'get_districts': parses input year, fetches data from TBA API endpoint `/districts/${year}`, validates response as array of DistrictSchema, and returns JSON stringified content.case 'get_districts': { const { year } = z.object({ year: YearSchema }).parse(args); const data = await makeApiRequest(`/districts/${year}`); const districts = z.array(DistrictSchema).parse(data); return { content: [ { type: 'text', text: JSON.stringify(districts, null, 2), }, ], }; }
- src/tools.ts:395-410 (registration)The tool registration object in the tools array export, defining the name 'get_districts', description, and input schema requiring a 'year' parameter.{ name: 'get_districts', description: 'Get all districts for a specific year', inputSchema: { type: 'object', properties: { year: { type: 'number', description: 'Competition year', minimum: 1992, maximum: new Date().getFullYear() + 1, }, }, required: ['year'], }, },
- src/schemas.ts:249-254 (schema)Zod schema for District objects, used to validate the API response array in the get_districts handler.export const DistrictSchema = z.object({ abbreviation: z.string(), display_name: z.string(), key: z.string(), year: z.number(), });
- src/schemas.ts:10-14 (schema)Zod schema for year input parameter, used in get_districts input validation in handler and inputSchema in tools.ts.export const YearSchema = z .number() .int() .min(1992) .max(new Date().getFullYear() + 1);