Skip to main content
Glama
mattjegan

eBird MCP Server

by mattjegan

get_species_observations

Retrieve recent bird sightings for a specific species in any region using eBird data, with options to filter by date range, location type, and observation status.

Instructions

Get recent observations of a specific species in a region.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_codeYesCountry, subnational1, subnational2, or location code
species_codeYeseBird species code (e.g., 'cangoo' for Canada Goose, 'barswa' for Barn Swallow)
backNoNumber of days back to fetch
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 for the 'get_species_observations' tool. It prepares query parameters, makes an API request to the eBird endpoint for recent species observations in a region, and returns the result as formatted JSON text 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.max_results) params.maxResults = args.max_results;
    
      const result = await makeRequest(`/data/obs/${args.region_code}/recent/${args.species_code}`, params);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining the input parameters and their validation rules, descriptions, and defaults for the 'get_species_observations' tool.
    {
      region_code: z.string().describe("Country, subnational1, subnational2, or location code"),
      species_code: z.string().describe("eBird species code (e.g., 'cangoo' for Canada Goose, 'barswa' for Barn Swallow)"),
      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(10000).optional().describe("Maximum observations to return"),
      spp_locale: z.string().default("en").describe("Language for common names"),
    },
  • src/index.ts:99-123 (registration)
    The complete registration of the 'get_species_observations' tool with the McpServer instance using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "get_species_observations",
      "Get recent observations of a specific species in a region.",
      {
        region_code: z.string().describe("Country, subnational1, subnational2, or location code"),
        species_code: z.string().describe("eBird species code (e.g., 'cangoo' for Canada Goose, 'barswa' for Barn Swallow)"),
        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(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.max_results) params.maxResults = args.max_results;
    
        const result = await makeRequest(`/data/obs/${args.region_code}/recent/${args.species_code}`, params);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Shared helper utility function used by the 'get_species_observations' handler (and other tools) to construct and make authenticated HTTP requests to the eBird API, handling URL parameters, authentication, 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 of behavioral disclosure. It mentions 'recent observations' but doesn't clarify what 'recent' means (e.g., time frame defaults or limits), whether results are paginated, rate limits, authentication requirements, or error conditions. For a tool with 7 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 that front-loads the core purpose without unnecessary words. It directly states what the tool does ('Get recent observations') and key constraints ('specific species in a region'), making it easy to parse. Every word earns its place.

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 (7 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain return values (e.g., observation format, data fields), behavioral traits like rate limits or errors, or how it differs from similar sibling tools. For a data-fetching tool with many parameters, more context is needed to guide effective use.

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 minimal value beyond the schema—it implies filtering by species and region but doesn't provide additional context like parameter interactions or examples. With high schema coverage, the baseline score of 3 is appropriate.

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: 'Get recent observations of a specific species in a region.' It specifies the verb ('Get'), resource ('observations'), and key constraints ('specific species', 'region', 'recent'). However, it doesn't explicitly differentiate from sibling tools like 'get_nearby_species_observations' or 'get_nearest_species_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 for observations (e.g., 'get_nearby_species_observations', 'get_nearest_species_observations', 'get_recent_observations'), there's no indication of how this tool differs in scope or context. It lacks any 'when-to-use' or 'when-not-to-use' statements.

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