get_teams_by_year
Retrieve FIRST Robotics Competition teams that participated in a specific year, using pagination to access comprehensive team lists from The Blue Alliance database.
Instructions
Get teams that competed in a specific year
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | Competition year | |
| page_num | Yes | Page number (0-indexed) |
Implementation Reference
- src/handlers.ts:485-502 (handler)Main handler logic for the 'get_teams_by_year' tool: validates input using Zod schemas, fetches team data from The Blue Alliance API, parses response, and returns formatted JSON output.case 'get_teams_by_year': { const { year, page_num } = z .object({ year: YearSchema, page_num: z.number().min(0), }) .parse(args); const data = await makeApiRequest(`/teams/${year}/${page_num}`); const teams = z.array(TeamSchema).parse(data); return { content: [ { type: 'text', text: JSON.stringify(teams, null, 2), }, ], }; }
- src/tools.ts:456-475 (schema)Tool definition including name, description, and JSON input schema for 'get_teams_by_year' used for MCP tool listing and validation.name: 'get_teams_by_year', description: 'Get teams that competed in a specific year', inputSchema: { type: 'object', properties: { year: { type: 'number', description: 'Competition year', minimum: 1992, maximum: new Date().getFullYear() + 1, }, page_num: { type: 'number', description: 'Page number (0-indexed)', minimum: 0, }, }, required: ['year', 'page_num'], }, },
- src/schemas.ts:17-36 (schema)Zod schema for parsing team data returned by the TBA API, used in the handler to validate output.export const TeamSchema = z.object({ key: z.string(), team_number: z.number(), nickname: z.string().nullish(), name: z.string(), city: z.string().nullish(), state_prov: z.string().nullish(), country: z.string().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(), website: z.string().nullish(), rookie_year: z.number().nullish(), motto: z.string().nullish(), home_championship: z.record(z.string(), z.any()).nullish(), });
- src/schemas.ts:10-14 (schema)Zod schema for year input validation, used in the handler.export const YearSchema = z .number() .int() .min(1992) .max(new Date().getFullYear() + 1);
- src/index.ts:46-48 (registration)MCP server registration of the tools list (including 'get_teams_by_year') for the list_tools capability.return { tools }; });