nextbillion-mcp 0.1.6 → 0.1.7
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/dist/index.js +21391 -38
- package/package.json +6 -7
- package/dist/config.d.ts +0 -17
- package/dist/config.js +0 -32
- package/dist/config.js.map +0 -1
- package/dist/core/server.d.ts +0 -13
- package/dist/core/server.js +0 -62
- package/dist/core/server.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js.map +0 -1
- package/dist/log.d.ts +0 -7
- package/dist/log.js +0 -13
- package/dist/log.js.map +0 -1
- package/dist/nbclient/client.d.ts +0 -39
- package/dist/nbclient/client.js +0 -124
- package/dist/nbclient/client.js.map +0 -1
- package/dist/nbclient/errors.d.ts +0 -13
- package/dist/nbclient/errors.js +0 -36
- package/dist/nbclient/errors.js.map +0 -1
- package/dist/tools/index.d.ts +0 -7
- package/dist/tools/index.js +0 -35
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/maps/polyline.d.ts +0 -16
- package/dist/tools/maps/polyline.js +0 -117
- package/dist/tools/maps/polyline.js.map +0 -1
- package/dist/tools/maps/static-map-image.d.ts +0 -25
- package/dist/tools/maps/static-map-image.js +0 -31
- package/dist/tools/maps/static-map-image.js.map +0 -1
- package/dist/tools/maps/static-route-map.d.ts +0 -28
- package/dist/tools/maps/static-route-map.js +0 -101
- package/dist/tools/maps/static-route-map.js.map +0 -1
- package/dist/tools/maps/static-shared.d.ts +0 -35
- package/dist/tools/maps/static-shared.js +0 -91
- package/dist/tools/maps/static-shared.js.map +0 -1
- package/dist/tools/places/geocode-batch.d.ts +0 -43
- package/dist/tools/places/geocode-batch.js +0 -54
- package/dist/tools/places/geocode-batch.js.map +0 -1
- package/dist/tools/places/geocode-reverse.d.ts +0 -30
- package/dist/tools/places/geocode-reverse.js +0 -33
- package/dist/tools/places/geocode-reverse.js.map +0 -1
- package/dist/tools/places/geocode-structured.d.ts +0 -40
- package/dist/tools/places/geocode-structured.js +0 -61
- package/dist/tools/places/geocode-structured.js.map +0 -1
- package/dist/tools/places/place-lookup.d.ts +0 -19
- package/dist/tools/places/place-lookup.js +0 -24
- package/dist/tools/places/place-lookup.js.map +0 -1
- package/dist/tools/places/postcode-lookup.d.ts +0 -13
- package/dist/tools/places/postcode-lookup.js +0 -56
- package/dist/tools/places/postcode-lookup.js.map +0 -1
- package/dist/tools/places/text-search.d.ts +0 -128
- package/dist/tools/places/text-search.js +0 -80
- package/dist/tools/places/text-search.js.map +0 -1
- package/dist/tools/routing/directions.d.ts +0 -59
- package/dist/tools/routing/directions.js +0 -116
- package/dist/tools/routing/directions.js.map +0 -1
- package/dist/tools/routing/distance-matrix.d.ts +0 -43
- package/dist/tools/routing/distance-matrix.js +0 -82
- package/dist/tools/routing/distance-matrix.js.map +0 -1
- package/dist/tools/routing/isochrone.d.ts +0 -22
- package/dist/tools/routing/isochrone.js +0 -67
- package/dist/tools/routing/isochrone.js.map +0 -1
- package/dist/tools/routing/search-along-route.d.ts +0 -17
- package/dist/tools/routing/search-along-route.js +0 -58
- package/dist/tools/routing/search-along-route.js.map +0 -1
- package/dist/tools/shared/geo.d.ts +0 -89
- package/dist/tools/shared/geo.js +0 -100
- package/dist/tools/shared/geo.js.map +0 -1
- package/dist/tools/types.d.ts +0 -46
- package/dist/tools/types.js +0 -23
- package/dist/tools/types.js.map +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { type NbTool } from '../types.js';
|
|
3
|
-
declare const Schema: z.ZodObject<{
|
|
4
|
-
origin: z.ZodObject<{
|
|
5
|
-
latitude: z.ZodNumber;
|
|
6
|
-
longitude: z.ZodNumber;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
contours_minutes: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
9
|
-
contours_meters: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
10
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
11
|
-
bike: "bike";
|
|
12
|
-
car: "car";
|
|
13
|
-
motorcycle: "motorcycle";
|
|
14
|
-
truck: "truck";
|
|
15
|
-
walk: "walk";
|
|
16
|
-
}>>;
|
|
17
|
-
polygons: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
denoise: z.ZodOptional<z.ZodNumber>;
|
|
19
|
-
departure_time: z.ZodOptional<z.ZodNumber>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export declare const isochrone: NbTool<typeof Schema>;
|
|
22
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { CoordinateSchema, toLatLng } from '../shared/geo.js';
|
|
3
|
-
import { READ_ONLY, textResult, ToolInputError } from '../types.js';
|
|
4
|
-
const Schema = z.object({
|
|
5
|
-
origin: CoordinateSchema.describe('Starting point of the reachability analysis'),
|
|
6
|
-
contours_minutes: z
|
|
7
|
-
.array(z.number().int().min(1).max(40))
|
|
8
|
-
.max(4)
|
|
9
|
-
.optional()
|
|
10
|
-
.describe('Travel times in minutes, one contour each (max 4 values, increasing, max 40)'),
|
|
11
|
-
contours_meters: z
|
|
12
|
-
.array(z.number().int().min(1).max(60_000))
|
|
13
|
-
.max(4)
|
|
14
|
-
.optional()
|
|
15
|
-
.describe('Travel distances in meters, one contour each (max 4 values, increasing, max 60000)'),
|
|
16
|
-
mode: z
|
|
17
|
-
.enum(['car', 'truck', 'motorcycle', 'bike', 'walk'])
|
|
18
|
-
.optional()
|
|
19
|
-
.describe('Travel mode (default car)'),
|
|
20
|
-
polygons: z
|
|
21
|
-
.boolean()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe('Return contours as GeoJSON Polygons instead of LineStrings'),
|
|
24
|
-
denoise: z
|
|
25
|
-
.number()
|
|
26
|
-
.min(0)
|
|
27
|
-
.max(1)
|
|
28
|
-
.optional()
|
|
29
|
-
.describe('Remove contours smaller than this fraction of the largest (default 1: largest only)'),
|
|
30
|
-
departure_time: z
|
|
31
|
-
.number()
|
|
32
|
-
.int()
|
|
33
|
-
.optional()
|
|
34
|
-
.describe('Departure as a UNIX timestamp in seconds, for typical-traffic analysis'),
|
|
35
|
-
});
|
|
36
|
-
export const isochrone = {
|
|
37
|
-
name: 'isochrone',
|
|
38
|
-
title: 'Isochrone',
|
|
39
|
-
description: 'Calculate the area reachable from a point within given travel time(s) or distance(s). ' +
|
|
40
|
-
'Returns a GeoJSON FeatureCollection of contours. Note: contour geometry coordinates are ' +
|
|
41
|
-
'GeoJSON [longitude, latitude] order.',
|
|
42
|
-
inputSchema: Schema,
|
|
43
|
-
annotations: READ_ONLY,
|
|
44
|
-
async run(args, nb) {
|
|
45
|
-
if (!args.contours_minutes?.length && !args.contours_meters?.length) {
|
|
46
|
-
throw new ToolInputError('Provide `contours_minutes` or `contours_meters`.');
|
|
47
|
-
}
|
|
48
|
-
if (args.contours_minutes?.length && args.contours_meters?.length) {
|
|
49
|
-
throw new ToolInputError('Provide either `contours_minutes` or `contours_meters`, not both.');
|
|
50
|
-
}
|
|
51
|
-
const response = await nb.getJson('/isochrone/json', {
|
|
52
|
-
coordinates: toLatLng(args.origin),
|
|
53
|
-
contours_minutes: args.contours_minutes?.join(','),
|
|
54
|
-
contours_meters: args.contours_meters?.join(','),
|
|
55
|
-
mode: args.mode,
|
|
56
|
-
polygons: args.polygons,
|
|
57
|
-
denoise: args.denoise,
|
|
58
|
-
departure_time: args.departure_time,
|
|
59
|
-
});
|
|
60
|
-
const features = response.features ?? [];
|
|
61
|
-
const metric = args.contours_minutes?.length ? 'minutes' : 'meters';
|
|
62
|
-
const values = (args.contours_minutes ?? args.contours_meters ?? []).join(', ');
|
|
63
|
-
return textResult(`Computed ${features.length} isochrone contour(s) for ${values} ${metric} from ` +
|
|
64
|
-
`(${args.origin.latitude}, ${args.origin.longitude}). GeoJSON is in structured content.`, response);
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=isochrone.js.map
|
|
@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AAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;QACpE,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChF,OAAO,UAAU,CACf,YAAY,QAAQ,CAAC,MAAM,6BAA6B,MAAM,IAAI,MAAM,QAAQ;YAC9E,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,sCAAsC,EAC1F,QAAQ,CACT,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { type NbTool } from '../types.js';
|
|
3
|
-
declare const Schema: z.ZodObject<{
|
|
4
|
-
route_points: z.ZodArray<z.ZodObject<{
|
|
5
|
-
latitude: z.ZodNumber;
|
|
6
|
-
longitude: z.ZodNumber;
|
|
7
|
-
}, z.core.$strip>>;
|
|
8
|
-
query: z.ZodString;
|
|
9
|
-
max_detour_seconds: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
11
|
-
detour_offset: "detour_offset";
|
|
12
|
-
detour_time: "detour_time";
|
|
13
|
-
}>>;
|
|
14
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
export declare const searchAlongRoute: NbTool<typeof Schema>;
|
|
17
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { CoordinateSchema, toLatLngList } from '../shared/geo.js';
|
|
3
|
-
import { READ_ONLY, textResult } from '../types.js';
|
|
4
|
-
const Schema = z.object({
|
|
5
|
-
route_points: z
|
|
6
|
-
.array(CoordinateSchema)
|
|
7
|
-
.min(2)
|
|
8
|
-
.describe('Waypoints defining the route to search along, in travel order'),
|
|
9
|
-
query: z.string().min(1).describe('What to find along the route, e.g. "gas station", "coffee"'),
|
|
10
|
-
max_detour_seconds: z
|
|
11
|
-
.number()
|
|
12
|
-
.int()
|
|
13
|
-
.min(1)
|
|
14
|
-
.max(3600)
|
|
15
|
-
.optional()
|
|
16
|
-
.describe('Max driving time to reach a result after leaving the route (default 900 = 15 min)'),
|
|
17
|
-
sort_by: z
|
|
18
|
-
.enum(['detour_time', 'detour_offset'])
|
|
19
|
-
.optional()
|
|
20
|
-
.describe('Order by detour driving time, or by distance of the detour point from route start'),
|
|
21
|
-
limit: z
|
|
22
|
-
.number()
|
|
23
|
-
.int()
|
|
24
|
-
.min(1)
|
|
25
|
-
.max(20)
|
|
26
|
-
.optional()
|
|
27
|
-
.describe('Maximum results (default 10, max 20)'),
|
|
28
|
-
});
|
|
29
|
-
export const searchAlongRoute = {
|
|
30
|
-
name: 'search_along_route',
|
|
31
|
-
title: 'Search Along Route',
|
|
32
|
-
description: 'Find places (POIs) matching a text query along a driving route, with the detour time and ' +
|
|
33
|
-
'distance each stop adds. Pass the route as an ordered list of waypoints — e.g. the ' +
|
|
34
|
-
'origin/waypoints/destination used with the directions tool. Ideal for "find X on the way" ' +
|
|
35
|
-
'questions.',
|
|
36
|
-
inputSchema: Schema,
|
|
37
|
-
annotations: READ_ONLY,
|
|
38
|
-
async run(args, nb) {
|
|
39
|
-
const response = await nb.postJson('/orbis/alongroute', {}, {
|
|
40
|
-
route: { points: toLatLngList(args.route_points) },
|
|
41
|
-
q: args.query,
|
|
42
|
-
max_detour_time: args.max_detour_seconds,
|
|
43
|
-
sort_by: args.sort_by,
|
|
44
|
-
limit: args.limit,
|
|
45
|
-
});
|
|
46
|
-
const items = response.items ?? [];
|
|
47
|
-
const lines = items.slice(0, 5).map((item, index) => {
|
|
48
|
-
const address = item.address;
|
|
49
|
-
const detourMin = typeof item.detour_time === 'number' ? Math.round(item.detour_time / 60) : '?';
|
|
50
|
-
return `${index + 1}. ${item.title} (${address?.label ?? ''}) — ~${detourMin} min detour`;
|
|
51
|
-
});
|
|
52
|
-
const more = items.length > 5 ? `\n…and ${items.length - 5} more.` : '';
|
|
53
|
-
return textResult(items.length > 0
|
|
54
|
-
? `${items.length} place(s) along the route:\n${lines.join('\n')}${more}`
|
|
55
|
-
: 'No places found along the route.', response);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=search-along-route.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-along-route.js","sourceRoot":"","sources":["../../../src/tools/routing/search-along-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,YAAY,EAAE,CAAC;SACZ,KAAK,CAAC,gBAAgB,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,+DAA+D,CAAC;IAC5E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IAC/F,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,mFAAmF,CAAC;IAChG,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;SACtC,QAAQ,EAAE;SACV,QAAQ,CAAC,mFAAmF,CAAC;IAChG,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAA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AAC,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,UAAU,CACf,KAAK,CAAC,MAAM,GAAG,CAAC;YACd,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,+BAA+B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;YACzE,CAAC,CAAC,kCAAkC,EACtC,QAAQ,CACT,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
/**
|
|
3
|
-
* Tool inputs always take coordinates as explicit {latitude, longitude} objects.
|
|
4
|
-
* The NextBillion APIs mix `lat,lng` strings, `lng,lat` markers and GeoJSON
|
|
5
|
-
* `[lng,lat]`; keeping one input shape and serializing internally protects the
|
|
6
|
-
* model from the ordering traps.
|
|
7
|
-
*/
|
|
8
|
-
export declare const CoordinateSchema: z.ZodObject<{
|
|
9
|
-
latitude: z.ZodNumber;
|
|
10
|
-
longitude: z.ZodNumber;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export type Coordinate = z.output<typeof CoordinateSchema>;
|
|
13
|
-
/** Serialize to the `lat,lng` string used by all routing/places request parameters. */
|
|
14
|
-
export declare function toLatLng(coordinate: Coordinate): string;
|
|
15
|
-
export declare function toLatLngList(coordinates: Coordinate[]): string;
|
|
16
|
-
export declare const BoundingBoxSchema: z.ZodObject<{
|
|
17
|
-
west: z.ZodNumber;
|
|
18
|
-
south: z.ZodNumber;
|
|
19
|
-
east: z.ZodNumber;
|
|
20
|
-
north: z.ZodNumber;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
export type BoundingBox = z.output<typeof BoundingBoxSchema>;
|
|
23
|
-
export declare const CountryCodesSchema: z.ZodArray<z.ZodString>;
|
|
24
|
-
export declare const PlaceTypesSchema: z.ZodArray<z.ZodEnum<{
|
|
25
|
-
addressBlock: "addressBlock";
|
|
26
|
-
area: "area";
|
|
27
|
-
houseNumber: "houseNumber";
|
|
28
|
-
intersection: "intersection";
|
|
29
|
-
place: "place";
|
|
30
|
-
street: "street";
|
|
31
|
-
}>>;
|
|
32
|
-
export declare const ViewSchema: z.ZodEnum<{
|
|
33
|
-
AR: "AR";
|
|
34
|
-
CN: "CN";
|
|
35
|
-
IL: "IL";
|
|
36
|
-
IN: "IN";
|
|
37
|
-
MA: "MA";
|
|
38
|
-
PK: "PK";
|
|
39
|
-
RU: "RU";
|
|
40
|
-
TR: "TR";
|
|
41
|
-
TW: "TW";
|
|
42
|
-
Unified: "Unified";
|
|
43
|
-
}>;
|
|
44
|
-
/** Common optional geographic filters shared by the Places search tools. */
|
|
45
|
-
export declare const PlacesFilterShape: {
|
|
46
|
-
near: z.ZodOptional<z.ZodObject<{
|
|
47
|
-
latitude: z.ZodNumber;
|
|
48
|
-
longitude: z.ZodNumber;
|
|
49
|
-
}, z.core.$strip>>;
|
|
50
|
-
radius_m: z.ZodOptional<z.ZodNumber>;
|
|
51
|
-
country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
-
bounding_box: z.ZodOptional<z.ZodObject<{
|
|
53
|
-
west: z.ZodNumber;
|
|
54
|
-
south: z.ZodNumber;
|
|
55
|
-
east: z.ZodNumber;
|
|
56
|
-
north: z.ZodNumber;
|
|
57
|
-
}, z.core.$strip>>;
|
|
58
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
59
|
-
language: z.ZodOptional<z.ZodString>;
|
|
60
|
-
view: z.ZodOptional<z.ZodEnum<{
|
|
61
|
-
AR: "AR";
|
|
62
|
-
CN: "CN";
|
|
63
|
-
IL: "IL";
|
|
64
|
-
IN: "IN";
|
|
65
|
-
MA: "MA";
|
|
66
|
-
PK: "PK";
|
|
67
|
-
RU: "RU";
|
|
68
|
-
TR: "TR";
|
|
69
|
-
TW: "TW";
|
|
70
|
-
Unified: "Unified";
|
|
71
|
-
}>>;
|
|
72
|
-
};
|
|
73
|
-
export interface PlacesFilterArgs {
|
|
74
|
-
near?: Coordinate;
|
|
75
|
-
radius_m?: number;
|
|
76
|
-
country_codes?: string[];
|
|
77
|
-
bounding_box?: BoundingBox;
|
|
78
|
-
limit?: number;
|
|
79
|
-
language?: string;
|
|
80
|
-
view?: string;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Build the `at` / `in` / `limit` / `lang` / `view` query parameters from the shared
|
|
84
|
-
* filter arguments. The API allows only one `in=` filter form, so the combinations
|
|
85
|
-
* are validated here with actionable messages.
|
|
86
|
-
*/
|
|
87
|
-
export declare function placesFilterQuery(args: PlacesFilterArgs): Record<string, string | number | undefined>;
|
|
88
|
-
/** Compact text summary of a Places `{items: [...]}` response for the model. */
|
|
89
|
-
export declare function summarizePlaces(response: unknown, noun?: string): string;
|
package/dist/tools/shared/geo.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { ToolInputError } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Tool inputs always take coordinates as explicit {latitude, longitude} objects.
|
|
5
|
-
* The NextBillion APIs mix `lat,lng` strings, `lng,lat` markers and GeoJSON
|
|
6
|
-
* `[lng,lat]`; keeping one input shape and serializing internally protects the
|
|
7
|
-
* model from the ordering traps.
|
|
8
|
-
*/
|
|
9
|
-
export const CoordinateSchema = z.object({
|
|
10
|
-
latitude: z.number().min(-90).max(90),
|
|
11
|
-
longitude: z.number().min(-180).max(180),
|
|
12
|
-
});
|
|
13
|
-
/** Serialize to the `lat,lng` string used by all routing/places request parameters. */
|
|
14
|
-
export function toLatLng(coordinate) {
|
|
15
|
-
return `${coordinate.latitude},${coordinate.longitude}`;
|
|
16
|
-
}
|
|
17
|
-
export function toLatLngList(coordinates) {
|
|
18
|
-
return coordinates.map(toLatLng).join('|');
|
|
19
|
-
}
|
|
20
|
-
export const BoundingBoxSchema = z.object({
|
|
21
|
-
west: z.number().min(-180).max(180).describe('Western longitude'),
|
|
22
|
-
south: z.number().min(-90).max(90).describe('Southern latitude'),
|
|
23
|
-
east: z.number().min(-180).max(180).describe('Eastern longitude'),
|
|
24
|
-
north: z.number().min(-90).max(90).describe('Northern latitude'),
|
|
25
|
-
});
|
|
26
|
-
export const CountryCodesSchema = z
|
|
27
|
-
.array(z.string().regex(/^[A-Za-z]{3}$/, 'ISO 3166-1 alpha-3 code, e.g. USA'))
|
|
28
|
-
.min(1)
|
|
29
|
-
.describe('Restrict results to these countries (ISO 3166-1 alpha-3 codes, e.g. ["USA","MEX"])');
|
|
30
|
-
export const PlaceTypesSchema = z
|
|
31
|
-
.array(z.enum(['houseNumber', 'addressBlock', 'street', 'intersection', 'place', 'area']))
|
|
32
|
-
.min(1)
|
|
33
|
-
.describe('Restrict results to these types: houseNumber (exact door point), addressBlock ' +
|
|
34
|
-
'(address-range/segment match incl. interpolated numbers), street, intersection ' +
|
|
35
|
-
'(only returned when requested), place (POI), area (city/district/postal/admin area)');
|
|
36
|
-
export const ViewSchema = z
|
|
37
|
-
.enum(['Unified', 'AR', 'IL', 'IN', 'MA', 'PK', 'RU', 'TR', 'CN', 'TW'])
|
|
38
|
-
.describe('Geopolitical view for disputed territories. Default: Unified (or the requester region)');
|
|
39
|
-
/** Common optional geographic filters shared by the Places search tools. */
|
|
40
|
-
export const PlacesFilterShape = {
|
|
41
|
-
near: CoordinateSchema.optional().describe('Center of the search context; results are ranked around this point'),
|
|
42
|
-
radius_m: z
|
|
43
|
-
.number()
|
|
44
|
-
.int()
|
|
45
|
-
.positive()
|
|
46
|
-
.optional()
|
|
47
|
-
.describe('With `near`: hard-limit results to this radius in meters'),
|
|
48
|
-
country_codes: CountryCodesSchema.optional(),
|
|
49
|
-
bounding_box: BoundingBoxSchema.optional().describe('Hard-limit results to this bounding box'),
|
|
50
|
-
limit: z.number().int().min(1).max(100).optional().describe('Maximum results (default 10)'),
|
|
51
|
-
language: z.string().optional().describe('Result language as a BCP 47 tag, e.g. "en-US"'),
|
|
52
|
-
view: ViewSchema.optional(),
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Build the `at` / `in` / `limit` / `lang` / `view` query parameters from the shared
|
|
56
|
-
* filter arguments. The API allows only one `in=` filter form, so the combinations
|
|
57
|
-
* are validated here with actionable messages.
|
|
58
|
-
*/
|
|
59
|
-
export function placesFilterQuery(args) {
|
|
60
|
-
const inFilters = [];
|
|
61
|
-
if (args.country_codes) {
|
|
62
|
-
inFilters.push(`countryCode:${args.country_codes.map((c) => c.toUpperCase()).join(',')}`);
|
|
63
|
-
}
|
|
64
|
-
if (args.bounding_box) {
|
|
65
|
-
const b = args.bounding_box;
|
|
66
|
-
inFilters.push(`bbox:${b.west},${b.south},${b.east},${b.north}`);
|
|
67
|
-
}
|
|
68
|
-
if (args.radius_m !== undefined) {
|
|
69
|
-
if (!args.near) {
|
|
70
|
-
throw new ToolInputError('`radius_m` requires `near` to define the circle center.');
|
|
71
|
-
}
|
|
72
|
-
inFilters.push(`circle:${toLatLng(args.near)};r=${args.radius_m}`);
|
|
73
|
-
}
|
|
74
|
-
if (inFilters.length > 1) {
|
|
75
|
-
throw new ToolInputError('Use only one geographic filter: `country_codes`, `bounding_box`, or `near`+`radius_m`.');
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
at: args.near && args.radius_m === undefined ? toLatLng(args.near) : undefined,
|
|
79
|
-
in: inFilters[0],
|
|
80
|
-
limit: args.limit,
|
|
81
|
-
lang: args.language,
|
|
82
|
-
view: args.view,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/** Compact text summary of a Places `{items: [...]}` response for the model. */
|
|
86
|
-
export function summarizePlaces(response, noun = 'result') {
|
|
87
|
-
const items = response?.items;
|
|
88
|
-
if (!Array.isArray(items) || items.length === 0)
|
|
89
|
-
return `No ${noun}s found.`;
|
|
90
|
-
const lines = items.slice(0, 5).map((item, index) => {
|
|
91
|
-
const address = item.address;
|
|
92
|
-
const position = item.position;
|
|
93
|
-
const label = address?.label ?? item.title ?? 'unknown';
|
|
94
|
-
const coords = position ? ` (${position.lat}, ${position.lng})` : '';
|
|
95
|
-
return `${index + 1}. ${label}${coords}`;
|
|
96
|
-
});
|
|
97
|
-
const more = items.length > 5 ? `\n…and ${items.length - 5} more.` : '';
|
|
98
|
-
return `${items.length} ${noun}${items.length === 1 ? '' : 's'} found:\n${lines.join('\n')}${more}`;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=geo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geo.js","sourceRoot":"","sources":["../../../src/tools/shared/geo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACzC,CAAC,CAAC;AAGH,uFAAuF;AACvF,MAAM,UAAU,QAAQ,CAAC,UAAsB;IAC7C,OAAO,GAAG,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAAyB;IACpD,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EA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EAAE,EAAE;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAA8C,CAAC;QACpE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAA+C,CAAC;QACtE,MAAM,KAAK,GAAI,OAAO,EAAE,KAAgB,IAAK,IAAI,CAAC,KAAgB,IAAI,SAAS,CAAC;QAChF,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,KAAK,GAAG,MAAM,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;AACtG,CAAC"}
|
package/dist/tools/types.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type * as z from 'zod/v4';
|
|
2
|
-
import type { NbClient } from '../nbclient/client.js';
|
|
3
|
-
/** Subset of the MCP CallToolResult shape produced by our tools. */
|
|
4
|
-
export interface ToolResult {
|
|
5
|
-
content: Array<{
|
|
6
|
-
type: 'text';
|
|
7
|
-
text: string;
|
|
8
|
-
} | {
|
|
9
|
-
type: 'image';
|
|
10
|
-
data: string;
|
|
11
|
-
mimeType: string;
|
|
12
|
-
}>;
|
|
13
|
-
structuredContent?: Record<string, unknown>;
|
|
14
|
-
isError?: boolean;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export interface ToolAnnotations {
|
|
18
|
-
readOnlyHint?: boolean;
|
|
19
|
-
destructiveHint?: boolean;
|
|
20
|
-
idempotentHint?: boolean;
|
|
21
|
-
openWorldHint?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* One NextBillion API wrapped as an MCP tool. Every tool is a plain object so the
|
|
25
|
-
* registry can sort and register them uniformly and tests can call `run` directly.
|
|
26
|
-
*/
|
|
27
|
-
export interface NbTool<Schema extends z.ZodType = z.ZodType> {
|
|
28
|
-
name: string;
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
inputSchema: Schema;
|
|
32
|
-
annotations?: ToolAnnotations;
|
|
33
|
-
run(args: z.output<Schema>, nb: NbClient): Promise<ToolResult>;
|
|
34
|
-
}
|
|
35
|
-
/** All NextBillion Phase 1 APIs are read-only queries against an open dataset. */
|
|
36
|
-
export declare const READ_ONLY: ToolAnnotations;
|
|
37
|
-
export declare class ToolInputError extends Error {
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Build a tool result whose text block carries BOTH a human-readable summary and the
|
|
41
|
-
* complete response as JSON. The MCP spec recommends mirroring structured content
|
|
42
|
-
* into the text block: some hosts (e.g. Claude Desktop) surface only the text to the
|
|
43
|
-
* model, so a summary-only text block made fields such as `access` invisible even
|
|
44
|
-
* though they were present in `structuredContent`.
|
|
45
|
-
*/
|
|
46
|
-
export declare function textResult(summary: string, structuredContent?: Record<string, unknown>): ToolResult;
|
package/dist/tools/types.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** All NextBillion Phase 1 APIs are read-only queries against an open dataset. */
|
|
2
|
-
export const READ_ONLY = {
|
|
3
|
-
readOnlyHint: true,
|
|
4
|
-
destructiveHint: false,
|
|
5
|
-
idempotentHint: true,
|
|
6
|
-
openWorldHint: true,
|
|
7
|
-
};
|
|
8
|
-
export class ToolInputError extends Error {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Build a tool result whose text block carries BOTH a human-readable summary and the
|
|
12
|
-
* complete response as JSON. The MCP spec recommends mirroring structured content
|
|
13
|
-
* into the text block: some hosts (e.g. Claude Desktop) surface only the text to the
|
|
14
|
-
* model, so a summary-only text block made fields such as `access` invisible even
|
|
15
|
-
* though they were present in `structuredContent`.
|
|
16
|
-
*/
|
|
17
|
-
export function textResult(summary, structuredContent) {
|
|
18
|
-
const text = structuredContent === undefined
|
|
19
|
-
? summary
|
|
20
|
-
: `${summary}\n\nFull response (JSON):\n${JSON.stringify(structuredContent)}`;
|
|
21
|
-
return { content: [{ type: 'text', text }], structuredContent };
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=types.js.map
|
package/dist/tools/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAiCA,kFAAkF;AAClF,MAAM,CAAC,MAAM,SAAS,GAAoB;IACxC,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,OAAO,cAAe,SAAQ,KAAK;CAAG;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,OAAe,EACf,iBAA2C;IAE3C,MAAM,IAAI,GACR,iBAAiB,KAAK,SAAS;QAC7B,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,GAAG,OAAO,8BAA8B,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAClF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC;AAClE,CAAC"}
|