Skip to main content
Glama

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
NameRequiredDescriptionDefault
yearYesCompetition year

Implementation Reference

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

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