Skip to main content
Glama

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
NameRequiredDescriptionDefault
yearYesCompetition year
page_numYesPage number (0-indexed)

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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'],
      },
    },
  • 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(),
    });
  • 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 };
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/withinfocus/tba'

If you have feedback or need assistance with the MCP directory API, please join our Discord server