get_taxonomy_versions
Retrieve available taxonomy versions from the eBird API to ensure accurate bird species identification and data consistency.
Instructions
Get all available taxonomy versions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:506-509 (handler)The handler function for the get_taxonomy_versions tool. It makes an API request to fetch taxonomy versions and returns the result as JSON-formatted text content.async () => { const result = await makeRequest("/ref/taxonomy/versions"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }
- src/index.ts:505-505 (schema)Empty Zod schema indicating the tool takes no input parameters.{},
- src/index.ts:502-510 (registration)Registration of the get_taxonomy_versions tool using McpServer.tool() with description, schema, and inline handler.server.tool( "get_taxonomy_versions", "Get all available taxonomy versions.", {}, async () => { const result = await makeRequest("/ref/taxonomy/versions"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } );
- src/index.ts:19-36 (helper)Shared helper function used by the handler to make authenticated HTTP requests to the eBird API.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(); }