Skip to main content
Glama

get_sub_regions

Retrieve hierarchical geographic subdivisions from the eBird database to navigate bird observation regions. Specify region type and parent code to get countries, states, or counties.

Instructions

Get sub-regions within a parent region. Examples: get_sub_regions('country', 'world') for all countries, get_sub_regions('subnational1', 'US') for US states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_typeYesType of sub-regions
parent_region_codeYesParent region code, or 'world' for countries
fmtNoResponse formatjson

Implementation Reference

  • The handler function for the 'get_sub_regions' tool. It fetches sub-regions by making an API request to `/ref/region/list/${region_type}/${parent_region_code}` with optional fmt parameter and returns the result as JSON-formatted text content.
    async (args) => { const result = await makeRequest(`/ref/region/list/${args.region_type}/${args.parent_region_code}`, { fmt: args.fmt, }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
  • Input schema for the 'get_sub_regions' tool using Zod validation: region_type (enum), parent_region_code (string), fmt (enum with default 'json').
    { region_type: z.enum(["country", "subnational1", "subnational2"]).describe("Type of sub-regions"), parent_region_code: z.string().describe("Parent region code, or 'world' for countries"), fmt: z.enum(["json", "csv"]).default("json").describe("Response format"), },
  • src/index.ts:548-562 (registration)
    Registration of the 'get_sub_regions' tool using server.tool(), including name, description, input schema, and inline handler function.
    server.tool( "get_sub_regions", "Get sub-regions within a parent region. Examples: get_sub_regions('country', 'world') for all countries, get_sub_regions('subnational1', 'US') for US states.", { region_type: z.enum(["country", "subnational1", "subnational2"]).describe("Type of sub-regions"), parent_region_code: z.string().describe("Parent region code, or 'world' for countries"), fmt: z.enum(["json", "csv"]).default("json").describe("Response format"), }, async (args) => { const result = await makeRequest(`/ref/region/list/${args.region_type}/${args.parent_region_code}`, { fmt: args.fmt, }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } );

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