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, 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.
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. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly, openWorld, and idempotent, so safety is covered. The description adds value beyond them: the failure mode for an unknown id ('returns found: false'), a per-call credit cost, and caching behavior — all useful operational context an agent would otherwise not have.

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 tight sentences, front-loaded with what is returned and its ordering, then usage, then cost/error behavior. No filler or redundancy.

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?

An output schema exists, so return values need not be spelled out, yet the description still sketches the chain shape for orientation. With annotations covering safety and the description covering error semantics and cost, nothing needed to invoke the tool 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%, with rich per-parameter docs (id pattern, URL reduction, username/credits behavior), so the baseline is 3. The description adds no parameter-level syntax or constraints beyond what the schema already provides — its detail about geonameId, feature code, and coordinates describes output rather than inputs.

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') with the exact ordering semantics (Earth → continent → country → admin divisions → feature). It is clearly distinguishable from siblings like geonames_get_children and geonames_get_place.

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 ('find which country, state, and county contain a place', 'fill an admin path for a geonameId'), which is clear context for selection. It stops short of naming an alternative tool or an explicit when-not-to-use condition, so it falls just below the top band.

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.