Skip to main content
Glama

Get a GeoNames hierarchy

geonames_get_hierarchy
Read-onlyIdempotent

Return the parent chain of a GeoNames feature, ordered from Earth and its continent through the country and admin divisions down to the feature itself, each with its geonameId, feature code, and coordinates. Use it to find which country, state, and county contain a place, or to fill an admin path for a geonameId. An unknown id returns found: false. Costs 1 GeoNames credit; cached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geonameIdYesGeoNames feature id as a digit string up to 2147483647, such as "5809844" (Seattle): the geonameId the other geonames tools return, sent as a string.
geonamesUsernameNoYour own GeoNames username, so the call spends that account's free credits instead of the server's. Omit it to use the server's account. The account needs free web services enabled on its geonames.org account page.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoAdministrative ancestors, Earth first and the requested feature last; empty when found is false. Levels a feature does not sit under are skipped.
errorNoPresent when the call failed. Absent on success.
foundNoFalse when GeoNames has no feature with this geonameId.
guidanceNoWhat to do next; present only when found is false.
geonameIdNoThe geonameId that was requested.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / geonameId / description
      Previous value: -"GeoNames feature id, a positive integer up to 2147483647 such as 5809844 (Seattle), as returned in geonameId by the other geonames tools. A geonames.org/<id> URL is reduced to its id."New value: +"GeoNames feature id as a digit string up to 2147483647, such as \"5809844\" (Seattle): the geonameId the other geonames tools return, sent as a string."
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes beyond the annotations (readOnly/idempotent/openWorld) by disclosing cost ('1 GeoNames credit'), caching, and the failure mode ('An unknown id returns found: false'). Those are exactly the behavioral traits annotations cannot express.

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?

Three tightly packed sentences: what is returned, when to use it, and the edge case plus cost. Front-loaded with the return shape and no filler.

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

Completeness5/5

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

For a read-only lookup with a full output schema, the description covers scope, ordering, intended uses, credit cost, caching, and the not-found behavior. Nothing an agent needs to invoke it correctly is missing.

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 both parameters (geonameId, geonamesUsername) are already fully documented in the schema. The description only references 'a geonameId' without adding format or sourcing context beyond what the schema provides, so baseline 3 applies.

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?

States a specific verb and resource ('Return the parent chain of a GeoNames feature') and defines the exact scope and ordering (Earth → continent → country → admin divisions → feature). This clearly separates it from siblings like geonames_get_children (descendants) and geonames_get_place (single-feature detail).

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

Usage Guidelines4/5

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

Gives concrete use cases: finding which country/state/county contain a place, or filling an admin path for a geonameId. It does not explicitly name an alternative or a when-not-to-use condition (e.g. use get_children for descendants), so it stops short of a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.