@cyanheads/geonames-mcp-server 0.0.0-stage → 0.1.1
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.
- package/AGENTS.md +438 -0
- package/CLAUDE.md +438 -0
- package/Dockerfile +177 -0
- package/LICENSE +201 -0
- package/README.md +316 -2
- package/changelog/0.1.x/0.1.0.md +9 -0
- package/changelog/0.1.x/0.1.1.md +22 -0
- package/changelog/template.md +151 -0
- package/dist/config/server-config.d.ts +13 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +21 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +90 -0
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +262 -0
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +88 -0
- package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-children.tool.js +248 -0
- package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts +90 -0
- package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-countries.tool.js +217 -0
- package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts +64 -0
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +168 -0
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-place.tool.d.ts +108 -0
- package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-place.tool.js +300 -0
- package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +735 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +23 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts +103 -0
- package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-reference.tool.js +233 -0
- package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +134 -0
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +381 -0
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +133 -0
- package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-places.tool.js +348 -0
- package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -0
- package/dist/mcp-server/tools/shared-inputs.d.ts +97 -0
- package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -0
- package/dist/mcp-server/tools/shared-inputs.js +156 -0
- package/dist/mcp-server/tools/shared-inputs.js.map +1 -0
- package/dist/services/geonames/feature-codes.d.ts +27 -0
- package/dist/services/geonames/feature-codes.d.ts.map +1 -0
- package/dist/services/geonames/feature-codes.js +723 -0
- package/dist/services/geonames/feature-codes.js.map +1 -0
- package/dist/services/geonames/geonames-service.d.ts +98 -0
- package/dist/services/geonames/geonames-service.d.ts.map +1 -0
- package/dist/services/geonames/geonames-service.js +555 -0
- package/dist/services/geonames/geonames-service.js.map +1 -0
- package/dist/services/geonames/response-cache.d.ts +24 -0
- package/dist/services/geonames/response-cache.d.ts.map +1 -0
- package/dist/services/geonames/response-cache.js +44 -0
- package/dist/services/geonames/response-cache.js.map +1 -0
- package/dist/services/geonames/response-parsers.d.ts +34 -0
- package/dist/services/geonames/response-parsers.d.ts.map +1 -0
- package/dist/services/geonames/response-parsers.js +350 -0
- package/dist/services/geonames/response-parsers.js.map +1 -0
- package/dist/services/geonames/types.d.ts +218 -0
- package/dist/services/geonames/types.d.ts.map +1 -0
- package/dist/services/geonames/types.js +10 -0
- package/dist/services/geonames/types.js.map +1 -0
- package/dist/services/geonames/upstream-errors.d.ts +54 -0
- package/dist/services/geonames/upstream-errors.d.ts.map +1 -0
- package/dist/services/geonames/upstream-errors.js +187 -0
- package/dist/services/geonames/upstream-errors.js.map +1 -0
- package/dist/utils/inline-text.d.ts +25 -0
- package/dist/utils/inline-text.d.ts.map +1 -0
- package/dist/utils/inline-text.js +60 -0
- package/dist/utils/inline-text.js.map +1 -0
- package/package.json +108 -4
- package/server.json +114 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview geonames_get_countries — GeoNames country facts. The full country table
|
|
3
|
+
* is fetched once a day (1 credit) and cached; codes, continent, and name filter it
|
|
4
|
+
* locally.
|
|
5
|
+
* @module mcp-server/tools/definitions/get-countries.tool
|
|
6
|
+
*/
|
|
7
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
9
|
+
import { blankAsUnset, geonamesUsernameInput, limitInput, listInput, nameContainsInput, nameMatcher, offsetInput, paginate, toAlpha2, USERNAME_ALIASES, } from '../shared-inputs.js';
|
|
10
|
+
import { getGeoNamesService } from '../../../services/geonames/geonames-service.js';
|
|
11
|
+
import { tableCell } from '../../../utils/inline-text.js';
|
|
12
|
+
const CONTINENTS = ['AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'];
|
|
13
|
+
/** True when `code` is the country's alpha-2, alpha-3, or (zero-padded) numeric code. */
|
|
14
|
+
const hasCode = (country, code) => code === country.countryCode ||
|
|
15
|
+
code === country.isoAlpha3 ||
|
|
16
|
+
code === country.isoNumeric?.padStart(3, '0');
|
|
17
|
+
const number = (value) => value === undefined ? 'Not available' : value.toLocaleString('en-US');
|
|
18
|
+
export const getCountriesTool = tool('geonames_get_countries', {
|
|
19
|
+
title: 'GeoNames country facts',
|
|
20
|
+
description: "Get GeoNames country facts — ISO alpha-2, alpha-3, and numeric codes, FIPS code, geonameId, capital, population, area in km², continent, languages, currency, postal-code format, and mainland bounding box — for the countries named, a continent, or all 250. The geonameId anchors geonames_get_children (a country's first-level divisions) and geonames_get_hierarchy. The full table is fetched once a day (1 GeoNames credit) and cached.",
|
|
21
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
22
|
+
input: z.object({
|
|
23
|
+
countries: listInput(z
|
|
24
|
+
.string()
|
|
25
|
+
.regex(/^([A-Z]{2,3}|\d{3})$/)
|
|
26
|
+
.describe('ISO 3166-1 alpha-2, alpha-3, or three-digit numeric country code.'), { max: 50, normalize: toAlpha2 }).describe('Countries to return by ISO 3166-1 code: alpha-2 (US), alpha-3 (USA), or three-digit numeric (840), up to 50, as a list or a comma-separated string. Case-insensitive; UK is accepted for GB. Match country names with nameContains instead.'),
|
|
27
|
+
continent: blankAsUnset(z.preprocess((value) => (typeof value === 'string' ? value.toUpperCase() : value), z.enum(CONTINENTS).optional())).describe('Keep only countries on this continent: AF Africa, AN Antarctica, AS Asia, EU Europe, NA North America, OC Oceania, SA South America. Case-insensitive.'),
|
|
28
|
+
nameContains: nameContainsInput.describe('Keep only countries whose English name contains every word of this text as a substring (niger also matches Nigeria), ignoring case, accents, and punctuation.'),
|
|
29
|
+
limit: limitInput(250, 50),
|
|
30
|
+
offset: offsetInput(),
|
|
31
|
+
geonamesUsername: geonamesUsernameInput.describe("Your own GeoNames username, spent only when the country table is not already cached, so the call uses that account's credit instead of the server's. The account needs free web services enabled on its geonames.org account page."),
|
|
32
|
+
}),
|
|
33
|
+
inputAliases: USERNAME_ALIASES,
|
|
34
|
+
output: z.object({
|
|
35
|
+
countries: z
|
|
36
|
+
.array(z
|
|
37
|
+
.object({
|
|
38
|
+
countryCode: z.string().describe('ISO 3166-1 alpha-2 code.'),
|
|
39
|
+
isoAlpha3: z.string().describe('ISO 3166-1 alpha-3 code.'),
|
|
40
|
+
isoNumeric: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('ISO 3166-1 numeric code. Absent where GeoNames gives none.'),
|
|
44
|
+
fipsCode: z
|
|
45
|
+
.string()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('FIPS 10-4 country code. Absent where GeoNames gives none.'),
|
|
48
|
+
countryName: z.string().describe("GeoNames' English country name."),
|
|
49
|
+
geonameId: z
|
|
50
|
+
.number()
|
|
51
|
+
.describe("The country's GeoNames feature id: pass it to geonames_get_children for its first-level divisions, or to geonames_get_place."),
|
|
52
|
+
capital: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('Capital city name. Absent where GeoNames gives none.'),
|
|
56
|
+
continentCode: z.string().describe('Continent code: AF, AN, AS, EU, NA, OC, or SA.'),
|
|
57
|
+
continentName: z.string().describe('Continent name.'),
|
|
58
|
+
population: z
|
|
59
|
+
.number()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Population as GeoNames records it. Absent where GeoNames gives none.'),
|
|
62
|
+
areaInSqKm: z
|
|
63
|
+
.number()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe('Area in square kilometres. Absent where GeoNames gives none.'),
|
|
66
|
+
languages: z
|
|
67
|
+
.array(z.string().describe('A language tag such as en-US or haw.'))
|
|
68
|
+
.describe('Languages spoken, most used first, as GeoNames lists them.'),
|
|
69
|
+
currencyCode: z
|
|
70
|
+
.string()
|
|
71
|
+
.optional()
|
|
72
|
+
.describe('ISO 4217 currency code. Absent where GeoNames gives none.'),
|
|
73
|
+
postalCodeFormat: z
|
|
74
|
+
.string()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Postal-code pattern (# a digit, @ a letter). Absent for countries without postal codes.'),
|
|
77
|
+
boundingBox: z
|
|
78
|
+
.object({
|
|
79
|
+
north: z.number().describe('Northern latitude bound, decimal degrees.'),
|
|
80
|
+
south: z.number().describe('Southern latitude bound, decimal degrees.'),
|
|
81
|
+
east: z.number().describe('Eastern longitude bound, decimal degrees.'),
|
|
82
|
+
west: z.number().describe('Western longitude bound, decimal degrees.'),
|
|
83
|
+
})
|
|
84
|
+
.describe("Bounding box of the country's mainland."),
|
|
85
|
+
})
|
|
86
|
+
.describe('One country.'))
|
|
87
|
+
.describe('Countries on this page, in GeoNames order (by alpha-2 code).'),
|
|
88
|
+
notFound: z
|
|
89
|
+
.array(z.string().describe('A requested code.'))
|
|
90
|
+
.describe('Requested codes that match no GeoNames country; empty when every code matched.'),
|
|
91
|
+
nextOffset: z.number().optional().describe('Offset of the next page; absent on the last page.'),
|
|
92
|
+
}),
|
|
93
|
+
enrichment: {
|
|
94
|
+
totalCount: z.number().describe('Countries matching the filters, before paging.'),
|
|
95
|
+
truncated: z.boolean().describe('True when more countries remain past this page.'),
|
|
96
|
+
shown: z.number().describe('Countries returned on this page.'),
|
|
97
|
+
cap: z.number().describe('The limit that was applied.'),
|
|
98
|
+
notice: z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Guidance when nothing matched, the offset is past the end, or more pages remain.'),
|
|
102
|
+
},
|
|
103
|
+
errors: [
|
|
104
|
+
{
|
|
105
|
+
reason: 'username_required',
|
|
106
|
+
code: JsonRpcErrorCode.Unauthorized,
|
|
107
|
+
when: "Neither geonamesUsername nor the server's GEONAMES_USERNAME supplies a GeoNames account.",
|
|
108
|
+
recovery: 'Call the tool again with geonamesUsername set to a free GeoNames account that has web services enabled, or ask the operator to set GEONAMES_USERNAME.',
|
|
109
|
+
severity: 'notice',
|
|
110
|
+
thrownBy: 'service',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
reason: 'caller_account_rejected',
|
|
114
|
+
code: JsonRpcErrorCode.Unauthorized,
|
|
115
|
+
when: 'GeoNames rejected the caller-supplied geonamesUsername (unknown user, or free web services not enabled).',
|
|
116
|
+
recovery: "Enable free web services for that account on its GeoNames account page, or call the tool again without geonamesUsername to use the server's account.",
|
|
117
|
+
severity: 'notice',
|
|
118
|
+
thrownBy: 'service',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
reason: 'server_account_rejected',
|
|
122
|
+
code: JsonRpcErrorCode.ConfigurationError,
|
|
123
|
+
when: "GeoNames rejected the server's GEONAMES_USERNAME.",
|
|
124
|
+
recovery: 'The operator must set GEONAMES_USERNAME to a registered account with free web services enabled; until then call the tool again with geonamesUsername set to your own account.',
|
|
125
|
+
thrownBy: 'service',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
reason: 'quota_exhausted',
|
|
129
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
130
|
+
when: "GeoNames reported the account's hourly, daily, or weekly credit limit spent, or this server's pacer for the account shed the call.",
|
|
131
|
+
recovery: "Wait for the window named in the message before calling again, or call again with a different GeoNames account: pass geonamesUsername, or omit it to use the server's.",
|
|
132
|
+
retryable: true,
|
|
133
|
+
thrownBy: 'service',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
reason: 'upstream_rejected_parameter',
|
|
137
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
138
|
+
when: 'GeoNames rejected a value the schema let through; the message carries its text.',
|
|
139
|
+
recovery: 'Correct the value named in the message and call again; geonames_list_reference lists valid feature classes, feature codes, and postal coverage.',
|
|
140
|
+
severity: 'notice',
|
|
141
|
+
thrownBy: 'service',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
async handler(input, ctx) {
|
|
145
|
+
ctx.enrich({ totalCount: 0, truncated: false, shown: 0, cap: input.limit });
|
|
146
|
+
const service = getGeoNamesService();
|
|
147
|
+
const table = await service.countries(service.resolveAccount(input.geonamesUsername), ctx);
|
|
148
|
+
const codes = input.countries;
|
|
149
|
+
const matcher = input.nameContains === undefined ? undefined : nameMatcher(input.nameContains);
|
|
150
|
+
const matches = table.filter((country) => (codes === undefined || codes.some((code) => hasCode(country, code))) &&
|
|
151
|
+
(input.continent === undefined || country.continentCode === input.continent) &&
|
|
152
|
+
(matcher === undefined || matcher([country.countryName])));
|
|
153
|
+
const notFound = [
|
|
154
|
+
...new Set(codes?.filter((code) => !table.some((country) => hasCode(country, code)))),
|
|
155
|
+
];
|
|
156
|
+
const { page, nextOffset } = paginate(matches, input.offset, input.limit);
|
|
157
|
+
ctx.enrich.total(matches.length);
|
|
158
|
+
ctx.enrich({ shown: page.length });
|
|
159
|
+
if (nextOffset !== undefined) {
|
|
160
|
+
const remaining = matches.length - nextOffset;
|
|
161
|
+
ctx.enrich.truncated({
|
|
162
|
+
shown: page.length,
|
|
163
|
+
cap: input.limit,
|
|
164
|
+
guidance: `${remaining} more ${remaining === 1 ? 'country' : 'countries'}; call again with offset ${nextOffset}.`,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (page.length === 0) {
|
|
168
|
+
ctx.enrich.notice(matches.length > 0
|
|
169
|
+
? `offset ${input.offset} is past the last country (${matches.length}); call again with a smaller offset.`
|
|
170
|
+
: `No country matched; call geonames_get_countries with no filters to list all ${table.length}.`);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
countries: page,
|
|
174
|
+
notFound,
|
|
175
|
+
...(nextOffset === undefined ? {} : { nextOffset }),
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
format: (result) => {
|
|
179
|
+
const lines = ['## GeoNames countries', ''];
|
|
180
|
+
if (result.countries.length === 0) {
|
|
181
|
+
lines.push('No countries on this page.');
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
lines.push('| Codes (alpha-2 / alpha-3 / numeric / FIPS) | Name | geonameId | Capital | Continent | Population | Area (km²) | Languages | Currency | Postal format | Bounding box (N / S / E / W) |', '|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|');
|
|
185
|
+
for (const country of result.countries) {
|
|
186
|
+
const codes = [
|
|
187
|
+
country.countryCode,
|
|
188
|
+
country.isoAlpha3,
|
|
189
|
+
country.isoNumeric ?? '—',
|
|
190
|
+
country.fipsCode ?? '—',
|
|
191
|
+
].join(' / ');
|
|
192
|
+
const { north, south, east, west } = country.boundingBox;
|
|
193
|
+
const cells = [
|
|
194
|
+
tableCell(codes),
|
|
195
|
+
tableCell(country.countryName),
|
|
196
|
+
String(country.geonameId),
|
|
197
|
+
tableCell(country.capital ?? 'Not available'),
|
|
198
|
+
`${tableCell(country.continentName)} (${tableCell(country.continentCode)})`,
|
|
199
|
+
number(country.population),
|
|
200
|
+
number(country.areaInSqKm),
|
|
201
|
+
country.languages.length > 0 ? tableCell(country.languages.join(', ')) : 'Not available',
|
|
202
|
+
tableCell(country.currencyCode ?? 'Not available'),
|
|
203
|
+
tableCell(country.postalCodeFormat ?? 'Not available'),
|
|
204
|
+
`${north} / ${south} / ${east} / ${west}`,
|
|
205
|
+
];
|
|
206
|
+
lines.push(`| ${cells.join(' | ')} |`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (result.notFound.length > 0) {
|
|
210
|
+
lines.push('', `**No GeoNames country for:** ${tableCell(result.notFound.join(', '))}`);
|
|
211
|
+
}
|
|
212
|
+
if (result.nextOffset !== undefined)
|
|
213
|
+
lines.push('', `Next page: offset ${result.nextOffset}.`);
|
|
214
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
//# sourceMappingURL=get-countries.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-countries.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-countries.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AAO,CAAC,aAAa,CAAC,GAAG;oBAC3E,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC1B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC1B,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe;oBACxF,SAAS,CAAC,OAAO,CAAC,YAAY,IAAI,eAAe,CAAC;oBAClD,SAAS,CAAC,OAAO,CAAC,gBAAgB,IAAI,eAAe,CAAC;oBACtD,GAAG,KAAK,MAAM,KAAK,MAAM,IAAI,MAAM,IAAI,EAAE;iBAC1C,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,gCAAgC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC;QAC/F,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview geonames_get_hierarchy — a feature's parent chain from Earth and its
|
|
3
|
+
* continent down to the feature itself (`hierarchyJSON`, 1 credit, cached a day).
|
|
4
|
+
* @module mcp-server/tools/definitions/get-hierarchy.tool
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
|
+
export declare const getHierarchyTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
9
|
+
geonameId: z.ZodPreprocess<z.ZodString, unknown>;
|
|
10
|
+
geonamesUsername: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
found: z.ZodBoolean;
|
|
13
|
+
geonameId: z.ZodNumber;
|
|
14
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
15
|
+
chain: z.ZodArray<z.ZodObject<{
|
|
16
|
+
geonameId: z.ZodNumber;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
toponymName: z.ZodString;
|
|
19
|
+
featureClass: z.ZodOptional<z.ZodString>;
|
|
20
|
+
featureCode: z.ZodOptional<z.ZodString>;
|
|
21
|
+
featureName: z.ZodOptional<z.ZodString>;
|
|
22
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
23
|
+
adminCode1: z.ZodOptional<z.ZodString>;
|
|
24
|
+
iso3166_2: z.ZodOptional<z.ZodString>;
|
|
25
|
+
lat: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
lng: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
population: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>, readonly [{
|
|
30
|
+
readonly reason: "username_required";
|
|
31
|
+
readonly code: JsonRpcErrorCode.Unauthorized;
|
|
32
|
+
readonly when: "Neither geonamesUsername nor the server's GEONAMES_USERNAME supplies a GeoNames account.";
|
|
33
|
+
readonly recovery: "Call the tool again with geonamesUsername set to a free GeoNames account that has web services enabled, or ask the operator to set GEONAMES_USERNAME.";
|
|
34
|
+
readonly severity: "notice";
|
|
35
|
+
readonly thrownBy: "service";
|
|
36
|
+
}, {
|
|
37
|
+
readonly reason: "caller_account_rejected";
|
|
38
|
+
readonly code: JsonRpcErrorCode.Unauthorized;
|
|
39
|
+
readonly when: "GeoNames rejected the caller-supplied geonamesUsername (unknown user, or free web services not enabled).";
|
|
40
|
+
readonly recovery: "Enable free web services for that account on its GeoNames account page, or call the tool again without geonamesUsername to use the server's account.";
|
|
41
|
+
readonly severity: "notice";
|
|
42
|
+
readonly thrownBy: "service";
|
|
43
|
+
}, {
|
|
44
|
+
readonly reason: "server_account_rejected";
|
|
45
|
+
readonly code: JsonRpcErrorCode.ConfigurationError;
|
|
46
|
+
readonly when: "GeoNames rejected the server's GEONAMES_USERNAME.";
|
|
47
|
+
readonly recovery: "The operator must set GEONAMES_USERNAME to a registered account with free web services enabled; until then call the tool again with geonamesUsername set to your own account.";
|
|
48
|
+
readonly thrownBy: "service";
|
|
49
|
+
}, {
|
|
50
|
+
readonly reason: "quota_exhausted";
|
|
51
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
52
|
+
readonly when: "GeoNames reported the account's hourly, daily, or weekly credit limit spent, or this server's pacer for the account shed the call.";
|
|
53
|
+
readonly recovery: "Wait for the window named in the message before calling again, or call again with a different GeoNames account: pass geonamesUsername, or omit it to use the server's.";
|
|
54
|
+
readonly retryable: true;
|
|
55
|
+
readonly thrownBy: "service";
|
|
56
|
+
}, {
|
|
57
|
+
readonly reason: "upstream_rejected_parameter";
|
|
58
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
59
|
+
readonly when: "GeoNames rejected a value the schema let through; the message carries its text.";
|
|
60
|
+
readonly recovery: "Correct the value named in the message and call again; geonames_list_reference lists valid feature classes, feature codes, and postal coverage.";
|
|
61
|
+
readonly severity: "notice";
|
|
62
|
+
readonly thrownBy: "service";
|
|
63
|
+
}], undefined>;
|
|
64
|
+
//# sourceMappingURL=get-hierarchy.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-hierarchy.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-hierarchy.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAoBjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoL3B,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview geonames_get_hierarchy — a feature's parent chain from Earth and its
|
|
3
|
+
* continent down to the feature itself (`hierarchyJSON`, 1 credit, cached a day).
|
|
4
|
+
* @module mcp-server/tools/definitions/get-hierarchy.tool
|
|
5
|
+
*/
|
|
6
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
|
+
import { geonameIdInput, geonamesUsernameInput, USERNAME_ALIASES, } from '../shared-inputs.js';
|
|
9
|
+
import { getGeoNamesService } from '../../../services/geonames/geonames-service.js';
|
|
10
|
+
import { inlineText, tableCell } from '../../../utils/inline-text.js';
|
|
11
|
+
/** A chain row as this tool returns it: the containment fields, without the labels the chain itself shows. */
|
|
12
|
+
const toLink = ({ adminName1: _adminName, countryGeonameId: _countryId, countryName: _countryName, distanceInKm: _distance, featureClassName: _className, ...link }) => link;
|
|
13
|
+
export const getHierarchyTool = tool('geonames_get_hierarchy', {
|
|
14
|
+
title: 'Get a GeoNames hierarchy',
|
|
15
|
+
description: '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.',
|
|
16
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
17
|
+
input: z.object({
|
|
18
|
+
geonameId: geonameIdInput,
|
|
19
|
+
geonamesUsername: geonamesUsernameInput,
|
|
20
|
+
}),
|
|
21
|
+
inputAliases: USERNAME_ALIASES,
|
|
22
|
+
output: z.object({
|
|
23
|
+
found: z.boolean().describe('False when GeoNames has no feature with this geonameId.'),
|
|
24
|
+
geonameId: z.number().describe('The geonameId that was requested.'),
|
|
25
|
+
guidance: z.string().optional().describe('What to do next; present only when found is false.'),
|
|
26
|
+
chain: z
|
|
27
|
+
.array(z
|
|
28
|
+
.object({
|
|
29
|
+
geonameId: z.number().describe('GeoNames feature id of this level.'),
|
|
30
|
+
name: z.string().describe('Name of this level, as GeoNames displays it.'),
|
|
31
|
+
toponymName: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe("GeoNames' main name for the feature, often the local-language form."),
|
|
34
|
+
featureClass: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('One-letter feature class (L area, A admin division, P populated place, …).'),
|
|
38
|
+
featureCode: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('Feature code: AREA (Earth), CONT, PCLI (country), ADM1–ADM5, PPL, …'),
|
|
42
|
+
featureName: z.string().optional().describe("GeoNames' name for the feature code."),
|
|
43
|
+
countryCode: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('ISO 3166-1 alpha-2 country code. Absent on Earth and continent rows.'),
|
|
47
|
+
adminCode1: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('First-order admin division code. Absent above that level.'),
|
|
51
|
+
iso3166_2: z
|
|
52
|
+
.string()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('ISO 3166-2 code of the first-order admin division, subdivision part only: MO, not US-MO.'),
|
|
55
|
+
lat: z
|
|
56
|
+
.number()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Latitude in decimal degrees. Absent when GeoNames sent none.'),
|
|
59
|
+
lng: z
|
|
60
|
+
.number()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Longitude in decimal degrees. Absent when GeoNames sent none.'),
|
|
63
|
+
population: z
|
|
64
|
+
.number()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Population. Absent when GeoNames records none.'),
|
|
67
|
+
})
|
|
68
|
+
.describe('One level of the chain.'))
|
|
69
|
+
.describe('Administrative ancestors, Earth first and the requested feature last; empty when found is false. Levels a feature does not sit under are skipped.'),
|
|
70
|
+
}),
|
|
71
|
+
errors: [
|
|
72
|
+
{
|
|
73
|
+
reason: 'username_required',
|
|
74
|
+
code: JsonRpcErrorCode.Unauthorized,
|
|
75
|
+
when: "Neither geonamesUsername nor the server's GEONAMES_USERNAME supplies a GeoNames account.",
|
|
76
|
+
recovery: 'Call the tool again with geonamesUsername set to a free GeoNames account that has web services enabled, or ask the operator to set GEONAMES_USERNAME.',
|
|
77
|
+
severity: 'notice',
|
|
78
|
+
thrownBy: 'service',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
reason: 'caller_account_rejected',
|
|
82
|
+
code: JsonRpcErrorCode.Unauthorized,
|
|
83
|
+
when: 'GeoNames rejected the caller-supplied geonamesUsername (unknown user, or free web services not enabled).',
|
|
84
|
+
recovery: "Enable free web services for that account on its GeoNames account page, or call the tool again without geonamesUsername to use the server's account.",
|
|
85
|
+
severity: 'notice',
|
|
86
|
+
thrownBy: 'service',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
reason: 'server_account_rejected',
|
|
90
|
+
code: JsonRpcErrorCode.ConfigurationError,
|
|
91
|
+
when: "GeoNames rejected the server's GEONAMES_USERNAME.",
|
|
92
|
+
recovery: 'The operator must set GEONAMES_USERNAME to a registered account with free web services enabled; until then call the tool again with geonamesUsername set to your own account.',
|
|
93
|
+
thrownBy: 'service',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
reason: 'quota_exhausted',
|
|
97
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
98
|
+
when: "GeoNames reported the account's hourly, daily, or weekly credit limit spent, or this server's pacer for the account shed the call.",
|
|
99
|
+
recovery: "Wait for the window named in the message before calling again, or call again with a different GeoNames account: pass geonamesUsername, or omit it to use the server's.",
|
|
100
|
+
retryable: true,
|
|
101
|
+
thrownBy: 'service',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
reason: 'upstream_rejected_parameter',
|
|
105
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
106
|
+
when: 'GeoNames rejected a value the schema let through; the message carries its text.',
|
|
107
|
+
recovery: 'Correct the value named in the message and call again; geonames_list_reference lists valid feature classes, feature codes, and postal coverage.',
|
|
108
|
+
severity: 'notice',
|
|
109
|
+
thrownBy: 'service',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
async handler(input, ctx) {
|
|
113
|
+
const service = getGeoNamesService();
|
|
114
|
+
const chain = await service.hierarchy(input.geonameId, service.resolveAccount(input.geonamesUsername), ctx);
|
|
115
|
+
const geonameId = Number(input.geonameId);
|
|
116
|
+
if (chain === undefined) {
|
|
117
|
+
return {
|
|
118
|
+
found: false,
|
|
119
|
+
geonameId,
|
|
120
|
+
guidance: `No GeoNames feature has geonameId ${input.geonameId}. Find the place with geonames_search_places and use its geonameId.`,
|
|
121
|
+
chain: [],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return { found: true, geonameId, chain: chain.map(toLink) };
|
|
125
|
+
},
|
|
126
|
+
format: (result) => {
|
|
127
|
+
const lines = [`## GeoNames hierarchy of geonameId ${result.geonameId}`, ''];
|
|
128
|
+
if (result.chain.length > 0) {
|
|
129
|
+
lines.push(result.chain.map((link) => inlineText(link.name)).join(' › '), '');
|
|
130
|
+
}
|
|
131
|
+
lines.push(`**Found:** ${result.found}`);
|
|
132
|
+
if (result.guidance !== undefined)
|
|
133
|
+
lines.push('', inlineText(result.guidance));
|
|
134
|
+
if (result.chain.length > 0) {
|
|
135
|
+
lines.push('', '| # | geonameId | Name | Feature | Country | First-level division | Population | Lat, Lng |', '|:---|:---|:---|:---|:---|:---|:---|:---|');
|
|
136
|
+
result.chain.forEach((link, index) => {
|
|
137
|
+
const name = link.toponymName === link.name
|
|
138
|
+
? tableCell(link.name)
|
|
139
|
+
: `${tableCell(link.name)} (toponym: ${tableCell(link.toponymName)})`;
|
|
140
|
+
const feature = [
|
|
141
|
+
link.featureCode && tableCell(link.featureCode),
|
|
142
|
+
link.featureName && tableCell(link.featureName),
|
|
143
|
+
link.featureClass && `(class ${tableCell(link.featureClass)})`,
|
|
144
|
+
]
|
|
145
|
+
.filter(Boolean)
|
|
146
|
+
.join(' ');
|
|
147
|
+
const admin1 = [
|
|
148
|
+
link.adminCode1 && tableCell(link.adminCode1),
|
|
149
|
+
link.iso3166_2 && `ISO ${tableCell(link.iso3166_2)}`,
|
|
150
|
+
]
|
|
151
|
+
.filter(Boolean)
|
|
152
|
+
.join(' ');
|
|
153
|
+
lines.push(`| ${[
|
|
154
|
+
index,
|
|
155
|
+
link.geonameId,
|
|
156
|
+
name,
|
|
157
|
+
feature || '—',
|
|
158
|
+
link.countryCode === undefined ? '—' : tableCell(link.countryCode),
|
|
159
|
+
admin1 || '—',
|
|
160
|
+
link.population === undefined ? '—' : link.population.toLocaleString('en-US'),
|
|
161
|
+
link.lat === undefined || link.lng === undefined ? '—' : `${link.lat}, ${link.lng}`,
|
|
162
|
+
].join(' | ')} |`);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=get-hierarchy.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-hierarchy.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-hierarchy.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAA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AC,CAAC,CAAC;QACL,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"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview geonames_get_place — the full GeoNames record for one geonameId
|
|
3
|
+
* (`getJSON`, 1 credit, cached a day): admin chain, timezone, bounding box, elevations,
|
|
4
|
+
* alternate names, postal codes, links, and external identifiers.
|
|
5
|
+
* @module mcp-server/tools/definitions/get-place.tool
|
|
6
|
+
*/
|
|
7
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
9
|
+
export declare const getPlaceTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
10
|
+
geonameId: z.ZodPreprocess<z.ZodString, unknown>;
|
|
11
|
+
nameLanguages: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
|
|
12
|
+
geonamesUsername: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
13
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
14
|
+
found: z.ZodBoolean;
|
|
15
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
16
|
+
place: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
geonameId: z.ZodNumber;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
toponymName: z.ZodString;
|
|
20
|
+
asciiName: z.ZodOptional<z.ZodString>;
|
|
21
|
+
lat: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
lng: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
featureClass: z.ZodOptional<z.ZodString>;
|
|
24
|
+
featureClassName: z.ZodOptional<z.ZodString>;
|
|
25
|
+
featureCode: z.ZodOptional<z.ZodString>;
|
|
26
|
+
featureName: z.ZodOptional<z.ZodString>;
|
|
27
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
28
|
+
countryName: z.ZodOptional<z.ZodString>;
|
|
29
|
+
countryGeonameId: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
continentCode: z.ZodOptional<z.ZodString>;
|
|
31
|
+
iso3166_2: z.ZodOptional<z.ZodString>;
|
|
32
|
+
adminLevels: z.ZodArray<z.ZodObject<{
|
|
33
|
+
level: z.ZodNumber;
|
|
34
|
+
code: z.ZodOptional<z.ZodString>;
|
|
35
|
+
name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
geonameId: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
population: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
elevationInMeters: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
demElevationInMeters: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
timezone: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
timezoneId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
gmtOffsetInHours: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
dstOffsetInHours: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
boundingBox: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
north: z.ZodNumber;
|
|
48
|
+
south: z.ZodNumber;
|
|
49
|
+
east: z.ZodNumber;
|
|
50
|
+
west: z.ZodNumber;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
wikipediaUrl: z.ZodOptional<z.ZodString>;
|
|
53
|
+
alternateNames: z.ZodArray<z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
56
|
+
isPreferredName: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
isShortName: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
postalCodes: z.ZodArray<z.ZodString>;
|
|
60
|
+
links: z.ZodArray<z.ZodString>;
|
|
61
|
+
identifiers: z.ZodArray<z.ZodObject<{
|
|
62
|
+
type: z.ZodEnum<{
|
|
63
|
+
faac: "faac";
|
|
64
|
+
iata: "iata";
|
|
65
|
+
icao: "icao";
|
|
66
|
+
tcid: "tcid";
|
|
67
|
+
unlc: "unlc";
|
|
68
|
+
wkdt: "wkdt";
|
|
69
|
+
}>;
|
|
70
|
+
value: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>, readonly [{
|
|
74
|
+
readonly reason: "username_required";
|
|
75
|
+
readonly code: JsonRpcErrorCode.Unauthorized;
|
|
76
|
+
readonly when: "Neither geonamesUsername nor the server's GEONAMES_USERNAME supplies a GeoNames account.";
|
|
77
|
+
readonly recovery: "Call the tool again with geonamesUsername set to a free GeoNames account that has web services enabled, or ask the operator to set GEONAMES_USERNAME.";
|
|
78
|
+
readonly severity: "notice";
|
|
79
|
+
readonly thrownBy: "service";
|
|
80
|
+
}, {
|
|
81
|
+
readonly reason: "caller_account_rejected";
|
|
82
|
+
readonly code: JsonRpcErrorCode.Unauthorized;
|
|
83
|
+
readonly when: "GeoNames rejected the caller-supplied geonamesUsername (unknown user, or free web services not enabled).";
|
|
84
|
+
readonly recovery: "Enable free web services for that account on its GeoNames account page, or call the tool again without geonamesUsername to use the server's account.";
|
|
85
|
+
readonly severity: "notice";
|
|
86
|
+
readonly thrownBy: "service";
|
|
87
|
+
}, {
|
|
88
|
+
readonly reason: "server_account_rejected";
|
|
89
|
+
readonly code: JsonRpcErrorCode.ConfigurationError;
|
|
90
|
+
readonly when: "GeoNames rejected the server's GEONAMES_USERNAME.";
|
|
91
|
+
readonly recovery: "The operator must set GEONAMES_USERNAME to a registered account with free web services enabled; until then call the tool again with geonamesUsername set to your own account.";
|
|
92
|
+
readonly thrownBy: "service";
|
|
93
|
+
}, {
|
|
94
|
+
readonly reason: "quota_exhausted";
|
|
95
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
96
|
+
readonly when: "GeoNames reported the account's hourly, daily, or weekly credit limit spent, or this server's pacer for the account shed the call.";
|
|
97
|
+
readonly recovery: "Wait for the window named in the message before calling again, or call again with a different GeoNames account: pass geonamesUsername, or omit it to use the server's.";
|
|
98
|
+
readonly retryable: true;
|
|
99
|
+
readonly thrownBy: "service";
|
|
100
|
+
}, {
|
|
101
|
+
readonly reason: "upstream_rejected_parameter";
|
|
102
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
103
|
+
readonly when: "GeoNames rejected a value the schema let through; the message carries its text.";
|
|
104
|
+
readonly recovery: "Correct the value named in the message and call again; geonames_list_reference lists valid feature classes, feature codes, and postal coverage.";
|
|
105
|
+
readonly severity: "notice";
|
|
106
|
+
readonly thrownBy: "service";
|
|
107
|
+
}], undefined>;
|
|
108
|
+
//# sourceMappingURL=get-place.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-place.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-place.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiCjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqUvB,CAAC"}
|