@cyanheads/geonames-mcp-server 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/AGENTS.md +13 -12
  2. package/CLAUDE.md +13 -12
  3. package/Dockerfile +16 -7
  4. package/README.md +75 -43
  5. package/changelog/0.1.x/0.1.2.md +26 -0
  6. package/changelog/0.1.x/0.1.3.md +45 -0
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +13 -4
  10. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -1
  11. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +87 -38
  12. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -1
  13. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +6 -4
  14. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -1
  15. package/dist/mcp-server/tools/definitions/get-children.tool.js +65 -20
  16. package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -1
  17. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -1
  18. package/dist/mcp-server/tools/definitions/get-countries.tool.js +21 -13
  19. package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -1
  20. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +3 -3
  21. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -1
  23. package/dist/mcp-server/tools/definitions/get-place.tool.js +18 -9
  24. package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -1
  25. package/dist/mcp-server/tools/definitions/index.d.ts +41 -4
  26. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/list-reference.tool.js +22 -12
  29. package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -1
  30. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +8 -0
  31. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +93 -39
  33. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +23 -1
  35. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/search-places.tool.js +143 -25
  37. package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/shared-inputs.d.ts +93 -12
  39. package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/shared-inputs.js +164 -21
  41. package/dist/mcp-server/tools/shared-inputs.js.map +1 -1
  42. package/dist/services/geonames/country-codes.d.ts +32 -0
  43. package/dist/services/geonames/country-codes.d.ts.map +1 -0
  44. package/dist/services/geonames/country-codes.js +298 -0
  45. package/dist/services/geonames/country-codes.js.map +1 -0
  46. package/dist/services/geonames/geonames-service.d.ts +14 -5
  47. package/dist/services/geonames/geonames-service.d.ts.map +1 -1
  48. package/dist/services/geonames/geonames-service.js +98 -42
  49. package/dist/services/geonames/geonames-service.js.map +1 -1
  50. package/dist/services/geonames/response-parsers.d.ts +12 -4
  51. package/dist/services/geonames/response-parsers.d.ts.map +1 -1
  52. package/dist/services/geonames/response-parsers.js +122 -23
  53. package/dist/services/geonames/response-parsers.js.map +1 -1
  54. package/dist/services/geonames/types.d.ts +37 -12
  55. package/dist/services/geonames/types.d.ts.map +1 -1
  56. package/dist/services/geonames/types.js +4 -3
  57. package/dist/services/geonames/types.js.map +1 -1
  58. package/dist/utils/inline-text.d.ts +52 -12
  59. package/dist/utils/inline-text.d.ts.map +1 -1
  60. package/dist/utils/inline-text.js +129 -14
  61. package/dist/utils/inline-text.js.map +1 -1
  62. package/package.json +12 -12
  63. package/server.json +16 -24
@@ -31,6 +31,7 @@ export declare const reverseGeocodeTool: import("@cyanheads/mcp-ts-core").ToolDe
31
31
  }>>>, unknown>;
32
32
  featureCodes: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
33
33
  includeTimezone: z.ZodPreprocess<z.ZodDefault<z.ZodBoolean>, unknown>;
34
+ coastalBufferKm: z.ZodPreprocess<z.ZodDefault<z.ZodNumber>, unknown>;
34
35
  geonamesUsername: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
35
36
  }, z.core.$strip>, z.ZodObject<{
36
37
  lat: z.ZodNumber;
@@ -38,6 +39,7 @@ export declare const reverseGeocodeTool: import("@cyanheads/mcp-ts-core").ToolDe
38
39
  country: z.ZodOptional<z.ZodObject<{
39
40
  countryCode: z.ZodString;
40
41
  countryName: z.ZodOptional<z.ZodString>;
42
+ distanceInKm: z.ZodOptional<z.ZodNumber>;
41
43
  }, z.core.$strip>>;
42
44
  adminLevels: z.ZodArray<z.ZodObject<{
43
45
  level: z.ZodNumber;
@@ -91,6 +93,12 @@ export declare const reverseGeocodeTool: import("@cyanheads/mcp-ts-core").ToolDe
91
93
  readonly when: "cities was combined with featureClasses or featureCodes.";
92
94
  readonly recovery: "Call geonames_reverse_geocode again with cities for the nearest populated places, or featureClasses/featureCodes for the nearest features of a type, not both.";
93
95
  readonly severity: "notice";
96
+ }, {
97
+ readonly reason: "feature_filter_mismatch";
98
+ readonly code: JsonRpcErrorCode.ValidationError;
99
+ readonly when: "featureClasses and featureCodes are both set and a code's class is not listed or a listed class has no listed code. GeoNames intersects the two lists, so those entries match nothing.";
100
+ readonly recovery: "Call geonames_reverse_geocode again with featureCodes alone (each code implies its class) or featureClasses alone; for a whole class plus codes of another class, make one call per class.";
101
+ readonly severity: "notice";
94
102
  }, {
95
103
  readonly reason: "username_required";
96
104
  readonly code: JsonRpcErrorCode.Unauthorized;
@@ -1 +1 @@
1
- {"version":3,"file":"reverse-geocode.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/reverse-geocode.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAsDjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqb7B,CAAC"}
1
+ {"version":3,"file":"reverse-geocode.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/reverse-geocode.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiEjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8f7B,CAAC"}
@@ -8,18 +8,25 @@
8
8
  */
9
9
  import { tool, z } from '@cyanheads/mcp-ts-core';
10
10
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
11
- import { blankAsUnset, citiesInput, featureClassesInput, featureCodesInput, geonamesUsernameInput, latInput, lngInput, USERNAME_ALIASES, } from '../shared-inputs.js';
11
+ import { blankAsUnset, citiesInput, clampLimit, featureClassesInput, featureCodesInput, featureFilterMismatch, geonamesUsernameInput, latInput, lngInput, USERNAME_ALIASES, } from '../shared-inputs.js';
12
12
  import { getFeatureCode } from '../../../services/geonames/feature-codes.js';
13
13
  import { getGeoNamesService } from '../../../services/geonames/geonames-service.js';
14
- import { inlineText, tableCell } from '../../../utils/inline-text.js';
14
+ import { inlineText, renderNotice, tableCell } from '../../../utils/inline-text.js';
15
15
  /** Wall-clock budget for the whole call, inside a 60 s client timeout. */
16
16
  const TOOL_BUDGET_MS = 30_000;
17
17
  /** Ceiling on the ocean follow-up's ladder; it also gets no more than what the budget has left. */
18
18
  const OCEAN_BUDGET_MS = 10_000;
19
- /** The most nearby rows one call returns. */
19
+ /** The most nearby rows one call returns; a larger nearbyLimit is held to it. */
20
20
  const MAX_NEARBY = 50;
21
+ /** The largest nearbyLimit accepted; anything above it fails validation as absurd. */
22
+ const NEARBY_LIMIT_CEILING = 1000;
21
23
  /** GeoNames' free-tier ceiling on the nearby radius (status 24 beyond). */
22
24
  const MAX_RADIUS_KM = 300;
25
+ /**
26
+ * Ceiling on the containment buffer: room for harbors, estuaries, and the 12-nautical-mile
27
+ * territorial sea, and well below the 300 km GeoNames rejects with status 24.
28
+ */
29
+ const MAX_COASTAL_BUFFER_KM = 50;
23
30
  const NEARBY_KINDS = ['populated_places', 'features', 'none'];
24
31
  const NEARBY_TITLES = {
25
32
  populated_places: 'Nearest populated places',
@@ -33,17 +40,18 @@ const toTimezone = ({ countryName: _countryName, ...timezone }) => timezone;
33
40
  const orNotAvailable = (value) => value === undefined ? 'Not available' : tableCell(String(value));
34
41
  export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
35
42
  title: 'Reverse geocode with GeoNames',
36
- description: "Resolve a latitude/longitude to the country and admin subdivisions that contain it (down to ADM5, each with its geonameId and ISO 3166-2 code where one exists), or the ocean or sea when the point is offshore, plus the nearest populated places with distances; these include neighborhood sections (PPLX) and historical places (PPLH), marked by featureCode. Set featureClasses or featureCodes to list the nearest features of that type instead (peaks, lakes, airports), cities to keep only places above a population tier, and includeTimezone for the IANA timezone with local time, sunrise, and sunset (offshore points get only GeoNames' UTC-offset estimate). Costs 1 GeoNames credit for containment, plus 3 for nearest populated places or 4 for nearest features (nearbyLimit 0 skips them), 1 for the ocean when no country contains the point, and 1 for the timezone.",
43
+ description: "Resolve a latitude/longitude to the country and admin subdivisions that contain it (down to ADM5, each with its geonameId and ISO 3166-2 code where one exists), or the ocean or sea when the point is offshore, plus the nearest populated places with distances; these include neighborhood sections (PPLX) and historical places (PPLH), marked by featureCode. Set featureClasses or featureCodes to list the nearest features of that type instead (peaks, lakes, airports), cities to keep only places above a population tier, and includeTimezone for the IANA timezone with local time, sunrise, and sunset (offshore points get only GeoNames' UTC-offset estimate). A harbor, pier, or shoreline point can fall just outside every country outline and resolve to the sea; coastalBufferKm (up to 50) matches the nearest country within that distance instead. Costs 1 GeoNames credit for containment, with or without the buffer, plus 3 for nearest populated places or 4 for nearest features (nearbyLimit 0 skips them), 1 for the ocean when no country contains the point or lies within the buffer, and 1 for the timezone.",
37
44
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
38
45
  input: z.object({
39
46
  lat: latInput,
40
47
  lng: lngInput,
41
- nearbyLimit: blankAsUnset(z.number().int().min(0).max(MAX_NEARBY).default(5)).describe('How many nearest places or features to list, 0 to 50. Default 5. 0 skips the nearby lookup and its 3 or 4 credits.'),
48
+ nearbyLimit: blankAsUnset(z.number().int().min(0).max(NEARBY_LIMIT_CEILING).default(5)).describe('How many nearest places or features to list, 0 to 1,000. This tool returns at most 50 per call: a larger nearbyLimit is held to 50, and the notice says so when more lie within the radius. Default 5. 0 skips the nearby lookup and its 3 or 4 credits.'),
42
49
  radiusKm: blankAsUnset(z.number().positive().max(MAX_RADIUS_KM).default(20)).describe("Radius in kilometres for the nearby lookup, above 0 and at most 300 (GeoNames' free-tier limit). Default 20."),
43
50
  cities: citiesInput.describe("Keep only nearby populated places with a population of at least 1,000 (cities1000), 5,000 (cities5000), or 15,000 (cities15000), plus seats of admin divisions: GeoNames' cities tiers. Not combinable with featureClasses or featureCodes."),
44
- featureClasses: featureClassesInput.describe('List the nearest features of these GeoNames classes instead of populated places: A admin divisions, H water, L areas, P populated places, R roads, S spots and buildings, T terrain, U undersea, V vegetation. A list or a comma-separated string; case-insensitive. Not combinable with cities.'),
45
- featureCodes: featureCodesInput.describe('List the nearest features with these GeoNames codes instead of populated places (MT mountain, PK peak, LK lake, AIRP airport), up to 20, as a list or a comma-separated string. Case-insensitive; a class prefix (T.MT) is dropped. geonames_list_reference topic feature_codes lists every code. Not combinable with cities.'),
51
+ featureClasses: featureClassesInput.describe('List the nearest features of these GeoNames classes instead of populated places: A admin divisions, H water, L areas, P populated places, R roads, S spots and buildings, T terrain, U undersea, V vegetation. With featureCodes too, the two lists intersect: list exactly the classes of those codes, or pass featureCodes alone. Not combinable with cities.'),
52
+ featureCodes: featureCodesInput.describe("List the nearest features with these GeoNames codes instead of populated places (MT mountain, PK peak, LK lake, AIRP airport), up to 20, as a list. Each code implies its class; with featureClasses too, the two lists intersect, so featureClasses must list exactly these codes' classes. geonames_list_reference topic feature_codes lists every code. Not combinable with cities."),
46
53
  includeTimezone: blankAsUnset(z.boolean().default(false)).describe('Also return the timezone: IANA id, UTC offsets, local time, sunrise, and sunset (1 more credit). Default false.'),
54
+ coastalBufferKm: blankAsUnset(z.number().min(0).max(MAX_COASTAL_BUFFER_KM).default(0)).describe("When no country contains the point, match the nearest country within this many kilometres, 0 to 50. Default 0: exact containment only. Set it for a harbor, pier, or shoreline point, which can fall just outside a country's outline as GeoNames maps it and otherwise resolves to the sea; a match carries country.distanceInKm. The nearby and timezone lookups keep the exact point. No extra credit."),
47
55
  geonamesUsername: geonamesUsernameInput,
48
56
  }),
49
57
  inputAliases: USERNAME_ALIASES,
@@ -57,14 +65,21 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
57
65
  .string()
58
66
  .optional()
59
67
  .describe('Country name. Absent when GeoNames sent none.'),
68
+ distanceInKm: z
69
+ .number()
70
+ .optional()
71
+ .describe('Kilometres from the point to this country as GeoNames maps it, to the metre. Present only when no country contains the point and this one was matched within coastalBufferKm.'),
60
72
  })
61
73
  .optional()
62
- .describe('The country containing the point; absent offshore and in unmapped areas.'),
74
+ .describe('The country containing the point, or with coastalBufferKm the nearest country within that distance (then distanceInKm is set); absent offshore and in unmapped areas.'),
63
75
  adminLevels: z
64
76
  .array(z
65
77
  .object({
66
78
  level: z.number().describe('Admin level: 1 for the first-order division, up to 5.'),
67
- code: z.string().optional().describe('Admin code at this level.'),
79
+ code: z
80
+ .string()
81
+ .optional()
82
+ .describe("GeoNames admin code at this level. At levels 1 to 4, pass it as written to geonames_search_places as that level's adminCode (adminCode1 to adminCode4), with the level 1 code as adminCode1 and country.countryCode in countries, to search inside the division; level 5 has no search filter."),
68
83
  name: z.string().optional().describe('Name of the division.'),
69
84
  geonameId: z
70
85
  .number()
@@ -75,8 +90,8 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
75
90
  .optional()
76
91
  .describe('ISO 3166-2 code of the division, subdivision part only (IDF, not FR-IDF), where one exists.'),
77
92
  })
78
- .describe('One admin division containing the point.'))
79
- .describe('Admin divisions containing the point, first level first; empty offshore, and where GeoNames records no subdivision of the country.'),
93
+ .describe('One admin division containing the point, or for a country matched within coastalBufferKm, the one nearest it.'))
94
+ .describe('Admin divisions containing the point, first level first; for a country matched within coastalBufferKm, the divisions of its part nearest the point. Empty offshore, and where GeoNames records no subdivision of the country.'),
80
95
  ocean: z
81
96
  .object({
82
97
  name: z.string().describe('Name of the ocean or sea.'),
@@ -86,7 +101,7 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
86
101
  .describe('GeoNames feature id of the water body. Absent when GeoNames has none.'),
87
102
  })
88
103
  .optional()
89
- .describe('The ocean or sea at the point; present only when no country contains it.'),
104
+ .describe('The ocean or sea at the point; present only when no country contains it or lies within coastalBufferKm.'),
90
105
  nearbyKind: z
91
106
  .enum(NEARBY_KINDS)
92
107
  .describe('What nearby lists: populated_places, features (featureClasses or featureCodes was set), or none (nearbyLimit 0).'),
@@ -147,8 +162,12 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
147
162
  .optional()
148
163
  .describe('ISO 3166-1 alpha-2 code of the timezone country. Absent offshore.'),
149
164
  rawOffsetInHours: z.number().describe('Standard UTC offset in hours, without DST.'),
150
- gmtOffsetInHours: z.number().describe('UTC offset in hours on 1 January.'),
151
- dstOffsetInHours: z.number().describe('UTC offset in hours on 1 July.'),
165
+ gmtOffsetInHours: z
166
+ .number()
167
+ .describe('UTC offset in hours on 1 January of the current local year.'),
168
+ dstOffsetInHours: z
169
+ .number()
170
+ .describe("UTC offset in hours on 1 July of the current local year. Without a timezoneId the offsets are GeoNames' open-water estimate, which has no DST, so both equal rawOffsetInHours."),
152
171
  localTime: z
153
172
  .string()
154
173
  .optional()
@@ -156,11 +175,11 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
156
175
  sunrise: z
157
176
  .string()
158
177
  .optional()
159
- .describe("Today's local sunrise, YYYY-MM-DD HH:mm. Absent offshore."),
178
+ .describe("Local sunrise on localTime's date, YYYY-MM-DD HH:mm. Absent offshore, in polar day or night, and when GeoNames has none for that date."),
160
179
  sunset: z
161
180
  .string()
162
181
  .optional()
163
- .describe("Today's local sunset, YYYY-MM-DD HH:mm. Absent offshore."),
182
+ .describe('Local sunset of the same day as sunrise, YYYY-MM-DD HH:mm; it can fall after midnight. Absent offshore, in polar day or night, and when GeoNames has none for that date.'),
164
183
  })
165
184
  .optional()
166
185
  .describe('The timezone at the point; present only with includeTimezone.'),
@@ -168,14 +187,17 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
168
187
  enrichment: {
169
188
  truncated: z
170
189
  .boolean()
171
- .describe('True when nearby is full at nearbyLimit, so more may lie within the radius.'),
190
+ .describe('True when more places or features lie within the radius than nearby holds.'),
172
191
  shown: z.number().describe('Nearby places or features returned.'),
173
- cap: z.number().describe('The nearbyLimit that was applied.'),
192
+ cap: z
193
+ .number()
194
+ .describe('The nearbyLimit applied: nearbyLimit as given, or 50 when it asked for more.'),
174
195
  notice: z
175
196
  .string()
176
197
  .optional()
177
- .describe('Guidance when the point is offshore or unmapped, nothing is nearby, nearby is full, or no IANA timezone covers it.'),
198
+ .describe('Guidance when the point is offshore or unmapped, its country was matched within coastalBufferKm, nothing is nearby, more lie within the radius than nearby holds (naming a nearbyLimit held to 50), or no IANA timezone covers it.'),
178
199
  },
200
+ enrichmentTrailer: { notice: { render: renderNotice } },
179
201
  errors: [
180
202
  {
181
203
  reason: 'unknown_feature_code',
@@ -191,6 +213,13 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
191
213
  recovery: 'Call geonames_reverse_geocode again with cities for the nearest populated places, or featureClasses/featureCodes for the nearest features of a type, not both.',
192
214
  severity: 'notice',
193
215
  },
216
+ {
217
+ reason: 'feature_filter_mismatch',
218
+ code: JsonRpcErrorCode.ValidationError,
219
+ when: "featureClasses and featureCodes are both set and a code's class is not listed or a listed class has no listed code. GeoNames intersects the two lists, so those entries match nothing.",
220
+ recovery: 'Call geonames_reverse_geocode again with featureCodes alone (each code implies its class) or featureClasses alone; for a whole class plus codes of another class, make one call per class.',
221
+ severity: 'notice',
222
+ },
194
223
  {
195
224
  reason: 'username_required',
196
225
  code: JsonRpcErrorCode.Unauthorized,
@@ -233,8 +262,10 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
233
262
  ],
234
263
  async handler(input, ctx) {
235
264
  const startedAt = Date.now();
236
- ctx.enrich({ truncated: false, shown: 0, cap: input.nearbyLimit });
237
- const { lat, lng, nearbyLimit, radiusKm, cities, featureClasses, featureCodes } = input;
265
+ const clamp = clampLimit(input.nearbyLimit, MAX_NEARBY, 'nearbyLimit');
266
+ const nearbyLimit = clamp.applied;
267
+ ctx.enrich({ truncated: false, shown: 0, cap: nearbyLimit });
268
+ const { lat, lng, radiusKm, cities, featureClasses, featureCodes, coastalBufferKm } = input;
238
269
  if (cities !== undefined && (featureClasses !== undefined || featureCodes !== undefined)) {
239
270
  throw ctx.fail('conflicting_filters', 'cities narrows the nearest populated places, while featureClasses and featureCodes switch to the nearest features of a type; pass one or the other.');
240
271
  }
@@ -242,6 +273,11 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
242
273
  if (unknownCodes.length > 0) {
243
274
  throw ctx.fail('unknown_feature_code', `Not a GeoNames feature code: ${unknownCodes.join(', ')}.`, { featureCodes: unknownCodes });
244
275
  }
276
+ const mismatch = featureFilterMismatch({ featureClasses, featureCodes });
277
+ if (mismatch !== undefined) {
278
+ const { message, ...offending } = mismatch;
279
+ throw ctx.fail('feature_filter_mismatch', message, offending);
280
+ }
245
281
  const service = getGeoNamesService();
246
282
  const account = service.resolveAccount(input.geonamesUsername);
247
283
  const nearbyKind = nearbyLimit === 0
@@ -249,9 +285,11 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
249
285
  : featureClasses !== undefined || featureCodes !== undefined
250
286
  ? 'features'
251
287
  : 'populated_places';
252
- /** Containment, then the ocean only when no country contains the point. */
288
+ /** Containment, then the ocean only when no country contains the point or lies within the buffer. */
253
289
  const locate = async () => {
254
- const subdivision = await service.subdivision(lat, lng, account, ctx);
290
+ const subdivision = await service.subdivision(lat, lng, account, ctx, {
291
+ bufferKm: coastalBufferKm,
292
+ });
255
293
  if (subdivision !== undefined)
256
294
  return { subdivision };
257
295
  const remainingMs = TOOL_BUDGET_MS - (Date.now() - startedAt);
@@ -260,7 +298,8 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
260
298
  });
261
299
  return ocean === undefined ? {} : { ocean };
262
300
  };
263
- const nearbyParams = { lat, lng, radiusKm, limit: nearbyLimit };
301
+ /** One row past nearbyLimit: the extra row is what says more lie within the radius. */
302
+ const nearbyParams = { lat, lng, radiusKm, limit: nearbyLimit + 1 };
264
303
  let nearbyLeg = Promise.resolve([]);
265
304
  if (nearbyKind === 'populated_places') {
266
305
  nearbyLeg = service.nearbyPlaces({ ...nearbyParams, cities }, account, ctx);
@@ -268,18 +307,33 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
268
307
  else if (nearbyKind === 'features') {
269
308
  nearbyLeg = service.nearbyFeatures({ ...nearbyParams, featureClasses, featureCodes }, account, ctx);
270
309
  }
271
- const [{ subdivision, ocean }, nearby, timezone] = await Promise.all([
310
+ const [{ subdivision, ocean }, nearbyRows, timezone] = await Promise.all([
272
311
  locate(),
273
312
  nearbyLeg,
274
313
  input.includeTimezone ? service.timezone(lat, lng, account, ctx) : undefined,
275
314
  ]);
315
+ const nearby = nearbyRows.slice(0, nearbyLimit);
276
316
  const shown = nearby.length;
277
317
  ctx.enrich({ shown });
278
318
  const fragments = [];
279
- if (subdivision === undefined) {
280
- fragments.push(ocean === undefined
281
- ? 'GeoNames has no country or ocean for this point (polar or unmapped area); geonames_search_places with a boundingBox around it can still find named features.'
282
- : `No country contains this point; it lies in ${inlineText(ocean.name)}. Coastal points just offshore resolve to the water body.`);
319
+ if (subdivision === undefined && ocean !== undefined) {
320
+ fragments.push(coastalBufferKm > 0
321
+ ? `No country lies within ${coastalBufferKm} km of this point; it lies in ${ocean.name}.`
322
+ : `No country contains this point; it lies in ${ocean.name}. A harbor or shoreline point just outside a country's outline resolves to the water body: set coastalBufferKm (up to ${MAX_COASTAL_BUFFER_KM}) to match the nearest country within that distance.`);
323
+ }
324
+ else if (subdivision === undefined) {
325
+ const noCountry = coastalBufferKm > 0
326
+ ? `GeoNames has no country within ${coastalBufferKm} km of this point and no ocean for it`
327
+ : 'GeoNames has no country or ocean for this point';
328
+ fragments.push(`${noCountry} (polar or unmapped area); geonames_search_places with a boundingBox around it can still find named features.`);
329
+ if (coastalBufferKm === 0) {
330
+ fragments.push(`A shoreline point just outside a country's outline can land here too: set coastalBufferKm (up to ${MAX_COASTAL_BUFFER_KM}) to match the nearest country within that distance.`);
331
+ }
332
+ }
333
+ else if (subdivision.country?.distanceInKm !== undefined) {
334
+ const { countryCode, countryName, distanceInKm } = subdivision.country;
335
+ const label = countryName === undefined ? countryCode : `${countryName} (${countryCode})`;
336
+ fragments.push(`No country contains this point exactly; ${label} was matched ${distanceInKm} km away, within the ${coastalBufferKm} km coastal buffer.`);
283
337
  }
284
338
  const widen = radiusKm < MAX_RADIUS_KM
285
339
  ? `raise radiusKm (max ${MAX_RADIUS_KM})`
@@ -288,19 +342,19 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
288
342
  fragments.push(`No populated place within ${radiusKm} km${cities === undefined ? '' : ` in ${cities}`}; ${widen}${cities === undefined ? '' : ' or drop cities'}.`);
289
343
  }
290
344
  if (nearbyKind === 'features' && shown === 0) {
291
- const filter = [
292
- featureCodes && `with code ${featureCodes.join(', ')}`,
293
- featureClasses && `of class ${featureClasses.join(', ')}`,
294
- ]
295
- .filter(Boolean)
296
- .join(' or ');
345
+ // Past feature_filter_mismatch, any listed classes are the codes' own: the codes are the filter.
346
+ const filter = featureCodes === undefined
347
+ ? `of class ${featureClasses?.join(', ')}`
348
+ : `with code ${featureCodes.join(', ')}`;
297
349
  fragments.push(`No feature ${filter} within ${radiusKm} km; ${widen} or widen the feature filter (geonames_list_reference topic feature_codes).`);
298
350
  }
299
- if (shown > 0 && shown === nearbyLimit) {
351
+ if (nearbyRows.length > nearbyLimit) {
300
352
  ctx.enrich.truncated({ shown, cap: nearbyLimit });
353
+ if (clamp.fragment !== undefined)
354
+ fragments.push(clamp.fragment);
301
355
  fragments.push(nearbyLimit < MAX_NEARBY
302
- ? `Only the nearest ${nearbyLimit} are listed, and more may lie within ${radiusKm} km; raise nearbyLimit (max ${MAX_NEARBY}) to see them.`
303
- : `Only the nearest ${MAX_NEARBY} are listed, the most one call returns, and more may lie within ${radiusKm} km; list the rest with geonames_search_places and a boundingBox.`);
356
+ ? `Only the nearest ${nearbyLimit} are listed, and more lie within ${radiusKm} km; raise nearbyLimit (max ${MAX_NEARBY}) to see them.`
357
+ : `Only the nearest ${MAX_NEARBY} are listed, ${clamp.fragment === undefined ? 'the most one call returns, ' : ''}and more lie within ${radiusKm} km; list the rest with geonames_search_places and a boundingBox.`);
304
358
  }
305
359
  if (input.includeTimezone && timezone?.timezoneId === undefined) {
306
360
  fragments.push(timezone === undefined
@@ -325,7 +379,7 @@ export const reverseGeocodeTool = tool('geonames_reverse_geocode', {
325
379
  const { country, ocean, timezone } = result;
326
380
  lines.push(`**Country:** ${country === undefined
327
381
  ? 'None'
328
- : `${country.countryName === undefined ? '' : `${inlineText(country.countryName)} `}(${inlineText(country.countryCode)})`}`);
382
+ : `${country.countryName === undefined ? '' : `${inlineText(country.countryName)} `}(${inlineText(country.countryCode)})${country.distanceInKm === undefined ? '' : `, ${country.distanceInKm} km away (matched within the coastal buffer)`}`}`);
329
383
  if (ocean !== undefined) {
330
384
  lines.push(`**Ocean or sea:** ${inlineText(ocean.name)}${ocean.geonameId === undefined ? '' : ` (geonameId ${ocean.geonameId})`}`);
331
385
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reverse-geocode.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/reverse-geocode.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE/D,0EAA0E;AAC1E,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,mGAAmG;AACnG,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,2EAA2E;A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EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"reverse-geocode.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/reverse-geocode.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE7E,0EAA0E;AAC1E,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,mGAAmG;AACnG,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,iFAAiF;AACjF,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,sFAAsF;AACtF,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,2EAA2E;AAC3E,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;GAGG;AACH,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,YAAY,GAAG,CAAC,kBAAkB,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAIvE,MAAM,aAAa,GAA+B;IAChD,gBAAgB,EAAE,0BAA0B;IAC5C,QAAQ,EAAE,kBAAkB;IAC5B,IAAI,EAAE,uCAAuC;CAC9C,CAAC;AAEF,yFAAyF;AACzF,MAAM,QAAQ,GAAG,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AAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,EAC3G,uCAAuC,QAAQ,CAAC,gBAAgB,eAAe,QAAQ,CAAC,gBAAgB,YAAY,QAAQ,CAAC,gBAAgB,EAAE,EAC/I,qBAAqB,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAC1G,kBAAkB,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EACnG,iBAAiB,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACjG,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @fileoverview geonames_search_places — searches the GeoNames gazetteer by name and
3
- * filters (country, feature class or code, population tier, bounding box) through
3
+ * filters (country, admin code, feature class or code, population tier, bounding box) through
4
4
  * `searchJSON`, one credit a call, cached for an hour.
5
5
  * @module mcp-server/tools/definitions/search-places.tool
6
6
  */
@@ -15,6 +15,10 @@ export declare const searchPlacesTool: import("@cyanheads/mcp-ts-core").ToolDefi
15
15
  name_required: "name_required";
16
16
  }>>, unknown>, unknown>;
17
17
  countries: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
18
+ adminCode1: z.ZodPreprocess<z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>, unknown>;
19
+ adminCode2: z.ZodPreprocess<z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>, unknown>;
20
+ adminCode3: z.ZodPreprocess<z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>, unknown>;
21
+ adminCode4: z.ZodPreprocess<z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>, unknown>;
18
22
  featureClasses: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
19
23
  A: "A";
20
24
  H: "H";
@@ -76,12 +80,30 @@ export declare const searchPlacesTool: import("@cyanheads/mcp-ts-core").ToolDefi
76
80
  readonly when: "match was set without query.";
77
81
  readonly recovery: "Call geonames_search_places again with query text for the chosen match mode, or drop match to search by filters alone.";
78
82
  readonly severity: "notice";
83
+ }, {
84
+ readonly reason: "unknown_country_code";
85
+ readonly code: JsonRpcErrorCode.ValidationError;
86
+ readonly when: "A countries entry, once mapped to alpha-2, is none of the 250 country codes or the retired AN, CS, and YU: an alpha-2 such as EL or EU, or an unassigned alpha-3 or numeric code.";
87
+ readonly recovery: "Find the country with geonames_get_countries (nameContains matches its name), then call again with its alpha-2, alpha-3, or numeric code.";
88
+ readonly severity: "notice";
79
89
  }, {
80
90
  readonly reason: "unknown_feature_code";
81
91
  readonly code: JsonRpcErrorCode.ValidationError;
82
92
  readonly when: "A featureCodes entry is not a GeoNames feature code.";
83
93
  readonly recovery: "Look up valid codes with geonames_list_reference topic feature_codes, then retry with a listed code.";
84
94
  readonly severity: "notice";
95
+ }, {
96
+ readonly reason: "admin_code_unscoped";
97
+ readonly code: JsonRpcErrorCode.ValidationError;
98
+ readonly when: "An admin code is set without exactly one country in countries, or adminCode2 to adminCode4 without adminCode1: codes repeat across countries, and lower-level codes across first-level divisions.";
99
+ readonly recovery: "Call geonames_search_places again with exactly one country in countries and, beside adminCode2 to adminCode4, the adminCode1 they belong to; geonames_get_place lists the codes of every level in adminLevels.";
100
+ readonly severity: "notice";
101
+ }, {
102
+ readonly reason: "feature_filter_mismatch";
103
+ readonly code: JsonRpcErrorCode.ValidationError;
104
+ readonly when: "featureClasses and featureCodes are both set and a code's class is not listed or a listed class has no listed code, or cities (class P only) is set beside another class or a code outside class P. GeoNames intersects the filters, so those entries match nothing.";
105
+ readonly recovery: `${string} ${string}`;
106
+ readonly severity: "notice";
85
107
  }, {
86
108
  readonly reason: "invalid_bounding_box";
87
109
  readonly code: JsonRpcErrorCode.ValidationError;
@@ -1 +1 @@
1
- {"version":3,"file":"search-places.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-places.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA2CjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+X3B,CAAC"}
1
+ {"version":3,"file":"search-places.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-places.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA4GjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+d3B,CAAC"}