Skip to main content
Glama
mattjegan

eBird MCP Server

by mattjegan

get_nearest_species_observations

Find recent bird sightings near a location using eBird data to locate species observations within a specified distance and timeframe.

Instructions

Find the nearest locations where a species has been seen recently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude
lngYesLongitude
species_codeYeseBird species code
backNoNumber of days back to fetch
hotspotNoOnly fetch from hotspots
include_provisionalNoInclude unreviewed observations
max_resultsNoMaximum observations to return
distNoMaximum distance in km
spp_localeNoLanguage for common namesen

Implementation Reference

  • Handler function constructs parameters and calls makeRequest to the eBird /data/nearest/geo/recent/{species_code} endpoint, returning JSON response.
    async (args) => {
      const params: Record<string, string | number | boolean> = {
        lat: args.lat,
        lng: args.lng,
        back: args.back,
        hotspot: args.hotspot,
        includeProvisional: args.include_provisional,
        maxResults: args.max_results,
        sppLocale: args.spp_locale,
      };
      if (args.dist) params.dist = args.dist;
    
      const result = await makeRequest(`/data/nearest/geo/recent/${args.species_code}`, params);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining input parameters for the tool with descriptions, defaults, and constraints.
    {
      lat: z.number().min(-90).max(90).describe("Latitude"),
      lng: z.number().min(-180).max(180).describe("Longitude"),
      species_code: z.string().describe("eBird species code"),
      back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch"),
      hotspot: z.boolean().default(false).describe("Only fetch from hotspots"),
      include_provisional: z.boolean().default(false).describe("Include unreviewed observations"),
      max_results: z.number().min(1).max(3000).default(3000).describe("Maximum observations to return"),
      dist: z.number().min(0).max(50).optional().describe("Maximum distance in km"),
      spp_locale: z.string().default("en").describe("Language for common names"),
  • src/index.ts:190-219 (registration)
    MCP server.tool registration defining the tool name, description, input schema, and handler function.
    server.tool(
      "get_nearest_species_observations",
      "Find the nearest locations where a species has been seen recently.",
      {
        lat: z.number().min(-90).max(90).describe("Latitude"),
        lng: z.number().min(-180).max(180).describe("Longitude"),
        species_code: z.string().describe("eBird species code"),
        back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch"),
        hotspot: z.boolean().default(false).describe("Only fetch from hotspots"),
        include_provisional: z.boolean().default(false).describe("Include unreviewed observations"),
        max_results: z.number().min(1).max(3000).default(3000).describe("Maximum observations to return"),
        dist: z.number().min(0).max(50).optional().describe("Maximum distance in km"),
        spp_locale: z.string().default("en").describe("Language for common names"),
      },
      async (args) => {
        const params: Record<string, string | number | boolean> = {
          lat: args.lat,
          lng: args.lng,
          back: args.back,
          hotspot: args.hotspot,
          includeProvisional: args.include_provisional,
          maxResults: args.max_results,
          sppLocale: args.spp_locale,
        };
        if (args.dist) params.dist = args.dist;
    
        const result = await makeRequest(`/data/nearest/geo/recent/${args.species_code}`, params);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Shared helper function to make authenticated requests to eBird API v2 endpoints.
    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();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions 'nearest locations' and 'seen recently,' it doesn't specify what 'recently' means (e.g., default time frame), how results are ordered, whether data is real-time or cached, or any rate limits or authentication requirements. For a tool with 9 parameters and no annotations, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Find the nearest locations where a species has been seen recently.' It's front-loaded with the core purpose, uses clear language, and avoids unnecessary words. Every part of the sentence contributes directly to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (9 parameters, no output schema, no annotations), the description is adequate but incomplete. It clearly states the purpose but lacks behavioral details (e.g., result format, error handling) and usage guidelines relative to siblings. Without an output schema, the description doesn't explain return values, which is a gap, but the concise purpose statement provides a minimal viable foundation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning all parameters are documented in the input schema with clear descriptions (e.g., 'Latitude', 'eBird species code', 'Number of days back to fetch'). The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline score of 3 without compensating or detracting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Find the nearest locations where a species has been seen recently.' It specifies the verb ('find'), resource ('nearest locations'), and scope ('species has been seen recently'), making the intent unambiguous. However, it doesn't explicitly differentiate from similar sibling tools like 'get_nearby_species_observations' or 'get_nearby_observations', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools available (e.g., 'get_nearby_species_observations', 'get_nearby_observations', 'get_historic_observations'), there's no indication of specific use cases, prerequisites, or exclusions. This lack of comparative context leaves the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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