nextbillion-mcp 0.1.0

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 (67) hide show
  1. package/dist/config.d.ts +11 -0
  2. package/dist/config.js +22 -0
  3. package/dist/config.js.map +1 -0
  4. package/dist/core/server.d.ts +13 -0
  5. package/dist/core/server.js +62 -0
  6. package/dist/core/server.js.map +1 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +50 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/log.d.ts +7 -0
  11. package/dist/log.js +13 -0
  12. package/dist/log.js.map +1 -0
  13. package/dist/nbclient/client.d.ts +39 -0
  14. package/dist/nbclient/client.js +124 -0
  15. package/dist/nbclient/client.js.map +1 -0
  16. package/dist/nbclient/errors.d.ts +13 -0
  17. package/dist/nbclient/errors.js +36 -0
  18. package/dist/nbclient/errors.js.map +1 -0
  19. package/dist/tools/index.d.ts +7 -0
  20. package/dist/tools/index.js +35 -0
  21. package/dist/tools/index.js.map +1 -0
  22. package/dist/tools/maps/static-map-image.d.ts +25 -0
  23. package/dist/tools/maps/static-map-image.js +31 -0
  24. package/dist/tools/maps/static-map-image.js.map +1 -0
  25. package/dist/tools/maps/static-route-map.d.ts +28 -0
  26. package/dist/tools/maps/static-route-map.js +71 -0
  27. package/dist/tools/maps/static-route-map.js.map +1 -0
  28. package/dist/tools/maps/static-shared.d.ts +32 -0
  29. package/dist/tools/maps/static-shared.js +57 -0
  30. package/dist/tools/maps/static-shared.js.map +1 -0
  31. package/dist/tools/places/geocode-batch.d.ts +35 -0
  32. package/dist/tools/places/geocode-batch.js +52 -0
  33. package/dist/tools/places/geocode-batch.js.map +1 -0
  34. package/dist/tools/places/geocode-reverse.d.ts +30 -0
  35. package/dist/tools/places/geocode-reverse.js +33 -0
  36. package/dist/tools/places/geocode-reverse.js.map +1 -0
  37. package/dist/tools/places/geocode-structured.d.ts +32 -0
  38. package/dist/tools/places/geocode-structured.js +59 -0
  39. package/dist/tools/places/geocode-structured.js.map +1 -0
  40. package/dist/tools/places/place-lookup.d.ts +19 -0
  41. package/dist/tools/places/place-lookup.js +24 -0
  42. package/dist/tools/places/place-lookup.js.map +1 -0
  43. package/dist/tools/places/postcode-lookup.d.ts +13 -0
  44. package/dist/tools/places/postcode-lookup.js +56 -0
  45. package/dist/tools/places/postcode-lookup.js.map +1 -0
  46. package/dist/tools/places/text-search.d.ts +118 -0
  47. package/dist/tools/places/text-search.js +66 -0
  48. package/dist/tools/places/text-search.js.map +1 -0
  49. package/dist/tools/routing/directions.d.ts +58 -0
  50. package/dist/tools/routing/directions.js +109 -0
  51. package/dist/tools/routing/directions.js.map +1 -0
  52. package/dist/tools/routing/distance-matrix.d.ts +42 -0
  53. package/dist/tools/routing/distance-matrix.js +76 -0
  54. package/dist/tools/routing/distance-matrix.js.map +1 -0
  55. package/dist/tools/routing/isochrone.d.ts +22 -0
  56. package/dist/tools/routing/isochrone.js +67 -0
  57. package/dist/tools/routing/isochrone.js.map +1 -0
  58. package/dist/tools/routing/search-along-route.d.ts +17 -0
  59. package/dist/tools/routing/search-along-route.js +58 -0
  60. package/dist/tools/routing/search-along-route.js.map +1 -0
  61. package/dist/tools/shared/geo.d.ts +81 -0
  62. package/dist/tools/shared/geo.js +94 -0
  63. package/dist/tools/shared/geo.js.map +1 -0
  64. package/dist/tools/types.d.ts +39 -0
  65. package/dist/tools/types.js +13 -0
  66. package/dist/tools/types.js.map +1 -0
  67. package/package.json +49 -0
@@ -0,0 +1,118 @@
1
+ import * as z from 'zod/v4';
2
+ import { type NbTool } from '../types.js';
3
+ export declare const geocodeForward: NbTool<z.ZodObject<{
4
+ near: z.ZodOptional<z.ZodObject<{
5
+ latitude: z.ZodNumber;
6
+ longitude: z.ZodNumber;
7
+ }, z.core.$strip>>;
8
+ radius_m: z.ZodOptional<z.ZodNumber>;
9
+ country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ bounding_box: z.ZodOptional<z.ZodObject<{
11
+ west: z.ZodNumber;
12
+ south: z.ZodNumber;
13
+ east: z.ZodNumber;
14
+ north: z.ZodNumber;
15
+ }, z.core.$strip>>;
16
+ limit: z.ZodOptional<z.ZodNumber>;
17
+ language: z.ZodOptional<z.ZodString>;
18
+ view: z.ZodOptional<z.ZodEnum<{
19
+ AR: "AR";
20
+ CN: "CN";
21
+ IL: "IL";
22
+ IN: "IN";
23
+ MA: "MA";
24
+ PK: "PK";
25
+ RU: "RU";
26
+ TR: "TR";
27
+ TW: "TW";
28
+ Unified: "Unified";
29
+ }>>;
30
+ query: z.ZodString;
31
+ }, z.core.$strip>>;
32
+ export declare const placeSearch: NbTool<z.ZodObject<{
33
+ near: z.ZodOptional<z.ZodObject<{
34
+ latitude: z.ZodNumber;
35
+ longitude: z.ZodNumber;
36
+ }, z.core.$strip>>;
37
+ radius_m: z.ZodOptional<z.ZodNumber>;
38
+ country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
+ bounding_box: z.ZodOptional<z.ZodObject<{
40
+ west: z.ZodNumber;
41
+ south: z.ZodNumber;
42
+ east: z.ZodNumber;
43
+ north: z.ZodNumber;
44
+ }, z.core.$strip>>;
45
+ limit: z.ZodOptional<z.ZodNumber>;
46
+ language: z.ZodOptional<z.ZodString>;
47
+ view: z.ZodOptional<z.ZodEnum<{
48
+ AR: "AR";
49
+ CN: "CN";
50
+ IL: "IL";
51
+ IN: "IN";
52
+ MA: "MA";
53
+ PK: "PK";
54
+ RU: "RU";
55
+ TR: "TR";
56
+ TW: "TW";
57
+ Unified: "Unified";
58
+ }>>;
59
+ query: z.ZodString;
60
+ }, z.core.$strip>>;
61
+ export declare const autosuggest: NbTool<z.ZodObject<{
62
+ near: z.ZodOptional<z.ZodObject<{
63
+ latitude: z.ZodNumber;
64
+ longitude: z.ZodNumber;
65
+ }, z.core.$strip>>;
66
+ radius_m: z.ZodOptional<z.ZodNumber>;
67
+ country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ bounding_box: z.ZodOptional<z.ZodObject<{
69
+ west: z.ZodNumber;
70
+ south: z.ZodNumber;
71
+ east: z.ZodNumber;
72
+ north: z.ZodNumber;
73
+ }, z.core.$strip>>;
74
+ limit: z.ZodOptional<z.ZodNumber>;
75
+ language: z.ZodOptional<z.ZodString>;
76
+ view: z.ZodOptional<z.ZodEnum<{
77
+ AR: "AR";
78
+ CN: "CN";
79
+ IL: "IL";
80
+ IN: "IN";
81
+ MA: "MA";
82
+ PK: "PK";
83
+ RU: "RU";
84
+ TR: "TR";
85
+ TW: "TW";
86
+ Unified: "Unified";
87
+ }>>;
88
+ query: z.ZodString;
89
+ }, z.core.$strip>>;
90
+ export declare const autocomplete: NbTool<z.ZodObject<{
91
+ near: z.ZodOptional<z.ZodObject<{
92
+ latitude: z.ZodNumber;
93
+ longitude: z.ZodNumber;
94
+ }, z.core.$strip>>;
95
+ radius_m: z.ZodOptional<z.ZodNumber>;
96
+ country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ bounding_box: z.ZodOptional<z.ZodObject<{
98
+ west: z.ZodNumber;
99
+ south: z.ZodNumber;
100
+ east: z.ZodNumber;
101
+ north: z.ZodNumber;
102
+ }, z.core.$strip>>;
103
+ limit: z.ZodOptional<z.ZodNumber>;
104
+ language: z.ZodOptional<z.ZodString>;
105
+ view: z.ZodOptional<z.ZodEnum<{
106
+ AR: "AR";
107
+ CN: "CN";
108
+ IL: "IL";
109
+ IN: "IN";
110
+ MA: "MA";
111
+ PK: "PK";
112
+ RU: "RU";
113
+ TR: "TR";
114
+ TW: "TW";
115
+ Unified: "Unified";
116
+ }>>;
117
+ query: z.ZodString;
118
+ }, z.core.$strip>>;
@@ -0,0 +1,66 @@
1
+ import * as z from 'zod/v4';
2
+ import { placesFilterQuery, PlacesFilterShape, summarizePlaces } from '../shared/geo.js';
3
+ import { READ_ONLY, textResult } from '../types.js';
4
+ const TextSearchSchema = z.object({
5
+ query: z.string().min(1).describe('Free-text search query'),
6
+ ...PlacesFilterShape,
7
+ });
8
+ /**
9
+ * geocode_forward, place_search, autosuggest and autocomplete share the exact same
10
+ * request surface (`q` + geographic filters) against different endpoints; only the
11
+ * ranking/matching behavior differs.
12
+ */
13
+ function textSearchTool(options) {
14
+ return {
15
+ name: options.name,
16
+ title: options.title,
17
+ description: options.description,
18
+ inputSchema: TextSearchSchema,
19
+ annotations: READ_ONLY,
20
+ async run(args, nb) {
21
+ const response = await nb.getJson(options.path, {
22
+ q: args.query,
23
+ ...placesFilterQuery(args),
24
+ });
25
+ return textResult(summarizePlaces(response, options.noun), response);
26
+ },
27
+ };
28
+ }
29
+ export const geocodeForward = textSearchTool({
30
+ name: 'geocode_forward',
31
+ title: 'Forward Geocode',
32
+ description: 'Convert a free-text address, place name, locality, or administrative area into geographic ' +
33
+ 'coordinates and a complete postal address. Tolerates incomplete or partly incorrect queries. ' +
34
+ 'Provide `near`, `country_codes`, or `bounding_box` for more relevant results. ' +
35
+ 'For many addresses at once use geocode_batch; for POI/business search use place_search.',
36
+ path: '/geocode',
37
+ noun: 'match',
38
+ });
39
+ export const placeSearch = textSearchTool({
40
+ name: 'place_search',
41
+ title: 'Search Places',
42
+ description: 'Search for places, points of interest, and businesses with a free-text query (e.g. ' +
43
+ '"gas station", "coffee near the station"), ranked by relevance. Provide `near`, ' +
44
+ '`country_codes`, or `bounding_box` to anchor the search. For plain address-to-coordinates ' +
45
+ 'conversion use geocode_forward instead.',
46
+ path: '/discover',
47
+ noun: 'place',
48
+ });
49
+ export const autosuggest = textSearchTool({
50
+ name: 'autosuggest',
51
+ title: 'Autosuggest',
52
+ description: 'Suggest address and place candidates from an incomplete or misspelled query (typo-tolerant, ' +
53
+ 'e.g. "aqaurium" still matches aquariums). Intended for search-as-you-type experiences. ' +
54
+ 'For prefix completion of valid addresses use autocomplete.',
55
+ path: '/autosuggest',
56
+ noun: 'suggestion',
57
+ });
58
+ export const autocomplete = textSearchTool({
59
+ name: 'autocomplete',
60
+ title: 'Autocomplete',
61
+ description: 'Complete valid street addresses and administrative areas from a partial query prefix ' +
62
+ '(e.g. "stat" → "State Capitol…"). For typo-tolerant fuzzy suggestions use autosuggest.',
63
+ path: '/autocomplete',
64
+ noun: 'completion',
65
+ });
66
+ //# sourceMappingURL=text-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-search.js","sourceRoot":"","sources":["../../../src/tools/places/text-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AAEjE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAC3D,GAAG,iBAAiB;CACrB,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAMvB;IACC,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,SAAS;QACtB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAA0B,OAAO,CAAC,IAAI,EAAE;gBACvE,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,GAAG,iBAAiB,CAAC,IAAI,CAAC;aAC3B,CAAC,CAAC;YACH,OAAO,UAAU,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,4FAA4F;QAC5F,+FAA+F;QAC/F,gFAAgF;QAChF,yFAAyF;IAC3F,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;IACxC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,qFAAqF;QACrF,kFAAkF;QAClF,4FAA4F;QAC5F,yCAAyC;IAC3C,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,OAAO;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;IACxC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,8FAA8F;QAC9F,yFAAyF;QACzF,4DAA4D;IAC9D,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;IACzC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,uFAAuF;QACvF,wFAAwF;IAC1F,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC"}
@@ -0,0 +1,58 @@
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
+ destination: z.ZodObject<{
9
+ latitude: z.ZodNumber;
10
+ longitude: z.ZodNumber;
11
+ }, z.core.$strip>;
12
+ waypoints: z.ZodOptional<z.ZodArray<z.ZodObject<{
13
+ latitude: z.ZodNumber;
14
+ longitude: z.ZodNumber;
15
+ }, z.core.$strip>>>;
16
+ mode: z.ZodOptional<z.ZodEnum<{
17
+ bike: "bike";
18
+ car: "car";
19
+ motorcycle: "motorcycle";
20
+ truck: "truck";
21
+ walk: "walk";
22
+ }>>;
23
+ service: z.ZodOptional<z.ZodEnum<{
24
+ fast: "fast";
25
+ flexible: "flexible";
26
+ }>>;
27
+ route_type: z.ZodOptional<z.ZodEnum<{
28
+ fastest: "fastest";
29
+ shortest: "shortest";
30
+ }>>;
31
+ departure_time: z.ZodOptional<z.ZodNumber>;
32
+ avoid: z.ZodOptional<z.ZodArray<z.ZodEnum<{
33
+ ferry: "ferry";
34
+ highway: "highway";
35
+ left_turn: "left_turn";
36
+ none: "none";
37
+ right_turn: "right_turn";
38
+ service_road: "service_road";
39
+ sharp_turn: "sharp_turn";
40
+ toll: "toll";
41
+ tunnel: "tunnel";
42
+ uturn: "uturn";
43
+ }>>>;
44
+ alternatives: z.ZodOptional<z.ZodBoolean>;
45
+ steps: z.ZodOptional<z.ZodBoolean>;
46
+ geometry: z.ZodOptional<z.ZodEnum<{
47
+ polyline: "polyline";
48
+ polyline6: "polyline6";
49
+ }>>;
50
+ truck_size_cm: z.ZodOptional<z.ZodObject<{
51
+ height: z.ZodNumber;
52
+ width: z.ZodNumber;
53
+ length: z.ZodNumber;
54
+ }, z.core.$strip>>;
55
+ truck_weight_kg: z.ZodOptional<z.ZodNumber>;
56
+ }, z.core.$strip>;
57
+ export declare const directions: NbTool<typeof Schema>;
58
+ export {};
@@ -0,0 +1,109 @@
1
+ import * as z from 'zod/v4';
2
+ import { CoordinateSchema, toLatLng, toLatLngList } from '../shared/geo.js';
3
+ import { READ_ONLY, textResult, ToolInputError } from '../types.js';
4
+ const AVOID_VALUES = [
5
+ 'toll',
6
+ 'highway',
7
+ 'ferry',
8
+ 'sharp_turn',
9
+ 'uturn',
10
+ 'service_road',
11
+ 'left_turn',
12
+ 'right_turn',
13
+ 'tunnel',
14
+ 'none',
15
+ ];
16
+ const Schema = z.object({
17
+ origin: CoordinateSchema.describe('Route start (must be a routable land location)'),
18
+ destination: CoordinateSchema.describe('Route end (must be a routable land location)'),
19
+ waypoints: z
20
+ .array(CoordinateSchema)
21
+ .max(200)
22
+ .optional()
23
+ .describe('Intermediate stops visited in order (max 200)'),
24
+ mode: z
25
+ .enum(['car', 'truck', 'motorcycle', 'bike', 'walk'])
26
+ .optional()
27
+ .describe('Travel mode (default car). Modes other than car/truck require service=flexible'),
28
+ service: z
29
+ .enum(['flexible', 'fast'])
30
+ .optional()
31
+ .describe('API variant: "flexible" (default) supports all modes, departure_time, route_type, full ' +
32
+ 'avoid list and truck options; "fast" is lower latency but limited to car/truck and ' +
33
+ 'avoid toll/ferry/highway only'),
34
+ route_type: z
35
+ .enum(['fastest', 'shortest'])
36
+ .optional()
37
+ .describe('Optimization objective (flexible only, default fastest)'),
38
+ departure_time: z
39
+ .number()
40
+ .int()
41
+ .optional()
42
+ .describe('Departure as a UNIX timestamp in seconds, for typical-traffic routing (flexible only)'),
43
+ avoid: z
44
+ .array(z.enum(AVOID_VALUES))
45
+ .optional()
46
+ .describe('Road features to avoid when alternatives exist. Fast service supports only toll/ferry/highway'),
47
+ alternatives: z
48
+ .boolean()
49
+ .optional()
50
+ .describe('Return up to 3 alternative routes (only without waypoints)'),
51
+ steps: z.boolean().optional().describe('Include turn-by-turn steps (fast service only)'),
52
+ geometry: z
53
+ .enum(['polyline', 'polyline6'])
54
+ .optional()
55
+ .describe('Route geometry encoding (default polyline, precision 5 — directly usable with static_route_map)'),
56
+ truck_size_cm: z
57
+ .object({ height: z.number(), width: z.number(), length: z.number() })
58
+ .optional()
59
+ .describe('Truck dimensions in cm (flexible + mode=truck only)'),
60
+ truck_weight_kg: z
61
+ .number()
62
+ .int()
63
+ .max(100_000)
64
+ .optional()
65
+ .describe('Truck gross weight in kg (flexible + mode=truck only)'),
66
+ });
67
+ export const directions = {
68
+ name: 'directions',
69
+ title: 'Directions',
70
+ description: 'Calculate a route between two points with optional intermediate waypoints. Returns distance ' +
71
+ '(meters), duration (seconds), and encoded polyline geometry per route; pass the geometry to ' +
72
+ 'static_route_map to render it. Traffic-aware.',
73
+ inputSchema: Schema,
74
+ annotations: READ_ONLY,
75
+ async run(args, nb) {
76
+ const service = args.service ?? 'flexible';
77
+ if (service === 'fast' && args.mode && args.mode !== 'car' && args.mode !== 'truck') {
78
+ throw new ToolInputError(`mode=${args.mode} requires service=flexible.`);
79
+ }
80
+ // POST accepts up to 200 waypoints and avoids URL-length limits; params match GET.
81
+ const response = await nb.postJson('/directions/json', service === 'flexible' ? { option: 'flexible' } : {}, {
82
+ origin: toLatLng(args.origin),
83
+ destination: toLatLng(args.destination),
84
+ waypoints: args.waypoints?.length ? toLatLngList(args.waypoints) : undefined,
85
+ mode: args.mode,
86
+ route_type: args.route_type,
87
+ departure_time: args.departure_time,
88
+ avoid: args.avoid?.length ? args.avoid.join('|') : undefined,
89
+ alternatives: args.alternatives,
90
+ altcount: args.alternatives ? 3 : undefined,
91
+ steps: service === 'fast' ? args.steps : undefined,
92
+ geometry: args.geometry ?? 'polyline',
93
+ truck_size: args.truck_size_cm
94
+ ? `${args.truck_size_cm.height},${args.truck_size_cm.width},${args.truck_size_cm.length}`
95
+ : undefined,
96
+ truck_weight: args.truck_weight_kg,
97
+ });
98
+ const routes = response.routes ?? [];
99
+ const lines = routes.map((route, index) => {
100
+ const km = typeof route.distance === 'number' ? (route.distance / 1000).toFixed(1) : '?';
101
+ const minutes = typeof route.duration === 'number' ? Math.round(route.duration / 60) : '?';
102
+ return `Route ${index + 1}: ${km} km, ~${minutes} min`;
103
+ });
104
+ return textResult(lines.length > 0
105
+ ? `${lines.join('\n')}\nGeometry (encoded polyline) is in structured content.`
106
+ : 'No route found.', response);
107
+ },
108
+ };
109
+ //# sourceMappingURL=directions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directions.js","sourceRoot":"","sources":["../../../src/tools/routing/directions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO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ACF,CAAC;QACF,MAAM,MAAM,GAAI,QAAwD,CAAC,MAAM,IAAI,EAAE,CAAC;QACtF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACxC,MAAM,EAAE,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YACzF,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAC3F,OAAO,SAAS,KAAK,GAAG,CAAC,KAAK,EAAE,SAAS,OAAO,MAAM,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CACf,KAAK,CAAC,MAAM,GAAG,CAAC;YACd,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yDAAyD;YAC9E,CAAC,CAAC,iBAAiB,EACrB,QAAQ,CACT,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,42 @@
1
+ import * as z from 'zod/v4';
2
+ import { type NbTool } from '../types.js';
3
+ declare const Schema: z.ZodObject<{
4
+ origins: z.ZodArray<z.ZodObject<{
5
+ latitude: z.ZodNumber;
6
+ longitude: z.ZodNumber;
7
+ }, z.core.$strip>>;
8
+ destinations: z.ZodArray<z.ZodObject<{
9
+ latitude: z.ZodNumber;
10
+ longitude: z.ZodNumber;
11
+ }, z.core.$strip>>;
12
+ mode: z.ZodOptional<z.ZodEnum<{
13
+ bike: "bike";
14
+ car: "car";
15
+ motorcycle: "motorcycle";
16
+ truck: "truck";
17
+ walk: "walk";
18
+ }>>;
19
+ service: z.ZodOptional<z.ZodEnum<{
20
+ fast: "fast";
21
+ flexible: "flexible";
22
+ }>>;
23
+ route_type: z.ZodOptional<z.ZodEnum<{
24
+ fastest: "fastest";
25
+ shortest: "shortest";
26
+ }>>;
27
+ departure_time: z.ZodOptional<z.ZodNumber>;
28
+ avoid: z.ZodOptional<z.ZodArray<z.ZodEnum<{
29
+ ferry: "ferry";
30
+ highway: "highway";
31
+ none: "none";
32
+ toll: "toll";
33
+ }>>>;
34
+ truck_size_cm: z.ZodOptional<z.ZodObject<{
35
+ height: z.ZodNumber;
36
+ width: z.ZodNumber;
37
+ length: z.ZodNumber;
38
+ }, z.core.$strip>>;
39
+ truck_weight_kg: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$strip>;
41
+ export declare const distanceMatrix: NbTool<typeof Schema>;
42
+ export {};
@@ -0,0 +1,76 @@
1
+ import * as z from 'zod/v4';
2
+ import { CoordinateSchema, toLatLngList } from '../shared/geo.js';
3
+ import { READ_ONLY, textResult, ToolInputError } from '../types.js';
4
+ const Schema = z.object({
5
+ origins: z.array(CoordinateSchema).min(1).max(1000).describe('Start points (matrix rows)'),
6
+ destinations: z.array(CoordinateSchema).min(1).max(1000).describe('End points (matrix columns)'),
7
+ mode: z
8
+ .enum(['car', 'truck', 'motorcycle', 'bike', 'walk'])
9
+ .optional()
10
+ .describe('Travel mode (default car). Modes other than car/truck require service=flexible'),
11
+ service: z
12
+ .enum(['fast', 'flexible'])
13
+ .optional()
14
+ .describe('API variant: "fast" (default) supports up to 1000x1000 points; "flexible" adds ' +
15
+ 'departure_time, route_type, truck options and more modes but is limited to 50x50 points ' +
16
+ 'within a ~8000 km area'),
17
+ route_type: z
18
+ .enum(['fastest', 'shortest'])
19
+ .optional()
20
+ .describe('Optimization objective (flexible only, default fastest)'),
21
+ departure_time: z
22
+ .number()
23
+ .int()
24
+ .optional()
25
+ .describe('Departure as a UNIX timestamp in seconds, for typical-traffic results (flexible only)'),
26
+ avoid: z
27
+ .array(z.enum(['toll', 'highway', 'ferry', 'none']))
28
+ .optional()
29
+ .describe('Road features to avoid'),
30
+ truck_size_cm: z
31
+ .object({ height: z.number(), width: z.number(), length: z.number() })
32
+ .optional()
33
+ .describe('Truck dimensions in cm (flexible + mode=truck only)'),
34
+ truck_weight_kg: z
35
+ .number()
36
+ .int()
37
+ .max(100_000)
38
+ .optional()
39
+ .describe('Truck gross weight in kg (flexible + mode=truck only)'),
40
+ });
41
+ export const distanceMatrix = {
42
+ name: 'distance_matrix',
43
+ title: 'Distance Matrix',
44
+ description: 'Compute travel distances (meters) and durations (seconds) for every origin→destination ' +
45
+ 'pair in one call (one-to-many or many-to-many). Far more efficient than repeated ' +
46
+ 'directions calls — always prefer this for multiple pairs. Response has one row per origin ' +
47
+ 'with one element per destination, in input order.',
48
+ inputSchema: Schema,
49
+ annotations: READ_ONLY,
50
+ async run(args, nb) {
51
+ const service = args.service ?? 'fast';
52
+ if (service === 'fast' && args.mode && args.mode !== 'car' && args.mode !== 'truck') {
53
+ throw new ToolInputError(`mode=${args.mode} requires service=flexible.`);
54
+ }
55
+ if (service === 'flexible' && (args.origins.length > 50 || args.destinations.length > 50)) {
56
+ throw new ToolInputError('service=flexible is limited to 50 origins x 50 destinations; use service=fast for larger matrices.');
57
+ }
58
+ const response = await nb.postJson('/distancematrix/json', service === 'flexible' ? { option: 'flexible' } : {}, {
59
+ origins: toLatLngList(args.origins),
60
+ destinations: toLatLngList(args.destinations),
61
+ mode: args.mode,
62
+ route_type: args.route_type,
63
+ departure_time: args.departure_time,
64
+ avoid: args.avoid?.length ? args.avoid.join('|') : undefined,
65
+ truck_size: args.truck_size_cm
66
+ ? `${args.truck_size_cm.height},${args.truck_size_cm.width},${args.truck_size_cm.length}`
67
+ : undefined,
68
+ truck_weight: args.truck_weight_kg,
69
+ });
70
+ const rows = response.rows ?? [];
71
+ return textResult(`Computed a ${args.origins.length}x${args.destinations.length} matrix ` +
72
+ `(${rows.length} rows returned). Durations are seconds, distances are meters; ` +
73
+ 'full matrix is in structured content.', response);
74
+ },
75
+ };
76
+ //# sourceMappingURL=distance-matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distance-matrix.js","sourceRoot":"","sources":["../../../src/tools/routing/distance-matrix.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,cAAc,EAAe,MAAM,aAAa,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC1F,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAChG,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;SACpD,QAAQ,EAAE;SACV,QAAQ,CAAC,gFAAgF,CAAC;IAC7F,OAAO,EAAE,CAAC;SACP,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAC1B,QAAQ,EAAE;SACV,QAAQ,CACP,iFAAiF;QAC/E,0FAA0F;QAC1F,wBAAwB,CAC3B;IACH,UAAU,EAAE,CAAC;SACV,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;SAC7B,QAAQ,EAAE;SACV,QAAQ,CAAC,yDAAyD,CAAC;IACtE,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CACP,uFAAu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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 {};
@@ -0,0 +1,67 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isochrone.js","sourceRoot":"","sources":["../../../src/tools/routing/isochrone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAe,MAAM,aAAa,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CA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AAS,sCAAsC,EAC1F,QAAQ,CACT,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,17 @@
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 {};