Skip to main content
Glama
mattjegan

eBird MCP Server

by mattjegan

get_nearby_observations

Find recent bird observations near any location using eBird data. Filter by date range, distance, species category, and hotspots to discover local bird sightings.

Instructions

Get recent observations near a geographic location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude
lngYesLongitude
backNoNumber of days back to fetch
catNoTaxonomic category filter
distNoSearch radius in kilometers
hotspotNoOnly fetch from hotspots
include_provisionalNoInclude unreviewed observations
max_resultsNoMaximum observations to return
sortNoSort by date or speciesdate
spp_localeNoLanguage for common namesen

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'get_nearby_observations' tool. It constructs query parameters from inputs and calls the eBird API's /data/obs/geo/recent endpoint via makeRequest.
    async (args) => {
      const params: Record<string, string | number | boolean> = {
        lat: args.lat,
        lng: args.lng,
        back: args.back,
        dist: args.dist,
        hotspot: args.hotspot,
        includeProvisional: args.include_provisional,
        sort: args.sort,
        sppLocale: args.spp_locale,
      };
      if (args.cat) params.cat = args.cat;
      if (args.max_results) params.maxResults = args.max_results;
    
      const result = await makeRequest("/data/obs/geo/recent", params);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod input schema defining parameters for latitude, longitude, search radius, time frame, filters, and sorting for the get_nearby_observations tool.
    {
      lat: z.number().min(-90).max(90).describe("Latitude"),
      lng: z.number().min(-180).max(180).describe("Longitude"),
      back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch"),
      cat: z.string().optional().describe("Taxonomic category filter"),
      dist: z.number().min(0).max(50).default(25).describe("Search radius in kilometers"),
      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(10000).optional().describe("Maximum observations to return"),
      sort: z.enum(["date", "species"]).default("date").describe("Sort by date or species"),
      spp_locale: z.string().default("en").describe("Language for common names"),
    },
  • src/index.ts:125-157 (registration)
    MCP server.tool registration for 'get_nearby_observations', including name, description, schema, and handler.
    server.tool(
      "get_nearby_observations",
      "Get recent observations near a geographic location.",
      {
        lat: z.number().min(-90).max(90).describe("Latitude"),
        lng: z.number().min(-180).max(180).describe("Longitude"),
        back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch"),
        cat: z.string().optional().describe("Taxonomic category filter"),
        dist: z.number().min(0).max(50).default(25).describe("Search radius in kilometers"),
        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(10000).optional().describe("Maximum observations to return"),
        sort: z.enum(["date", "species"]).default("date").describe("Sort by date or species"),
        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,
          dist: args.dist,
          hotspot: args.hotspot,
          includeProvisional: args.include_provisional,
          sort: args.sort,
          sppLocale: args.spp_locale,
        };
        if (args.cat) params.cat = args.cat;
        if (args.max_results) params.maxResults = args.max_results;
    
        const result = await makeRequest("/data/obs/geo/recent", params);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Utility function used by all tools, including get_nearby_observations, to perform 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();
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It mentions 'recent' observations but doesn't clarify what 'recent' means (the 'back' parameter handles this), nor does it describe return format, pagination, rate limits, authentication requirements, or error conditions. For a tool with 10 parameters and no output schema, 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 that communicates the core purpose without any wasted words. It's appropriately front-loaded with the essential information, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (10 parameters, no annotations, no output schema, and 24 sibling tools), the description is insufficiently complete. It doesn't explain the return format, differentiate from siblings, or provide behavioral context beyond the basic purpose. For a data retrieval tool with many parameters and alternatives, more guidance is needed to help the agent use it effectively.

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?

The description mentions 'recent' and 'near a geographic location,' which loosely maps to the 'back,' 'lat,' 'lng,' and 'dist' parameters. However, with 100% schema description coverage, all parameters are already documented in the schema, so the description adds minimal value beyond what's already structured. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 with a specific verb ('Get') and resource ('recent observations near a geographic location'), making it immediately understandable. However, it doesn't differentiate this tool from its many siblings (like 'get_nearby_notable_observations' or 'get_recent_observations'), which would require additional specificity about what makes 'nearby observations' distinct.

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 24 sibling tools available (including several with 'nearby' or 'observations' in their names), there's no indication of what distinguishes this tool from others like 'get_nearby_notable_observations' or 'get_recent_observations'—leaving the agent to guess based on tool names 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