Skip to main content
Glama
mattjegan

eBird MCP Server

by mattjegan

get_recent_observations

Retrieve bird observation data from eBird for a specified region, including species, locations, dates, and counts from the past 30 days.

Instructions

Get recent bird observations in a region (up to 30 days ago). Returns species, location, date, and count info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_codeYesCountry, subnational1, subnational2, or location code (e.g., 'US', 'US-NY', 'US-NY-109', 'L99381')
backNoNumber of days back to fetch (1-30)
catNoTaxonomic category filter (e.g., 'species', 'hybrid')
hotspotNoOnly fetch from hotspots
include_provisionalNoInclude unreviewed observations
max_resultsNoMaximum observations to return
spp_localeNoLanguage for common namesen

Implementation Reference

  • The handler function that implements the core logic: maps input args to API params, calls the shared makeRequest helper to query the eBird /data/obs/{region}/recent endpoint, and formats the response as MCP content.
    async (args) => {
      const params: Record<string, string | number | boolean> = {
        back: args.back,
        hotspot: args.hotspot,
        includeProvisional: args.include_provisional,
        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/${args.region_code}/recent`, params);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining the input parameters for the tool, including region_code (required), back (days), optional filters like cat, hotspot, etc.
    {
      region_code: z.string().describe("Country, subnational1, subnational2, or location code (e.g., 'US', 'US-NY', 'US-NY-109', 'L99381')"),
      back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch (1-30)"),
      cat: z.string().optional().describe("Taxonomic category filter (e.g., 'species', 'hybrid')"),
      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"),
      spp_locale: z.string().default("en").describe("Language for common names"),
    },
  • src/index.ts:48-72 (registration)
    The server.tool() call that registers the 'get_recent_observations' tool with the MCP server, providing name, description, input schema, and handler function.
      "get_recent_observations",
      "Get recent bird observations in a region (up to 30 days ago). Returns species, location, date, and count info.",
      {
        region_code: z.string().describe("Country, subnational1, subnational2, or location code (e.g., 'US', 'US-NY', 'US-NY-109', 'L99381')"),
        back: z.number().min(1).max(30).default(14).describe("Number of days back to fetch (1-30)"),
        cat: z.string().optional().describe("Taxonomic category filter (e.g., 'species', 'hybrid')"),
        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"),
        spp_locale: z.string().default("en").describe("Language for common names"),
      },
      async (args) => {
        const params: Record<string, string | number | boolean> = {
          back: args.back,
          hotspot: args.hotspot,
          includeProvisional: args.include_provisional,
          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/${args.region_code}/recent`, params);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Shared helper function used by all tools to construct and make authenticated HTTP requests to the eBird API, handling URL params, auth header, error checking, and JSON parsing.
    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. It mentions the time constraint 'up to 30 days ago' and output fields, but does not disclose behavioral traits such as rate limits, authentication needs, pagination, error handling, or whether the operation is read-only (implied but not stated). This leaves significant gaps for an agent to understand operational constraints.

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, well-structured sentence that efficiently conveys purpose, scope, and output. It is front-loaded with key information and has no wasted words, making it easy for an agent to parse quickly.

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 complexity of 7 parameters, no annotations, and no output schema, the description is moderately complete. It covers the core functionality and output fields, but lacks details on behavioral aspects like rate limits or error handling, and does not explain the return format beyond listing fields. This is adequate for basic use but leaves gaps for robust agent operation.

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%, so the schema already documents all 7 parameters thoroughly. The description adds no additional parameter semantics beyond what the schema provides, such as examples or usage tips. The baseline score of 3 is appropriate since the schema does the heavy lifting, but the description does not compensate with extra insights.

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

Purpose5/5

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

The description clearly states the verb 'Get' and resource 'recent bird observations in a region', with specific scope 'up to 30 days ago' and output details 'species, location, date, and count info'. It distinguishes from siblings like 'get_historic_observations' by specifying recency, and from 'get_nearby_observations' by focusing on a region rather than proximity.

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

Usage Guidelines3/5

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

The description implies usage for recent observations within a region, but does not explicitly state when to use this tool versus alternatives like 'get_historic_observations' (for older data) or 'get_nearby_observations' (for location-based queries). It provides some context but lacks explicit guidance on exclusions or comparisons.

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