nextbillion-mcp 0.1.6 → 0.1.9

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 (70) hide show
  1. package/dist/index.js +21388 -38
  2. package/package.json +6 -7
  3. package/dist/config.d.ts +0 -17
  4. package/dist/config.js +0 -32
  5. package/dist/config.js.map +0 -1
  6. package/dist/core/server.d.ts +0 -13
  7. package/dist/core/server.js +0 -62
  8. package/dist/core/server.js.map +0 -1
  9. package/dist/index.d.ts +0 -2
  10. package/dist/index.js.map +0 -1
  11. package/dist/log.d.ts +0 -7
  12. package/dist/log.js +0 -13
  13. package/dist/log.js.map +0 -1
  14. package/dist/nbclient/client.d.ts +0 -39
  15. package/dist/nbclient/client.js +0 -124
  16. package/dist/nbclient/client.js.map +0 -1
  17. package/dist/nbclient/errors.d.ts +0 -13
  18. package/dist/nbclient/errors.js +0 -36
  19. package/dist/nbclient/errors.js.map +0 -1
  20. package/dist/tools/index.d.ts +0 -7
  21. package/dist/tools/index.js +0 -35
  22. package/dist/tools/index.js.map +0 -1
  23. package/dist/tools/maps/polyline.d.ts +0 -16
  24. package/dist/tools/maps/polyline.js +0 -117
  25. package/dist/tools/maps/polyline.js.map +0 -1
  26. package/dist/tools/maps/static-map-image.d.ts +0 -25
  27. package/dist/tools/maps/static-map-image.js +0 -31
  28. package/dist/tools/maps/static-map-image.js.map +0 -1
  29. package/dist/tools/maps/static-route-map.d.ts +0 -28
  30. package/dist/tools/maps/static-route-map.js +0 -101
  31. package/dist/tools/maps/static-route-map.js.map +0 -1
  32. package/dist/tools/maps/static-shared.d.ts +0 -35
  33. package/dist/tools/maps/static-shared.js +0 -91
  34. package/dist/tools/maps/static-shared.js.map +0 -1
  35. package/dist/tools/places/geocode-batch.d.ts +0 -43
  36. package/dist/tools/places/geocode-batch.js +0 -54
  37. package/dist/tools/places/geocode-batch.js.map +0 -1
  38. package/dist/tools/places/geocode-reverse.d.ts +0 -30
  39. package/dist/tools/places/geocode-reverse.js +0 -33
  40. package/dist/tools/places/geocode-reverse.js.map +0 -1
  41. package/dist/tools/places/geocode-structured.d.ts +0 -40
  42. package/dist/tools/places/geocode-structured.js +0 -61
  43. package/dist/tools/places/geocode-structured.js.map +0 -1
  44. package/dist/tools/places/place-lookup.d.ts +0 -19
  45. package/dist/tools/places/place-lookup.js +0 -24
  46. package/dist/tools/places/place-lookup.js.map +0 -1
  47. package/dist/tools/places/postcode-lookup.d.ts +0 -13
  48. package/dist/tools/places/postcode-lookup.js +0 -56
  49. package/dist/tools/places/postcode-lookup.js.map +0 -1
  50. package/dist/tools/places/text-search.d.ts +0 -128
  51. package/dist/tools/places/text-search.js +0 -80
  52. package/dist/tools/places/text-search.js.map +0 -1
  53. package/dist/tools/routing/directions.d.ts +0 -59
  54. package/dist/tools/routing/directions.js +0 -116
  55. package/dist/tools/routing/directions.js.map +0 -1
  56. package/dist/tools/routing/distance-matrix.d.ts +0 -43
  57. package/dist/tools/routing/distance-matrix.js +0 -82
  58. package/dist/tools/routing/distance-matrix.js.map +0 -1
  59. package/dist/tools/routing/isochrone.d.ts +0 -22
  60. package/dist/tools/routing/isochrone.js +0 -67
  61. package/dist/tools/routing/isochrone.js.map +0 -1
  62. package/dist/tools/routing/search-along-route.d.ts +0 -17
  63. package/dist/tools/routing/search-along-route.js +0 -58
  64. package/dist/tools/routing/search-along-route.js.map +0 -1
  65. package/dist/tools/shared/geo.d.ts +0 -89
  66. package/dist/tools/shared/geo.js +0 -100
  67. package/dist/tools/shared/geo.js.map +0 -1
  68. package/dist/tools/types.d.ts +0 -46
  69. package/dist/tools/types.js +0 -23
  70. package/dist/tools/types.js.map +0 -1
@@ -1,25 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { type NbTool } from '../types.js';
3
- declare const Schema: z.ZodObject<{
4
- width: z.ZodOptional<z.ZodNumber>;
5
- height: z.ZodOptional<z.ZodNumber>;
6
- style: z.ZodOptional<z.ZodString>;
7
- format: z.ZodOptional<z.ZodEnum<{
8
- jpg: "jpg";
9
- png: "png";
10
- webp: "webp";
11
- }>>;
12
- retina: z.ZodOptional<z.ZodBoolean>;
13
- center: z.ZodObject<{
14
- latitude: z.ZodNumber;
15
- longitude: z.ZodNumber;
16
- }, z.core.$strip>;
17
- zoom: z.ZodNumber;
18
- markers: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
- latitude: z.ZodNumber;
20
- longitude: z.ZodNumber;
21
- color: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strip>>>;
23
- }, z.core.$strip>;
24
- export declare const staticMapImage: NbTool<typeof Schema>;
25
- export {};
@@ -1,31 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { CoordinateSchema } from '../shared/geo.js';
3
- import { READ_ONLY } from '../types.js';
4
- import { fetchImageResult, markerParam, StaticImageShape, staticImagePath, } from './static-shared.js';
5
- const Schema = z.object({
6
- center: CoordinateSchema.describe('Center of the map view'),
7
- zoom: z
8
- .number()
9
- .min(0)
10
- .max(22)
11
- .describe('Zoom level (0 = world, ~10 = city, ~15 = streets; fractional values allowed)'),
12
- markers: z
13
- .array(CoordinateSchema.extend({ color: z.string().optional() }))
14
- .optional()
15
- .describe('Markers to draw, each with optional color (e.g. "red", "#0000ff")'),
16
- ...StaticImageShape,
17
- });
18
- export const staticMapImage = {
19
- name: 'static_map_image',
20
- title: 'Static Map Image',
21
- description: 'Render a static map image centered on a location, with optional markers. Returns the image ' +
22
- 'directly. To draw a route on a map use static_route_map instead.',
23
- inputSchema: Schema,
24
- annotations: READ_ONLY,
25
- async run(args, nb) {
26
- const position = `${args.center.latitude},${args.center.longitude},${args.zoom}`;
27
- return fetchImageResult(nb, staticImagePath(position, args), { markers: args.markers?.length ? markerParam(args.markers, 'lng-first') : undefined }, `Map centered at (${args.center.latitude}, ${args.center.longitude}), zoom ${args.zoom}` +
28
- (args.markers?.length ? `, ${args.markers.length} marker(s).` : '.'), args, 'map');
29
- },
30
- };
31
- //# sourceMappingURL=static-map-image.js.map
@@ -1 +0,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CAAC,EAC/B,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,EACtF,oBAAoB,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,WAAW,IAAI,CAAC,IAAI,EAAE;YACtF,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,EACtE,IAAI,EACJ,KAAK,CACN,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,28 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { type NbTool } from '../types.js';
3
- declare const Schema: z.ZodObject<{
4
- width: z.ZodOptional<z.ZodNumber>;
5
- height: z.ZodOptional<z.ZodNumber>;
6
- style: z.ZodOptional<z.ZodString>;
7
- format: z.ZodOptional<z.ZodEnum<{
8
- jpg: "jpg";
9
- png: "png";
10
- webp: "webp";
11
- }>>;
12
- retina: z.ZodOptional<z.ZodBoolean>;
13
- encoded_polyline: z.ZodOptional<z.ZodString>;
14
- route_points: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
- latitude: z.ZodNumber;
16
- longitude: z.ZodNumber;
17
- }, z.core.$strip>>>;
18
- markers: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
- latitude: z.ZodNumber;
20
- longitude: z.ZodNumber;
21
- color: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strip>>>;
23
- stroke_color: z.ZodOptional<z.ZodString>;
24
- stroke_width: z.ZodOptional<z.ZodNumber>;
25
- padding: z.ZodOptional<z.ZodNumber>;
26
- }, z.core.$strip>;
27
- export declare const staticRouteMap: NbTool<typeof Schema>;
28
- export {};
@@ -1,101 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { CoordinateSchema } from '../shared/geo.js';
3
- import { READ_ONLY, ToolInputError } from '../types.js';
4
- import { fetchImageResult, markerParam, StaticImageShape, staticImagePath, } from './static-shared.js';
5
- import { decodePolyline, fitPolylineToBudget } from './polyline.js';
6
- const Schema = z.object({
7
- encoded_polyline: z
8
- .string()
9
- .optional()
10
- .describe('Route geometry as a Google encoded polyline (precision 5) — exactly what the directions ' +
11
- 'tool returns with its default geometry setting'),
12
- route_points: z
13
- .array(CoordinateSchema)
14
- .min(2)
15
- .optional()
16
- .describe('Alternative to encoded_polyline: the route as an ordered list of coordinates'),
17
- markers: z
18
- .array(CoordinateSchema.extend({ color: z.string().optional() }))
19
- .optional()
20
- .describe('Extra markers, e.g. origin and destination, with optional color'),
21
- stroke_color: z
22
- .string()
23
- .optional()
24
- .describe('Route line color (e.g. "blue", "#ff0000"; default blue)'),
25
- stroke_width: z
26
- .number()
27
- .int()
28
- .min(1)
29
- .max(20)
30
- .optional()
31
- .describe('Route line width in pixels (default 4)'),
32
- padding: z
33
- .number()
34
- .min(0)
35
- .max(1)
36
- .optional()
37
- .describe('Margin around the route as a fraction of image size (default 0.1)'),
38
- ...StaticImageShape,
39
- });
40
- /** Stay comfortably under the API's documented 8192-byte URL limit. */
41
- const URL_BYTE_BUDGET = 8000;
42
- /** Progressively tighter encoded-polyline budgets tried when the URL is too long. */
43
- const ENCODED_CHAR_BUDGETS = [4000, 3000, 2000, 1200, 600, 200];
44
- export const staticRouteMap = {
45
- name: 'static_route_map',
46
- title: 'Static Route Map',
47
- description: 'Render a static map image with a route drawn on it, auto-fitted to show the whole route. ' +
48
- 'Pass the encoded polyline from the directions tool (preferred), or a list of route points. ' +
49
- 'Returns the image directly.',
50
- inputSchema: Schema,
51
- annotations: READ_ONLY,
52
- async run(args, nb) {
53
- if (!args.encoded_polyline && !args.route_points) {
54
- throw new ToolInputError('Provide `encoded_polyline` (preferred) or `route_points`.');
55
- }
56
- if (args.encoded_polyline && args.route_points) {
57
- throw new ToolInputError('Provide either `encoded_polyline` or `route_points`, not both.');
58
- }
59
- const styleSegments = [
60
- `stroke:${args.stroke_color ?? 'blue'}`,
61
- `width:${args.stroke_width ?? 4}`,
62
- 'fill:none',
63
- ];
64
- const markers = args.markers?.length ? markerParam(args.markers, 'lat-first') : undefined;
65
- const padding = args.padding !== undefined ? String(args.padding) : undefined;
66
- const path = staticImagePath('auto', args);
67
- const buildQuery = (geometry) => ({
68
- path: `${styleSegments.join('|')}|${geometry}`,
69
- markers,
70
- padding,
71
- });
72
- // First try the geometry exactly as given. Path coordinates are `lat,lng`;
73
- // `enc:` consumes the rest of the parameter value.
74
- let geometry = args.encoded_polyline
75
- ? `enc:${args.encoded_polyline}`
76
- : args.route_points.map((p) => `${p.latitude},${p.longitude}`).join('|');
77
- let simplificationNote = '';
78
- // The Static Images API is GET-only with an 8192-byte URL limit; a long route's
79
- // full-resolution polyline blows past it (~50 kB for 600 km). When that happens,
80
- // simplify the *display* geometry progressively until the URL fits — the route's
81
- // distance/duration come from the directions tool and are unaffected.
82
- if (nb.buildUrl(path, buildQuery(geometry)).length > URL_BYTE_BUDGET) {
83
- const points = args.encoded_polyline
84
- ? decodePolyline(args.encoded_polyline)
85
- : args.route_points;
86
- for (const budget of ENCODED_CHAR_BUDGETS) {
87
- const fitted = fitPolylineToBudget(points, budget);
88
- geometry = `enc:${fitted.encoded}`;
89
- if (nb.buildUrl(path, buildQuery(geometry)).length <= URL_BYTE_BUDGET) {
90
- simplificationNote =
91
- ` Display geometry simplified from ${fitted.originalPointCount} to ` +
92
- `${fitted.pointCount} points to fit the map URL limit; distances are unaffected.`;
93
- break;
94
- }
95
- }
96
- }
97
- return fetchImageResult(nb, path, buildQuery(geometry), `Route map rendered${args.markers?.length ? ` with ${args.markers.length} marker(s)` : ''}.` +
98
- simplificationNote, args, 'route-map');
99
- },
100
- };
101
- //# sourceMappingURL=static-route-map.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static-route-map.js","sourceRoot":"","sources":["../../../src/tools/maps/static-route-map.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C,UAAU,6DAA6D,CAAC;oBACpF,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,gBAAgB,CACrB,EAAE,EACF,IAAI,EACJ,UAAU,CAAC,QAAQ,CAAC,EACpB,qBAAqB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG;YAC1F,kBAAkB,EACpB,IAAI,EACJ,WAAW,CACZ,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,35 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import type { NbClient } from '../../nbclient/client.js';
3
- import type { Coordinate } from '../shared/geo.js';
4
- import type { ToolResult } from '../types.js';
5
- export declare const StaticImageShape: {
6
- width: z.ZodOptional<z.ZodNumber>;
7
- height: z.ZodOptional<z.ZodNumber>;
8
- style: z.ZodOptional<z.ZodString>;
9
- format: z.ZodOptional<z.ZodEnum<{
10
- jpg: "jpg";
11
- png: "png";
12
- webp: "webp";
13
- }>>;
14
- retina: z.ZodOptional<z.ZodBoolean>;
15
- };
16
- export interface StaticImageArgs {
17
- width?: number;
18
- height?: number;
19
- style?: string;
20
- format?: 'png' | 'jpg' | 'webp';
21
- retina?: boolean;
22
- }
23
- /** Build the `/maps/{style}/static/{position}/{size}.{format}` path. */
24
- export declare function staticImagePath(positionSegment: string, args: StaticImageArgs): string;
25
- /**
26
- * Marker coordinate order differs per endpoint variant (verified against the live API,
27
- * 2026-08-31): the center-based endpoint parses `markers` as `longitude,latitude` (as
28
- * documented), but the auto-fit endpoint parses them as `latitude,longitude` — sending
29
- * the documented order there places markers in the wrong hemisphere and forces a
30
- * world-level auto-zoom. Paths and center segments are `lat,lng` everywhere.
31
- */
32
- export declare function markerParam(markers: Array<Coordinate & {
33
- color?: string;
34
- }>, order: 'lng-first' | 'lat-first'): string;
35
- export declare function fetchImageResult(nb: NbClient, path: string, query: Record<string, string | undefined>, caption: string, args: StaticImageArgs, filePrefix?: string): Promise<ToolResult>;
@@ -1,91 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- import { mkdir, writeFile } from 'node:fs/promises';
3
- import { join } from 'node:path';
4
- import * as z from 'zod/v4';
5
- import { imageOutputDir } from '../../config.js';
6
- import { logError } from '../../log.js';
7
- export const StaticImageShape = {
8
- width: z
9
- .number()
10
- .int()
11
- .min(16)
12
- .max(2048)
13
- .optional()
14
- .describe('Image width in pixels (default 512)'),
15
- height: z
16
- .number()
17
- .int()
18
- .min(16)
19
- .max(2048)
20
- .optional()
21
- .describe('Image height in pixels (default 512)'),
22
- style: z
23
- .string()
24
- .optional()
25
- .describe('Map style id: "streets", "light", "dark", or "hybrid" (default streets)'),
26
- format: z.enum(['png', 'jpg', 'webp']).optional().describe('Image format (default png)'),
27
- retina: z.boolean().optional().describe('Render at @2x resolution for high-DPI displays'),
28
- };
29
- const MIME_TYPES = {
30
- png: 'image/png',
31
- jpg: 'image/jpeg',
32
- webp: 'image/webp',
33
- };
34
- /** Build the `/maps/{style}/static/{position}/{size}.{format}` path. */
35
- export function staticImagePath(positionSegment, args) {
36
- const style = args.style ?? 'streets';
37
- const size = `${args.width ?? 512}x${args.height ?? 512}${args.retina ? '@2x' : ''}`;
38
- const format = args.format ?? 'png';
39
- return `/maps/${encodeURIComponent(style)}/static/${positionSegment}/${size}.${format}`;
40
- }
41
- /**
42
- * Marker coordinate order differs per endpoint variant (verified against the live API,
43
- * 2026-08-31): the center-based endpoint parses `markers` as `longitude,latitude` (as
44
- * documented), but the auto-fit endpoint parses them as `latitude,longitude` — sending
45
- * the documented order there places markers in the wrong hemisphere and forces a
46
- * world-level auto-zoom. Paths and center segments are `lat,lng` everywhere.
47
- */
48
- export function markerParam(markers, order) {
49
- return markers
50
- .map((m) => {
51
- const pair = order === 'lng-first' ? `${m.longitude},${m.latitude}` : `${m.latitude},${m.longitude}`;
52
- return `${pair}${m.color ? `,${m.color}` : ''}`;
53
- })
54
- .join('|');
55
- }
56
- export async function fetchImageResult(nb, path, query, caption, args, filePrefix = 'map') {
57
- const image = await nb.getBinary(path, query);
58
- const mimeType = image.contentType.startsWith('image/')
59
- ? image.contentType
60
- : MIME_TYPES[args.format ?? 'png'];
61
- const savedPath = await saveImage(image.data, filePrefix, args.format ?? 'png');
62
- const location = savedPath
63
- ? ` Saved to ${savedPath} (for clients that cannot display images inline).`
64
- : '';
65
- return {
66
- content: [
67
- { type: 'image', data: Buffer.from(image.data).toString('base64'), mimeType },
68
- { type: 'text', text: caption + location },
69
- ],
70
- };
71
- }
72
- /**
73
- * Persist the rendered image locally so terminal clients (which drop inline image
74
- * content) can open it. Failures are logged and never fail the tool call.
75
- */
76
- async function saveImage(data, prefix, ext) {
77
- try {
78
- const dir = imageOutputDir();
79
- await mkdir(dir, { recursive: true });
80
- const hash = createHash('sha1').update(data).digest('hex').slice(0, 8);
81
- const stamp = new Date().toISOString().replace(/[-:]/g, '').replace(/\..+/, '');
82
- const filePath = join(dir, `${prefix}-${stamp}-${hash}.${ext === 'jpg' ? 'jpg' : ext}`);
83
- await writeFile(filePath, data);
84
- return filePath;
85
- }
86
- catch (error) {
87
- logError('Could not save rendered image to disk', error);
88
- return undefined;
89
- }
90
- }
91
- //# sourceMappingURL=static-shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static-shared.js","sourceRoot":"","sources":["../../../src/tools/maps/static-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B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near: z.ZodOptional<z.ZodObject<{
6
- latitude: z.ZodNumber;
7
- longitude: z.ZodNumber;
8
- }, z.core.$strip>>;
9
- radius_m: z.ZodOptional<z.ZodNumber>;
10
- country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
- bounding_box: z.ZodOptional<z.ZodObject<{
12
- west: z.ZodNumber;
13
- south: z.ZodNumber;
14
- east: z.ZodNumber;
15
- north: z.ZodNumber;
16
- }, z.core.$strip>>;
17
- limit: z.ZodOptional<z.ZodNumber>;
18
- language: z.ZodOptional<z.ZodString>;
19
- view: z.ZodOptional<z.ZodEnum<{
20
- AR: "AR";
21
- CN: "CN";
22
- IL: "IL";
23
- IN: "IN";
24
- MA: "MA";
25
- PK: "PK";
26
- RU: "RU";
27
- TR: "TR";
28
- TW: "TW";
29
- Unified: "Unified";
30
- }>>;
31
- query: z.ZodString;
32
- types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
33
- addressBlock: "addressBlock";
34
- area: "area";
35
- houseNumber: "houseNumber";
36
- intersection: "intersection";
37
- place: "place";
38
- street: "street";
39
- }>>>;
40
- }, z.core.$strip>>;
41
- }, z.core.$strip>;
42
- export declare const geocodeBatch: NbTool<typeof Schema>;
43
- export {};
@@ -1,54 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { placesFilterQuery, PlacesFilterShape, PlaceTypesSchema } from '../shared/geo.js';
3
- import { READ_ONLY, textResult } from '../types.js';
4
- const BatchQuerySchema = z.object({
5
- query: z.string().min(1).describe('Free-text search query for this entry'),
6
- ...PlacesFilterShape,
7
- types: PlaceTypesSchema.optional(),
8
- });
9
- const Schema = z.object({
10
- queries: z
11
- .array(BatchQuerySchema)
12
- .min(1)
13
- .max(100)
14
- .describe('Up to 100 forward-geocode queries resolved in a single request'),
15
- });
16
- export const geocodeBatch = {
17
- name: 'geocode_batch',
18
- title: 'Batch Geocode',
19
- description: 'Forward-geocode up to 100 free-text queries in one request; returns one ranked result set ' +
20
- 'per query, in input order. Strongly prefer this over repeated geocode_forward calls when ' +
21
- 'resolving several addresses — this endpoint has a dedicated (low) rate limit of 60 requests ' +
22
- 'per minute, so batch as much as possible into each call.',
23
- inputSchema: Schema,
24
- annotations: READ_ONLY,
25
- async run(args, nb) {
26
- const body = args.queries.map((entry) => {
27
- const filters = placesFilterQuery(entry);
28
- return {
29
- q: entry.query,
30
- at: filters.at,
31
- in: filters.in,
32
- limit: filters.limit,
33
- lang: filters.lang,
34
- types: entry.types?.join(','),
35
- };
36
- });
37
- const response = await nb.postJson('/geocode/batch', {}, body);
38
- const resultSets = Array.isArray(response) ? response : [response];
39
- const lines = resultSets.map((set, index) => {
40
- const items = set?.items ?? [];
41
- const top = items[0];
42
- const address = top?.address;
43
- const position = top?.position;
44
- const summary = top
45
- ? `${address?.label ?? top.title} (${position?.lat}, ${position?.lng})`
46
- : 'no match';
47
- return `${index + 1}. "${args.queries[index]?.query}" → ${summary}${items.length > 1 ? ` [+${items.length - 1} more]` : ''}`;
48
- });
49
- return textResult(`Resolved ${resultSets.length} queries:\n${lines.join('\n')}`, {
50
- results: resultSets,
51
- });
52
- },
53
- };
54
- //# sourceMappingURL=geocode-batch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocode-batch.js","sourceRoot":"","sources":["../../../src/tools/places/geocode-batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,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,uCAAuC,CAAC;IAC1E,GAAG,iBAAiB;IACpB,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACnC,C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;YAC1C,MAAM,KAAK,GAAI,GAAkD,EAAE,KAAK,IAAI,EAAE,CAAC;YAC/E,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,MAAM,OAAO,GAAG,GAAG,EAAE,OAA8C,CAAC;YACpE,MAAM,QAAQ,GAAG,GAAG,EAAE,QAA+C,CAAC;YACtE,MAAM,OAAO,GAAG,GAAG;gBACjB,CAAC,CAAC,GAAI,OAAO,EAAE,KAAgB,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,GAAG,KAAK,QAAQ,EAAE,GAAG,GAAG;gBACnF,CAAC,CAAC,UAAU,CAAC;YACf,OAAO,GAAG,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,OAAO,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC/H,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,YAAY,UAAU,CAAC,MAAM,cAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;YAC/E,OAAO,EAAE,UAAU;SACpB,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -1,30 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { type NbTool } from '../types.js';
3
- declare const Schema: z.ZodObject<{
4
- coordinate: z.ZodObject<{
5
- latitude: z.ZodNumber;
6
- longitude: z.ZodNumber;
7
- }, z.core.$strip>;
8
- country_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
- bounding_box: z.ZodOptional<z.ZodObject<{
10
- west: z.ZodNumber;
11
- south: z.ZodNumber;
12
- east: z.ZodNumber;
13
- north: z.ZodNumber;
14
- }, z.core.$strip>>;
15
- language: z.ZodOptional<z.ZodString>;
16
- view: z.ZodOptional<z.ZodEnum<{
17
- AR: "AR";
18
- CN: "CN";
19
- IL: "IL";
20
- IN: "IN";
21
- MA: "MA";
22
- PK: "PK";
23
- RU: "RU";
24
- TR: "TR";
25
- TW: "TW";
26
- Unified: "Unified";
27
- }>>;
28
- }, z.core.$strip>;
29
- export declare const geocodeReverse: NbTool<typeof Schema>;
30
- export {};
@@ -1,33 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { BoundingBoxSchema, CoordinateSchema, CountryCodesSchema, summarizePlaces, toLatLng, ViewSchema, } from '../shared/geo.js';
3
- import { READ_ONLY, textResult } from '../types.js';
4
- const Schema = z.object({
5
- coordinate: CoordinateSchema.describe('The location to reverse geocode'),
6
- country_codes: CountryCodesSchema.optional(),
7
- bounding_box: BoundingBoxSchema.optional().describe('Hard-limit results to this bounding box'),
8
- language: z.string().optional().describe('Result language as a BCP 47 tag, e.g. "en-US"'),
9
- view: ViewSchema.optional(),
10
- });
11
- export const geocodeReverse = {
12
- name: 'geocode_reverse',
13
- title: 'Reverse Geocode',
14
- description: 'Find the nearest address for a geographic coordinate. Returns the full postal address, ' +
15
- 'the matched position, and a bounding box.',
16
- inputSchema: Schema,
17
- annotations: READ_ONLY,
18
- async run(args, nb) {
19
- const inFilter = args.country_codes
20
- ? `countryCode:${args.country_codes.map((c) => c.toUpperCase()).join(',')}`
21
- : args.bounding_box
22
- ? `bbox:${args.bounding_box.west},${args.bounding_box.south},${args.bounding_box.east},${args.bounding_box.north}`
23
- : undefined;
24
- const response = await nb.getJson('/revgeocode', {
25
- at: toLatLng(args.coordinate),
26
- in: inFilter,
27
- lang: args.language,
28
- view: args.view,
29
- });
30
- return textResult(summarizePlaces(response, 'address'), response);
31
- },
32
- };
33
- //# sourceMappingURL=geocode-reverse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocode-reverse.js","sourceRoot":"","sources":["../../../src/tools/places/geocode-reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACL,iB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AAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAA0B,aAAa,EAAE;YACxE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7B,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;CACF,CAAC"}
@@ -1,40 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { type NbTool } from '../types.js';
3
- declare const Schema: z.ZodObject<{
4
- country_code: z.ZodString;
5
- state: z.ZodOptional<z.ZodString>;
6
- county: z.ZodOptional<z.ZodString>;
7
- city: z.ZodOptional<z.ZodString>;
8
- suburb: z.ZodOptional<z.ZodString>;
9
- neighborhood: z.ZodOptional<z.ZodString>;
10
- street: z.ZodOptional<z.ZodString>;
11
- house_number: z.ZodOptional<z.ZodString>;
12
- postal_code: z.ZodOptional<z.ZodString>;
13
- near: z.ZodOptional<z.ZodObject<{
14
- latitude: z.ZodNumber;
15
- longitude: z.ZodNumber;
16
- }, z.core.$strip>>;
17
- limit: z.ZodOptional<z.ZodNumber>;
18
- types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
19
- addressBlock: "addressBlock";
20
- area: "area";
21
- houseNumber: "houseNumber";
22
- intersection: "intersection";
23
- place: "place";
24
- street: "street";
25
- }>>>;
26
- view: z.ZodOptional<z.ZodEnum<{
27
- AR: "AR";
28
- CN: "CN";
29
- IL: "IL";
30
- IN: "IN";
31
- MA: "MA";
32
- PK: "PK";
33
- RU: "RU";
34
- TR: "TR";
35
- TW: "TW";
36
- Unified: "Unified";
37
- }>>;
38
- }, z.core.$strip>;
39
- export declare const geocodeStructured: NbTool<typeof Schema>;
40
- export {};
@@ -1,61 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { CoordinateSchema, PlaceTypesSchema, summarizePlaces, toLatLng, ViewSchema, } from '../shared/geo.js';
3
- import { READ_ONLY, textResult, ToolInputError } from '../types.js';
4
- const Schema = z.object({
5
- country_code: z
6
- .string()
7
- .regex(/^[A-Za-z]{3}$/, 'ISO 3166-1 alpha-3 code, e.g. USA')
8
- .describe('Country of the address (required, ISO 3166-1 alpha-3, e.g. "USA")'),
9
- state: z.string().optional(),
10
- county: z.string().optional(),
11
- city: z.string().optional(),
12
- suburb: z.string().optional(),
13
- neighborhood: z.string().optional(),
14
- street: z.string().optional(),
15
- house_number: z.string().optional(),
16
- postal_code: z.string().optional(),
17
- near: CoordinateSchema.optional().describe('Search-context center for ranking'),
18
- limit: z.number().int().min(1).max(100).optional().describe('Maximum results (default 10)'),
19
- types: PlaceTypesSchema.optional(),
20
- view: ViewSchema.optional(),
21
- });
22
- export const geocodeStructured = {
23
- name: 'geocode_structured',
24
- title: 'Structured Geocode',
25
- description: 'Geocode an address given as separate structured fields (country, state, city, street, ' +
26
- 'house number, postal code) instead of one free-text string. Searches addresses and ' +
27
- 'administrative areas only — no POIs. Use when the address components are already known ' +
28
- 'and precision matters; otherwise use geocode_forward.',
29
- inputSchema: Schema,
30
- annotations: READ_ONLY,
31
- async run(args, nb) {
32
- const hasComponent = args.state ??
33
- args.county ??
34
- args.city ??
35
- args.suburb ??
36
- args.neighborhood ??
37
- args.street ??
38
- args.house_number ??
39
- args.postal_code;
40
- if (!hasComponent) {
41
- throw new ToolInputError('Provide at least one address component besides country_code (state, city, street, postal_code, …).');
42
- }
43
- const response = await nb.getJson('/geocode/structured', {
44
- countryCode: args.country_code.toUpperCase(),
45
- state: args.state,
46
- county: args.county,
47
- city: args.city,
48
- suburb: args.suburb,
49
- neighborhood: args.neighborhood,
50
- street: args.street,
51
- houseNumber: args.house_number,
52
- postalCode: args.postal_code,
53
- at: args.near ? toLatLng(args.near) : undefined,
54
- limit: args.limit,
55
- types: args.types?.join(','),
56
- view: args.view,
57
- });
58
- return textResult(summarizePlaces(response, 'match'), response);
59
- },
60
- };
61
- //# sourceMappingURL=geocode-structured.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocode-structured.js","sourceRoot":"","sources":["../../../src/tools/places/geocode-structured.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAe,MAAM,aAAa,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,KAAK,CAAC,eAAe,EAAE,mCAAmC,CAAC;SAC3D,QAAQ,CAAC,mEAAmE,CAAC;IAChF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GA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AAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YAC/C,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF,CAAC"}
@@ -1,19 +0,0 @@
1
- import * as z from 'zod/v4';
2
- import { type NbTool } from '../types.js';
3
- declare const Schema: z.ZodObject<{
4
- id: z.ZodString;
5
- view: z.ZodOptional<z.ZodEnum<{
6
- AR: "AR";
7
- CN: "CN";
8
- IL: "IL";
9
- IN: "IN";
10
- MA: "MA";
11
- PK: "PK";
12
- RU: "RU";
13
- TR: "TR";
14
- TW: "TW";
15
- Unified: "Unified";
16
- }>>;
17
- }, z.core.$strip>;
18
- export declare const placeLookup: NbTool<typeof Schema>;
19
- export {};