Skip to main content
Glama

Find GeoNames postal codes

geonames_find_postal_codes
Read-onlyIdempotent

Look up postal codes in the GeoNames postal database (122 countries): mode code resolves a postal code to its place, admin names, and centroid; mode place_name finds postal codes for a place name; mode nearby lists postal codes within radiusKm (up to 30 km) of a coordinate, nearest first. Ireland returns only Eircode routing keys and Malta only the letter prefix; the United Kingdom (GB), Canada, and the Netherlands hold both full codes and their outward or district prefixes. Check coverage with geonames_list_reference topic postal_countries. Costs 1 GeoNames credit (2 for nearby); cached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latNoLatitude in decimal degrees, -90 to 90. Required in mode nearby.
lngNoLongitude in decimal degrees, -180 to 180. Required in mode nearby.
modeYesWhat to look up. code: the place for postalCode (required). place_name: the postal codes of placeName (required). nearby: postal codes around lat and lng (both required; countries not accepted). Case-insensitive.
limitNoMaximum entries to return, 1 to 100. Default 10.
radiusKmNoSearch radius in kilometres for mode nearby, above 0 and at most 30 (GeoNames' free-tier limit). Default 10.
countriesNoKeep only postal codes in these countries: ISO 3166-1 codes, up to 10, as a list or a comma-separated string: alpha-2 (US, GB, DE), alpha-3 (USA, GBR, DEU), or three-digit numeric (840, 826, 276), each sent to GeoNames as alpha-2. Case-insensitive; UK is accepted for GB. Modes code and place_name only.
placeNameNoPlace name to find postal codes for, up to 100 characters. GeoNames matches it against place, admin, and country names. Required in mode place_name; in mode code it narrows the match; not used in mode nearby.
postalCodeNoPostal code to resolve, such as 98101, SW1A 1AA, or K1A 0A1: letters, digits, spaces, and hyphens, up to 12 characters. Case and extra spaces are normalized. Required in mode code; in mode place_name it narrows the match; not used in mode nearby.
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
capNoThe limit that was applied.
modeNoThe lookup mode that ran.
errorNoPresent when the call failed. Absent on success.
shownNoPostal codes returned.
noticeNoGuidance when nothing matched, or when a full page suggests more matches.
truncatedNoTrue when a full page came back: GeoNames reports no total, so more may match.
postalCodesNoMatching postal codes; nearest first in mode nearby.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: it discloses credit cost (1, 2 for nearby), caching, the 30 km free-tier radius ceiling, and per-country data truncation quirks (Ireland returns only Eircode routing keys, Malta only the letter prefix). These are exactly the operational facts an agent cannot infer from structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then modes, then caveats, then cost — a sensible order. It is a dense paragraph with semicolon-chained clauses, but each clause carries real information and little is redundant.

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 9-parameter tool with an output schema, the description covers what the schema cannot: cost model, caching, geographic coverage limits, and per-country data caveats. Nothing an agent needs to call this correctly appears to be 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 the schema already documents every parameter including the mode enum, radius bounds, and country code formats. The description largely restates the mode semantics rather than adding syntax or edge-case meaning beyond the schema, 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 (look up postal codes in the GeoNames postal database) and enumerates the three operating modes with their exact semantics. It also scopes coverage (122 countries) so the agent can distinguish it from sibling geocoders like geonames_reverse_geocode.

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?

Modes map cleanly to intents, and it routes the agent to geonames_list_reference (topic postal_countries) to verify coverage before calling. It does not address the overlap with geonames_reverse_geocode for coordinate-based lookups, which is the closest sibling to mode nearby.

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.