Skip to main content
Glama

get_regional_statistics

Retrieve bird observation statistics for a specific region and date, including checklist counts, species counts, and contributor numbers from eBird data.

Instructions

Get statistics for a region on a specific date (checklist count, species count, contributor count).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_codeYesCountry, subnational1, subnational2, or location code
yearYesYear
monthYesMonth
dayYesDay of month

Implementation Reference

  • Handler function that makes an API request to eBird's /product/stats endpoint with region and date parameters, then returns the JSON response as text content.
    async (args) => { const result = await makeRequest(`/product/stats/${args.region_code}/${args.year}/${args.month}/${args.day}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }
  • Zod schema defining input parameters: region_code (string), year (number), month (number 1-12), day (number 1-31).
    { region_code: z.string().describe("Country, subnational1, subnational2, or location code"), year: z.number().describe("Year"), month: z.number().min(1).max(12).describe("Month"), day: z.number().min(1).max(31).describe("Day of month"), },
  • src/index.ts:340-353 (registration)
    MCP server tool registration for 'get_regional_statistics', including name, description, input schema, and inline handler function.
    server.tool( "get_regional_statistics", "Get statistics for a region on a specific date (checklist count, species count, contributor count).", { region_code: z.string().describe("Country, subnational1, subnational2, or location code"), year: z.number().describe("Year"), month: z.number().min(1).max(12).describe("Month"), day: z.number().min(1).max(31).describe("Day of month"), }, async (args) => { const result = await makeRequest(`/product/stats/${args.region_code}/${args.year}/${args.month}/${args.day}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } );
  • Shared helper function used by the tool (and others) to make authenticated requests to the eBird API, handling URL params and error checking.
    async function makeRequest(endpoint: string, params: Record<string, string | number | boolean> = {}): Promise<unknown> { const url = new URL(`${BASE_URL}${endpoint}`); Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { url.searchParams.append(key, String(value)); } }); const response = await fetch(url.toString(), { headers: { "X-eBirdApiToken": API_KEY! }, }); if (!response.ok) { throw new Error(`eBird API error: ${response.status} ${response.statusText}`); } return response.json(); }

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/mattjegan/ebird-mcp'

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