@mapbox/mcp-server 0.2.4 → 0.4.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.
- package/README.md +9 -9
- package/dist/commonjs/config/toolConfig.d.ts +8 -0
- package/dist/commonjs/config/toolConfig.d.ts.map +1 -0
- package/dist/commonjs/config/toolConfig.js +40 -0
- package/dist/commonjs/config/toolConfig.js.map +1 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/{index.d.ts.map → commonjs/index.d.ts.map} +1 -1
- package/dist/commonjs/index.js +38 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/{cjs → commonjs}/package.json +1 -1
- package/dist/{tools → commonjs/tools}/MapboxApiBasedTool.d.ts +6 -5
- package/dist/commonjs/tools/MapboxApiBasedTool.d.ts.map +1 -0
- package/dist/commonjs/tools/MapboxApiBasedTool.js +111 -0
- package/dist/commonjs/tools/MapboxApiBasedTool.js.map +1 -0
- package/dist/commonjs/tools/category-list-tool/CategoryListTool.d.ts +28 -0
- package/dist/commonjs/tools/category-list-tool/CategoryListTool.d.ts.map +1 -0
- package/dist/commonjs/tools/category-list-tool/CategoryListTool.js +68 -0
- package/dist/commonjs/tools/category-list-tool/CategoryListTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/category-search-tool/CategorySearchTool.d.ts +6 -5
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -0
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js +188 -0
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/directions-tool/DirectionsTool.d.ts +3 -2
- package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts.map +1 -0
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js +385 -0
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js.map +1 -0
- package/dist/commonjs/tools/directions-tool/cleanResponseData.d.ts.map +1 -0
- package/dist/commonjs/tools/directions-tool/cleanResponseData.js +178 -0
- package/dist/commonjs/tools/directions-tool/cleanResponseData.js.map +1 -0
- package/dist/commonjs/tools/directions-tool/formatIsoDateTime.d.ts.map +1 -0
- package/dist/commonjs/tools/directions-tool/formatIsoDateTime.js +21 -0
- package/dist/commonjs/tools/directions-tool/formatIsoDateTime.js.map +1 -0
- package/dist/{tools → commonjs/tools}/forward-geocode-tool/ForwardGeocodeTool.d.ts +5 -4
- package/dist/commonjs/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts.map +1 -0
- package/dist/commonjs/tools/forward-geocode-tool/ForwardGeocodeTool.js +212 -0
- package/dist/commonjs/tools/forward-geocode-tool/ForwardGeocodeTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/isochrone-tool/IsochroneTool.d.ts +3 -2
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.d.ts.map +1 -0
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.js +118 -0
- package/dist/commonjs/tools/isochrone-tool/IsochroneTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/matrix-tool/MatrixTool.d.ts +3 -2
- package/dist/commonjs/tools/matrix-tool/MatrixTool.d.ts.map +1 -0
- package/dist/commonjs/tools/matrix-tool/MatrixTool.js +202 -0
- package/dist/commonjs/tools/matrix-tool/MatrixTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/poi-search-tool/PoiSearchTool.d.ts +5 -4
- package/dist/commonjs/tools/poi-search-tool/PoiSearchTool.d.ts.map +1 -0
- package/dist/commonjs/tools/poi-search-tool/PoiSearchTool.js +231 -0
- package/dist/commonjs/tools/poi-search-tool/PoiSearchTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/reverse-geocode-tool/ReverseGeocodeTool.d.ts +5 -4
- package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts.map +1 -0
- package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.js +148 -0
- package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/static-map-image-tool/StaticMapImageTool.d.ts +3 -2
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -0
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js +416 -0
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -0
- package/dist/{tools → commonjs/tools}/toolRegistry.d.ts +2 -1
- package/dist/commonjs/tools/toolRegistry.d.ts.map +1 -0
- package/dist/commonjs/tools/toolRegistry.js +37 -0
- package/dist/commonjs/tools/toolRegistry.js.map +1 -0
- package/dist/{tools → commonjs/tools}/version-tool/VersionTool.d.ts +1 -1
- package/dist/commonjs/tools/version-tool/VersionTool.d.ts.map +1 -0
- package/dist/commonjs/tools/version-tool/VersionTool.js +52 -0
- package/dist/commonjs/tools/version-tool/VersionTool.js.map +1 -0
- package/dist/commonjs/utils/fetchRequest.d.ts +38 -0
- package/dist/commonjs/utils/fetchRequest.d.ts.map +1 -0
- package/dist/commonjs/utils/fetchRequest.js +111 -0
- package/dist/commonjs/utils/fetchRequest.js.map +1 -0
- package/dist/commonjs/utils/versionUtils-cjs.cjs.map +1 -0
- package/dist/commonjs/utils/versionUtils-cjs.d.cts.map +1 -0
- package/dist/commonjs/utils/versionUtils.d.ts +9 -0
- package/dist/commonjs/utils/versionUtils.js +46 -0
- package/dist/commonjs/version.json +6 -0
- package/dist/esm/config/toolConfig.d.ts +8 -0
- package/dist/esm/config/toolConfig.d.ts.map +1 -0
- package/dist/esm/config/toolConfig.js +36 -0
- package/dist/esm/config/toolConfig.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/tools/MapboxApiBasedTool.d.ts +83 -0
- package/dist/esm/tools/MapboxApiBasedTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/MapboxApiBasedTool.js +20 -13
- package/dist/esm/tools/MapboxApiBasedTool.js.map +1 -0
- package/dist/esm/tools/category-list-tool/CategoryListTool.d.ts +28 -0
- package/dist/esm/tools/category-list-tool/CategoryListTool.d.ts.map +1 -0
- package/dist/esm/tools/category-list-tool/CategoryListTool.js +64 -0
- package/dist/esm/tools/category-list-tool/CategoryListTool.js.map +1 -0
- package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts +89 -0
- package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -0
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js +184 -0
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js.map +1 -0
- package/dist/esm/tools/directions-tool/DirectionsTool.d.ts +44 -0
- package/dist/esm/tools/directions-tool/DirectionsTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/directions-tool/DirectionsTool.js +9 -8
- package/dist/esm/tools/directions-tool/DirectionsTool.js.map +1 -0
- package/dist/esm/tools/directions-tool/cleanResponseData.d.ts +11 -0
- package/dist/esm/tools/directions-tool/cleanResponseData.d.ts.map +1 -0
- package/dist/esm/tools/directions-tool/cleanResponseData.js.map +1 -0
- package/dist/esm/tools/directions-tool/formatIsoDateTime.d.ts +8 -0
- package/dist/esm/tools/directions-tool/formatIsoDateTime.d.ts.map +1 -0
- package/dist/esm/tools/directions-tool/formatIsoDateTime.js.map +1 -0
- package/dist/esm/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts +98 -0
- package/dist/esm/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/forward-geocode-tool/ForwardGeocodeTool.js +8 -5
- package/dist/esm/tools/forward-geocode-tool/ForwardGeocodeTool.js.map +1 -0
- package/dist/esm/tools/isochrone-tool/IsochroneTool.d.ts +60 -0
- package/dist/esm/tools/isochrone-tool/IsochroneTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/isochrone-tool/IsochroneTool.js +8 -5
- package/dist/esm/tools/isochrone-tool/IsochroneTool.js.map +1 -0
- package/dist/esm/tools/matrix-tool/MatrixTool.d.ts +51 -0
- package/dist/esm/tools/matrix-tool/MatrixTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/matrix-tool/MatrixTool.js +8 -5
- package/dist/{tools → esm/tools}/matrix-tool/MatrixTool.js.map +1 -1
- package/dist/esm/tools/poi-search-tool/PoiSearchTool.d.ts +119 -0
- package/dist/esm/tools/poi-search-tool/PoiSearchTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/poi-search-tool/PoiSearchTool.js +9 -6
- package/dist/esm/tools/poi-search-tool/PoiSearchTool.js.map +1 -0
- package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts +46 -0
- package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/reverse-geocode-tool/ReverseGeocodeTool.js +8 -5
- package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.js.map +1 -0
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts +179 -0
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/static-map-image-tool/StaticMapImageTool.js +7 -4
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -0
- package/dist/esm/tools/toolRegistry.d.ts +15 -0
- package/dist/esm/tools/toolRegistry.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/toolRegistry.js +2 -0
- package/dist/esm/tools/toolRegistry.js.map +1 -0
- package/dist/esm/tools/version-tool/VersionTool.d.ts +18 -0
- package/dist/esm/tools/version-tool/VersionTool.d.ts.map +1 -0
- package/dist/{tools → esm/tools}/version-tool/VersionTool.js +2 -4
- package/dist/esm/tools/version-tool/VersionTool.js.map +1 -0
- package/dist/esm/utils/fetchRequest.d.ts +38 -0
- package/dist/esm/utils/fetchRequest.d.ts.map +1 -0
- package/dist/esm/utils/fetchRequest.js +105 -0
- package/dist/esm/utils/fetchRequest.js.map +1 -0
- package/dist/esm/utils/versionUtils.d.ts.map +1 -0
- package/dist/{utils → esm/utils}/versionUtils.js +4 -2
- package/dist/esm/utils/versionUtils.js.map +1 -0
- package/dist/esm/version.json +6 -0
- package/package.json +44 -29
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/tools/MapboxApiBasedTool.d.ts.map +0 -1
- package/dist/tools/MapboxApiBasedTool.js.map +0 -1
- package/dist/tools/MapboxApiBasedTool.test.d.ts +0 -2
- package/dist/tools/MapboxApiBasedTool.test.d.ts.map +0 -1
- package/dist/tools/MapboxApiBasedTool.test.js +0 -143
- package/dist/tools/MapboxApiBasedTool.test.js.map +0 -1
- package/dist/tools/category-search-tool/CategorySearchTool.d.ts.map +0 -1
- package/dist/tools/category-search-tool/CategorySearchTool.js +0 -666
- package/dist/tools/category-search-tool/CategorySearchTool.js.map +0 -1
- package/dist/tools/category-search-tool/CategorySearchTool.test.d.ts +0 -2
- package/dist/tools/category-search-tool/CategorySearchTool.test.d.ts.map +0 -1
- package/dist/tools/category-search-tool/CategorySearchTool.test.js +0 -369
- package/dist/tools/category-search-tool/CategorySearchTool.test.js.map +0 -1
- package/dist/tools/directions-tool/DirectionsTool.d.ts.map +0 -1
- package/dist/tools/directions-tool/DirectionsTool.js.map +0 -1
- package/dist/tools/directions-tool/DirectionsTool.test.d.ts +0 -2
- package/dist/tools/directions-tool/DirectionsTool.test.d.ts.map +0 -1
- package/dist/tools/directions-tool/DirectionsTool.test.js +0 -822
- package/dist/tools/directions-tool/DirectionsTool.test.js.map +0 -1
- package/dist/tools/directions-tool/cleanResponseData.d.ts.map +0 -1
- package/dist/tools/directions-tool/cleanResponseData.js.map +0 -1
- package/dist/tools/directions-tool/cleanResponseData.test.d.ts +0 -2
- package/dist/tools/directions-tool/cleanResponseData.test.d.ts.map +0 -1
- package/dist/tools/directions-tool/cleanResponseData.test.js +0 -295
- package/dist/tools/directions-tool/cleanResponseData.test.js.map +0 -1
- package/dist/tools/directions-tool/formatIsoDateTime.d.ts.map +0 -1
- package/dist/tools/directions-tool/formatIsoDateTime.js.map +0 -1
- package/dist/tools/directions-tool/formatIsoDateTime.test.d.ts +0 -2
- package/dist/tools/directions-tool/formatIsoDateTime.test.d.ts.map +0 -1
- package/dist/tools/directions-tool/formatIsoDateTime.test.js +0 -26
- package/dist/tools/directions-tool/formatIsoDateTime.test.js.map +0 -1
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts.map +0 -1
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.js.map +0 -1
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.d.ts +0 -2
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.d.ts.map +0 -1
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.js +0 -415
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.js.map +0 -1
- package/dist/tools/isochrone-tool/IsochroneTool.d.ts.map +0 -1
- package/dist/tools/isochrone-tool/IsochroneTool.js.map +0 -1
- package/dist/tools/isochrone-tool/IsochroneTool.test.d.ts +0 -2
- package/dist/tools/isochrone-tool/IsochroneTool.test.d.ts.map +0 -1
- package/dist/tools/isochrone-tool/IsochroneTool.test.js +0 -111
- package/dist/tools/isochrone-tool/IsochroneTool.test.js.map +0 -1
- package/dist/tools/matrix-tool/MatrixTool.d.ts.map +0 -1
- package/dist/tools/matrix-tool/MatrixTool.test.d.ts +0 -2
- package/dist/tools/matrix-tool/MatrixTool.test.d.ts.map +0 -1
- package/dist/tools/matrix-tool/MatrixTool.test.js +0 -816
- package/dist/tools/matrix-tool/MatrixTool.test.js.map +0 -1
- package/dist/tools/poi-search-tool/PoiSearchTool.d.ts.map +0 -1
- package/dist/tools/poi-search-tool/PoiSearchTool.js.map +0 -1
- package/dist/tools/poi-search-tool/PoiSearchTool.test.d.ts +0 -2
- package/dist/tools/poi-search-tool/PoiSearchTool.test.d.ts.map +0 -1
- package/dist/tools/poi-search-tool/PoiSearchTool.test.js +0 -418
- package/dist/tools/poi-search-tool/PoiSearchTool.test.js.map +0 -1
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts.map +0 -1
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.js.map +0 -1
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.d.ts +0 -2
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.d.ts.map +0 -1
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.js +0 -403
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.js.map +0 -1
- package/dist/tools/schema-validation.test.d.ts +0 -2
- package/dist/tools/schema-validation.test.d.ts.map +0 -1
- package/dist/tools/schema-validation.test.js +0 -75
- package/dist/tools/schema-validation.test.js.map +0 -1
- package/dist/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +0 -1
- package/dist/tools/static-map-image-tool/StaticMapImageTool.js.map +0 -1
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.d.ts +0 -2
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.d.ts.map +0 -1
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.js +0 -441
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.js.map +0 -1
- package/dist/tools/tool-naming-convention.test.d.ts +0 -2
- package/dist/tools/tool-naming-convention.test.d.ts.map +0 -1
- package/dist/tools/tool-naming-convention.test.js +0 -43
- package/dist/tools/tool-naming-convention.test.js.map +0 -1
- package/dist/tools/toolRegistry.d.ts.map +0 -1
- package/dist/tools/toolRegistry.js.map +0 -1
- package/dist/tools/version-tool/VersionTool.d.ts.map +0 -1
- package/dist/tools/version-tool/VersionTool.js.map +0 -1
- package/dist/tools/version-tool/VersionTool.test.d.ts +0 -2
- package/dist/tools/version-tool/VersionTool.test.d.ts.map +0 -1
- package/dist/tools/version-tool/VersionTool.test.js +0 -49
- package/dist/tools/version-tool/VersionTool.test.js.map +0 -1
- package/dist/utils/requestUtils.d.ts +0 -6
- package/dist/utils/requestUtils.d.ts.map +0 -1
- package/dist/utils/requestUtils.js +0 -60
- package/dist/utils/requestUtils.js.map +0 -1
- package/dist/utils/requestUtils.test-helpers.d.ts +0 -3
- package/dist/utils/requestUtils.test-helpers.d.ts.map +0 -1
- package/dist/utils/requestUtils.test-helpers.js +0 -32
- package/dist/utils/requestUtils.test-helpers.js.map +0 -1
- package/dist/utils/requestUtils.test.d.ts +0 -2
- package/dist/utils/requestUtils.test.d.ts.map +0 -1
- package/dist/utils/requestUtils.test.js +0 -115
- package/dist/utils/requestUtils.test.js.map +0 -1
- package/dist/utils/versionUtils.d.ts.map +0 -1
- package/dist/utils/versionUtils.js.map +0 -1
- package/dist/version.json +0 -6
- /package/dist/{tools → commonjs/tools}/directions-tool/cleanResponseData.d.ts +0 -0
- /package/dist/{tools → commonjs/tools}/directions-tool/formatIsoDateTime.d.ts +0 -0
- /package/dist/{tools → esm/tools}/directions-tool/cleanResponseData.js +0 -0
- /package/dist/{tools → esm/tools}/directions-tool/formatIsoDateTime.js +0 -0
- /package/dist/{utils → esm/utils}/versionUtils.d.ts +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CategorySearchTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const MapboxApiBasedTool_js_1 = require("../MapboxApiBasedTool.js");
|
|
6
|
+
const fetchRequest_js_1 = require("../../utils/fetchRequest.js");
|
|
7
|
+
const CategorySearchInputSchema = zod_1.z.object({
|
|
8
|
+
category: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.describe('The canonical category ID to search for (e.g., "restaurant", "hotel", "cafe"). To get the full list of supported categories, use the category_list_tool.'),
|
|
11
|
+
language: zod_1.z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('ISO language code for the response (e.g., "en", "es", "fr", "de", "ja")'),
|
|
15
|
+
limit: zod_1.z
|
|
16
|
+
.number()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(25)
|
|
19
|
+
.optional()
|
|
20
|
+
.default(10)
|
|
21
|
+
.describe('Maximum number of results to return (1-25)'),
|
|
22
|
+
proximity: zod_1.z
|
|
23
|
+
.union([
|
|
24
|
+
zod_1.z.object({
|
|
25
|
+
longitude: zod_1.z.number().min(-180).max(180),
|
|
26
|
+
latitude: zod_1.z.number().min(-90).max(90)
|
|
27
|
+
}),
|
|
28
|
+
zod_1.z.string().transform((val) => {
|
|
29
|
+
// Handle special case of 'ip'
|
|
30
|
+
if (val === 'ip') {
|
|
31
|
+
return 'ip';
|
|
32
|
+
}
|
|
33
|
+
// Handle JSON-stringified object: "{\"longitude\": -82.458107, \"latitude\": 27.937259}"
|
|
34
|
+
if (val.startsWith('{') && val.endsWith('}')) {
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(val);
|
|
37
|
+
if (typeof parsed === 'object' &&
|
|
38
|
+
parsed !== null &&
|
|
39
|
+
typeof parsed.longitude === 'number' &&
|
|
40
|
+
typeof parsed.latitude === 'number') {
|
|
41
|
+
return { longitude: parsed.longitude, latitude: parsed.latitude };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Fall back to other formats
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Handle string that looks like an array: "[-82.451668, 27.942964]"
|
|
49
|
+
if (val.startsWith('[') && val.endsWith(']')) {
|
|
50
|
+
const coords = val
|
|
51
|
+
.slice(1, -1)
|
|
52
|
+
.split(',')
|
|
53
|
+
.map((s) => Number(s.trim()));
|
|
54
|
+
if (coords.length === 2 && !isNaN(coords[0]) && !isNaN(coords[1])) {
|
|
55
|
+
return { longitude: coords[0], latitude: coords[1] };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Handle comma-separated string: "-82.451668,27.942964"
|
|
59
|
+
const parts = val.split(',').map((s) => Number(s.trim()));
|
|
60
|
+
if (parts.length === 2 && !isNaN(parts[0]) && !isNaN(parts[1])) {
|
|
61
|
+
return { longitude: parts[0], latitude: parts[1] };
|
|
62
|
+
}
|
|
63
|
+
throw new Error('Invalid proximity format. Expected {longitude, latitude}, "longitude,latitude", or "ip"');
|
|
64
|
+
})
|
|
65
|
+
])
|
|
66
|
+
.optional()
|
|
67
|
+
.describe('Location to bias results towards. Either coordinate object with longitude and latitude or "ip" for IP-based location'),
|
|
68
|
+
bbox: zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
minLongitude: zod_1.z.number().min(-180).max(180),
|
|
71
|
+
minLatitude: zod_1.z.number().min(-90).max(90),
|
|
72
|
+
maxLongitude: zod_1.z.number().min(-180).max(180),
|
|
73
|
+
maxLatitude: zod_1.z.number().min(-90).max(90)
|
|
74
|
+
})
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Bounding box to limit results within specified bounds'),
|
|
77
|
+
country: zod_1.z
|
|
78
|
+
.array(zod_1.z.string().length(2))
|
|
79
|
+
.optional()
|
|
80
|
+
.describe('Array of ISO 3166 alpha 2 country codes to limit results'),
|
|
81
|
+
poi_category_exclusions: zod_1.z
|
|
82
|
+
.array(zod_1.z.string())
|
|
83
|
+
.optional()
|
|
84
|
+
.describe('Array of POI categories to exclude from results'),
|
|
85
|
+
format: zod_1.z
|
|
86
|
+
.enum(['json_string', 'formatted_text'])
|
|
87
|
+
.optional()
|
|
88
|
+
.default('formatted_text')
|
|
89
|
+
.describe('Output format: "json_string" returns raw GeoJSON data as a JSON string that can be parsed; "formatted_text" returns human-readable text with place names, addresses, and coordinates. Both return as text content but json_string contains parseable JSON data while formatted_text is for display.')
|
|
90
|
+
});
|
|
91
|
+
class CategorySearchTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
|
|
92
|
+
fetch;
|
|
93
|
+
name = 'category_search_tool';
|
|
94
|
+
description = "Return all places that match a category (industry, amenity, or NAICS‑style code). Use when the user asks for a type of place, plural or generic terms like 'museums', 'coffee shops', 'electric‑vehicle chargers', or when the query includes is‑a phrases such as 'any', 'all', 'nearby'. Do not use when a unique name or brand is provided. Supports both JSON and text output formats.";
|
|
95
|
+
constructor(fetch = fetchRequest_js_1.fetchClient) {
|
|
96
|
+
super({ inputSchema: CategorySearchInputSchema });
|
|
97
|
+
this.fetch = fetch;
|
|
98
|
+
}
|
|
99
|
+
formatGeoJsonToText(geoJsonResponse) {
|
|
100
|
+
if (!geoJsonResponse ||
|
|
101
|
+
!geoJsonResponse.features ||
|
|
102
|
+
geoJsonResponse.features.length === 0) {
|
|
103
|
+
return 'No results found. This category might not be valid or no places match the search criteria. Use the category_list_tool to see all available categories.';
|
|
104
|
+
}
|
|
105
|
+
const results = geoJsonResponse.features.map((feature, index) => {
|
|
106
|
+
const props = feature.properties || {};
|
|
107
|
+
const geom = feature.geometry || {};
|
|
108
|
+
let result = `${index + 1}. `;
|
|
109
|
+
// POI name
|
|
110
|
+
result += `${props.name}`;
|
|
111
|
+
if (props.name_preferred) {
|
|
112
|
+
result += ` (${props.name_preferred})`;
|
|
113
|
+
}
|
|
114
|
+
// Full address
|
|
115
|
+
if (props.full_address) {
|
|
116
|
+
result += `\n Address: ${props.full_address}`;
|
|
117
|
+
}
|
|
118
|
+
else if (props.place_formatted) {
|
|
119
|
+
result += `\n Address: ${props.place_formatted}`;
|
|
120
|
+
}
|
|
121
|
+
// Geographic coordinates
|
|
122
|
+
if (geom.coordinates && Array.isArray(geom.coordinates)) {
|
|
123
|
+
const [lng, lat] = geom.coordinates;
|
|
124
|
+
result += `\n Coordinates: ${lat}, ${lng}`;
|
|
125
|
+
}
|
|
126
|
+
// Feature type
|
|
127
|
+
if (props.feature_type) {
|
|
128
|
+
result += `\n Type: ${props.feature_type}`;
|
|
129
|
+
}
|
|
130
|
+
// Category information
|
|
131
|
+
if (props.poi_category && Array.isArray(props.poi_category)) {
|
|
132
|
+
result += `\n Category: ${props.poi_category.join(', ')}`;
|
|
133
|
+
}
|
|
134
|
+
else if (props.category) {
|
|
135
|
+
result += `\n Category: ${props.category}`;
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
});
|
|
139
|
+
return results.join('\n\n');
|
|
140
|
+
}
|
|
141
|
+
async execute(input, accessToken) {
|
|
142
|
+
// Build URL with required parameters
|
|
143
|
+
const url = new URL(`${MapboxApiBasedTool_js_1.MapboxApiBasedTool.mapboxApiEndpoint}search/searchbox/v1/category/${encodeURIComponent(input.category)}`);
|
|
144
|
+
// Add access token
|
|
145
|
+
url.searchParams.append('access_token', accessToken);
|
|
146
|
+
// Add optional parameters
|
|
147
|
+
if (input.language) {
|
|
148
|
+
url.searchParams.append('language', input.language);
|
|
149
|
+
}
|
|
150
|
+
if (input.limit !== undefined) {
|
|
151
|
+
url.searchParams.append('limit', input.limit.toString());
|
|
152
|
+
}
|
|
153
|
+
if (input.proximity) {
|
|
154
|
+
if (input.proximity === 'ip') {
|
|
155
|
+
url.searchParams.append('proximity', 'ip');
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const { longitude, latitude } = input.proximity;
|
|
159
|
+
url.searchParams.append('proximity', `${longitude},${latitude}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (input.bbox) {
|
|
163
|
+
const { minLongitude, minLatitude, maxLongitude, maxLatitude } = input.bbox;
|
|
164
|
+
url.searchParams.append('bbox', `${minLongitude},${minLatitude},${maxLongitude},${maxLatitude}`);
|
|
165
|
+
}
|
|
166
|
+
if (input.country && input.country.length > 0) {
|
|
167
|
+
url.searchParams.append('country', input.country.join(','));
|
|
168
|
+
}
|
|
169
|
+
if (input.poi_category_exclusions &&
|
|
170
|
+
input.poi_category_exclusions.length > 0) {
|
|
171
|
+
url.searchParams.append('poi_category_exclusions', input.poi_category_exclusions.join(','));
|
|
172
|
+
}
|
|
173
|
+
// Make the request
|
|
174
|
+
const response = await this.fetch(url.toString());
|
|
175
|
+
if (!response.ok) {
|
|
176
|
+
throw new Error(`Failed to search category: ${response.status} ${response.statusText}`);
|
|
177
|
+
}
|
|
178
|
+
const data = await response.json();
|
|
179
|
+
if (input.format === 'json_string') {
|
|
180
|
+
return { type: 'text', text: JSON.stringify(data, null, 2) };
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return { type: 'text', text: this.formatGeoJsonToText(data) };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.CategorySearchTool = CategorySearchTool;
|
|
188
|
+
//# sourceMappingURL=CategorySearchTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategorySearchTool.js","sourceRoot":"","sources":["../../../../src/tools/category-search-tool/CategorySearchTool.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oEAA8D;AAC9D,iEAA0D;AAE1D,MAAM,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,QAAQ,CACP,0JAA0J,CAC3J;IACH,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yEAAyE,CAC1E;IACH,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;SACV,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,4CAA4C,CAAC;IACzD,SAAS,EAAE,OAAC;SACT,KAAK,CAAC;QACL,OAAC,CAAC,MAAM,CAAC;YACP,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;YACxC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;SACtC,CAAC;QACF,OAAC,CAA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C,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,IACE,KAAK,CAAC,uBAAuB;YAC7B,KAAK,CAAC,uBAAuB,CAAC,MAAM,GAAG,CAAC,EACxC,CAAC;YACD,GAAG,CAAC,YAAY,CAAC,MAAM,CACrB,yBAAyB,EACzB,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,CACxC,CAAC;QACJ,CAAC;QAED,mBAAmB;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAElD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,8BAA8B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACvE,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEnC,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;YACnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAChE,CAAC;IACH,CAAC;CACF;AAvID,gDAuIC"}
|
|
@@ -35,9 +35,10 @@ export declare const DirectionsInputSchema: z.ZodObject<{
|
|
|
35
35
|
exclude?: string | undefined;
|
|
36
36
|
}>;
|
|
37
37
|
export declare class DirectionsTool extends MapboxApiBasedTool<typeof DirectionsInputSchema> {
|
|
38
|
+
private fetch;
|
|
38
39
|
name: string;
|
|
39
40
|
description: string;
|
|
40
|
-
constructor();
|
|
41
|
-
protected execute(input: z.infer<typeof DirectionsInputSchema
|
|
41
|
+
constructor(fetch?: typeof globalThis.fetch);
|
|
42
|
+
protected execute(input: z.infer<typeof DirectionsInputSchema>, accessToken: string): Promise<any>;
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=DirectionsTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectionsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAwH9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiLhC,CAAC;AACH,qBAAa,cAAe,SAAQ,kBAAkB,CACpD,OAAO,qBAAqB,CAC7B;IAKa,OAAO,CAAC,KAAK;IAJzB,IAAI,SAAqB;IACzB,WAAW,SACgF;gBAEvE,KAAK,GAAE,OAAO,UAAU,CAAC,KAAmB;cAGhD,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,GAAG,CAAC;CAqKhB"}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DirectionsTool = exports.DirectionsInputSchema = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const MapboxApiBasedTool_js_1 = require("../MapboxApiBasedTool.js");
|
|
7
|
+
const cleanResponseData_js_1 = require("./cleanResponseData.js");
|
|
8
|
+
const formatIsoDateTime_js_1 = require("./formatIsoDateTime.js");
|
|
9
|
+
const fetchRequest_js_1 = require("../../utils/fetchRequest.js");
|
|
10
|
+
// Docs: https://docs.mapbox.com/api/navigation/directions/
|
|
11
|
+
/**
|
|
12
|
+
* Validates ISO 8601 date-time formats used by Mapbox Directions API
|
|
13
|
+
* for both depart_at and arrive_by parameters
|
|
14
|
+
*/
|
|
15
|
+
const validateIsoDateTime = (val, ctx) => {
|
|
16
|
+
if (!val)
|
|
17
|
+
return; // Optional, so empty is fine
|
|
18
|
+
// ISO 8601 regex patterns for the valid formats mentioned in the docs
|
|
19
|
+
// 1. YYYY-MM-DDThh:mm:ssZ (exactly one Z at the end)
|
|
20
|
+
// 2. YYYY-MM-DDThh:mm:ss±hh:mm (timezone offset with colon)
|
|
21
|
+
// 3. YYYY-MM-DDThh:mm (no seconds, no timezone)
|
|
22
|
+
// 4. YYYY-MM-DDThh:mm:ss (with seconds but no timezone) - will be converted to format 3
|
|
23
|
+
const iso8601Pattern = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$)|(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$)|(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$)|(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)/;
|
|
24
|
+
if (!iso8601Pattern.test(val)) {
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
27
|
+
message: 'Invalid date-time format. Must be in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, YYYY-MM-DDThh:mm, or YYYY-MM-DDThh:mm:ss',
|
|
28
|
+
path: []
|
|
29
|
+
});
|
|
30
|
+
return; // Stop further validation if format is invalid
|
|
31
|
+
}
|
|
32
|
+
// Parse the date-time components to validate ranges
|
|
33
|
+
try {
|
|
34
|
+
// Extract date and time components
|
|
35
|
+
let dateTimeComponents;
|
|
36
|
+
if (val.includes('Z')) {
|
|
37
|
+
// Format 1: YYYY-MM-DDThh:mm:ssZ
|
|
38
|
+
dateTimeComponents = val.substring(0, val.indexOf('Z')).split('T');
|
|
39
|
+
}
|
|
40
|
+
else if (val.includes('+') || val.includes('-', 10)) {
|
|
41
|
+
// Check for timezone offset (skip the date's hyphens)
|
|
42
|
+
// Format 2: YYYY-MM-DDThh:mmss±hh:mm
|
|
43
|
+
const timezoneSeparatorIndex = Math.max(val.lastIndexOf('+'), val.lastIndexOf('-'));
|
|
44
|
+
dateTimeComponents = val.substring(0, timezoneSeparatorIndex).split('T');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Format 3: YYYY-MM-DDThh:mm
|
|
48
|
+
dateTimeComponents = val.split('T');
|
|
49
|
+
}
|
|
50
|
+
const [datePart, timePart] = dateTimeComponents;
|
|
51
|
+
const [, month, day] = datePart.split('-').map(Number);
|
|
52
|
+
let hours = 0, minutes = 0, seconds = 0;
|
|
53
|
+
if (timePart.includes(':')) {
|
|
54
|
+
const timeParts = timePart.split(':').map(Number);
|
|
55
|
+
hours = timeParts[0];
|
|
56
|
+
minutes = timeParts[1];
|
|
57
|
+
if (timeParts.length > 2)
|
|
58
|
+
seconds = timeParts[2];
|
|
59
|
+
}
|
|
60
|
+
// Validate ranges
|
|
61
|
+
if (month < 1 || month > 12) {
|
|
62
|
+
ctx.addIssue({
|
|
63
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
64
|
+
message: `Invalid month: ${month}. Must be between 1 and 12.`,
|
|
65
|
+
path: []
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Check days in month (simplified - doesn't account for leap years)
|
|
69
|
+
const daysInMonth = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
70
|
+
if (day < 1 || day > daysInMonth[month]) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
73
|
+
message: `Invalid day: ${day}. Must be between 1 and ${daysInMonth[month]} for month ${month}.`,
|
|
74
|
+
path: []
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (hours < 0 || hours > 23) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
80
|
+
message: `Invalid hours: ${hours}. Must be between 0 and 23.`,
|
|
81
|
+
path: []
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (minutes < 0 || minutes > 59) {
|
|
85
|
+
ctx.addIssue({
|
|
86
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
87
|
+
message: `Invalid minutes: ${minutes}. Must be between 0 and 59.`,
|
|
88
|
+
path: []
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (seconds < 0 || seconds > 59) {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
94
|
+
message: `Invalid seconds: ${seconds}. Must be between 0 and 59.`,
|
|
95
|
+
path: []
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
ctx.addIssue({
|
|
101
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
102
|
+
message: `Error parsing date-time components: ${error}`,
|
|
103
|
+
path: []
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
exports.DirectionsInputSchema = zod_1.z.object({
|
|
108
|
+
coordinates: zod_1.z
|
|
109
|
+
.array(zod_1.z
|
|
110
|
+
.array(zod_1.z.number())
|
|
111
|
+
.length(2)
|
|
112
|
+
.refine((coord) => {
|
|
113
|
+
const [lng, lat] = coord;
|
|
114
|
+
return lng >= -180 && lng <= 180 && lat >= -90 && lat <= 90;
|
|
115
|
+
}, {
|
|
116
|
+
message: 'Each coordinate must be [longitude, latitude] where longitude is between -180 and 180, and latitude is between -90 and 90'
|
|
117
|
+
}))
|
|
118
|
+
.min(2, 'At least two coordinate pairs are required.')
|
|
119
|
+
.max(25, 'Up to 25 coordinate pairs are supported.')
|
|
120
|
+
.describe('Array of [longitude, latitude] coordinate pairs to visit in order. ' +
|
|
121
|
+
'Must include at least 2 coordinate pairs (starting and ending points). ' +
|
|
122
|
+
'Up to 25 coordinates total are supported.'),
|
|
123
|
+
routing_profile: zod_1.z
|
|
124
|
+
.enum(['driving-traffic', 'driving', 'walking', 'cycling'])
|
|
125
|
+
.optional()
|
|
126
|
+
.default('driving-traffic')
|
|
127
|
+
.describe('Routing profile for different modes of transport. Options: \n' +
|
|
128
|
+
'- driving-traffic (default): automotive with current traffic conditions\n' +
|
|
129
|
+
'- driving: automotive based on typical traffic\n' +
|
|
130
|
+
'- walking: pedestrian/hiking\n' +
|
|
131
|
+
'- cycling: bicycle'),
|
|
132
|
+
geometries: zod_1.z
|
|
133
|
+
.enum(['none', 'geojson'])
|
|
134
|
+
.optional()
|
|
135
|
+
.default('none')
|
|
136
|
+
.describe('The format of the returned geometry. Options: \n' +
|
|
137
|
+
'- none (default): no geometry object is returned at all, use this if you do not need all of the intermediate coordinates.\n' +
|
|
138
|
+
'- geojson: as GeoJSON LineString (might be very long as there could be a lot of points)'),
|
|
139
|
+
max_height: zod_1.z
|
|
140
|
+
.number()
|
|
141
|
+
.min(0, 'Vehicle height must be between 0 and 10 meters')
|
|
142
|
+
.max(10, 'Vehicle height must be between 0 and 10 meters')
|
|
143
|
+
.optional()
|
|
144
|
+
.describe('The max vehicle height, in meters. The Directions API will compute a route that includes only roads ' +
|
|
145
|
+
'with a height limit greater than or equal to the max vehicle height. ' +
|
|
146
|
+
'Must be between 0 and 10 meters. The default value is 1.6 meters. ' +
|
|
147
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
148
|
+
max_width: zod_1.z
|
|
149
|
+
.number()
|
|
150
|
+
.min(0, 'Vehicle width must be between 0 and 10 meters')
|
|
151
|
+
.max(10, 'Vehicle width must be between 0 and 10 meters')
|
|
152
|
+
.optional()
|
|
153
|
+
.describe('The max vehicle width, in meters. The Directions API will compute a route that includes only roads ' +
|
|
154
|
+
'with a width limit greater than or equal to the max vehicle width. ' +
|
|
155
|
+
'Must be between 0 and 10 meters. The default value is 1.9 meters. ' +
|
|
156
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
157
|
+
max_weight: zod_1.z
|
|
158
|
+
.number()
|
|
159
|
+
.min(0, 'Vehicle weight must be between 0 and 100 metric tons')
|
|
160
|
+
.max(100, 'Vehicle weight must be between 0 and 100 metric tons')
|
|
161
|
+
.optional()
|
|
162
|
+
.describe('The max vehicle weight, in metric tons (1000 kg). The Directions API will compute a route that includes only roads ' +
|
|
163
|
+
'with a weight limit greater than or equal to the max vehicle weight. ' +
|
|
164
|
+
'Must be between 0 and 100 metric tons. The default value is 2.5 metric tons. ' +
|
|
165
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
166
|
+
alternatives: zod_1.z
|
|
167
|
+
.boolean()
|
|
168
|
+
.optional()
|
|
169
|
+
.default(false)
|
|
170
|
+
.describe('Whether to try to return alternative routes (true) or not (false, default). ' +
|
|
171
|
+
'Up to two alternatives may be returned.'),
|
|
172
|
+
depart_at: zod_1.z
|
|
173
|
+
.string()
|
|
174
|
+
.optional()
|
|
175
|
+
.superRefine(validateIsoDateTime)
|
|
176
|
+
.describe('The departure time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm). ' +
|
|
177
|
+
'This parameter is only available for the driving and driving-traffic profiles. ' +
|
|
178
|
+
'The travel time will be calculated based on historical and real-time traffic data.'),
|
|
179
|
+
arrive_by: zod_1.z
|
|
180
|
+
.string()
|
|
181
|
+
.optional()
|
|
182
|
+
.superRefine(validateIsoDateTime)
|
|
183
|
+
.describe('The desired arrival time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm). ' +
|
|
184
|
+
'This parameter is only available for the driving profile and is not supported by other profiles, not even driving-traffic. ' +
|
|
185
|
+
'The travel time will be calculated based on historical and real-time traffic data.'),
|
|
186
|
+
exclude: zod_1.z
|
|
187
|
+
.string()
|
|
188
|
+
.optional()
|
|
189
|
+
.superRefine((val, ctx) => {
|
|
190
|
+
if (!val)
|
|
191
|
+
return; // Optional, so empty is fine
|
|
192
|
+
const items = val.split(',').map((item) => item.trim());
|
|
193
|
+
for (const item of items) {
|
|
194
|
+
// Check if it's a point exclusion
|
|
195
|
+
if (item.startsWith('point(') && item.endsWith(')')) {
|
|
196
|
+
const coordStr = item.substring(6, item.length - 1).trim();
|
|
197
|
+
const [lngStr, latStr] = coordStr.split(' ');
|
|
198
|
+
// Validate both parts exist
|
|
199
|
+
if (!lngStr || !latStr) {
|
|
200
|
+
ctx.addIssue({
|
|
201
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
202
|
+
message: `Invalid point format in exclude parameter: '${item}'. Format should be point(<lng> <lat>)`,
|
|
203
|
+
path: []
|
|
204
|
+
});
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
// Parse and validate longitude
|
|
208
|
+
const lng = Number(lngStr);
|
|
209
|
+
if (isNaN(lng) || lng < -180 || lng > 180) {
|
|
210
|
+
ctx.addIssue({
|
|
211
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
212
|
+
message: `Invalid longitude in exclude parameter: '${lngStr}'. Must be a number between -180 and 180`,
|
|
213
|
+
path: []
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
// Parse and validate latitude
|
|
217
|
+
const lat = Number(latStr);
|
|
218
|
+
if (isNaN(lat) || lat < -90 || lat > 90) {
|
|
219
|
+
ctx.addIssue({
|
|
220
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
221
|
+
message: `Invalid latitude in exclude parameter: '${latStr}'. Must be a number between -90 and 90`,
|
|
222
|
+
path: []
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Check if it's one of the enum values
|
|
227
|
+
else if (![
|
|
228
|
+
'toll',
|
|
229
|
+
'cash_only_tolls',
|
|
230
|
+
'motorway',
|
|
231
|
+
'ferry',
|
|
232
|
+
'unpaved',
|
|
233
|
+
'tunnel',
|
|
234
|
+
'country_border',
|
|
235
|
+
'state_border'
|
|
236
|
+
].includes(item)) {
|
|
237
|
+
ctx.addIssue({
|
|
238
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
239
|
+
message: `Invalid exclude option: '${item}'. Available options are: toll, motorway, ferry, unpaved, tunnel, country_border, state_border, or point(<lng> <lat>)`,
|
|
240
|
+
path: []
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
.describe('Whether to exclude certain road types and custom locations from routing. ' +
|
|
246
|
+
'Multiple values can be specified as a comma-separated list. ' +
|
|
247
|
+
'Available options:\n' +
|
|
248
|
+
'- All profiles: ferry, cash_only_tolls\n' +
|
|
249
|
+
'- Driving/Driving-traffic profiles only: motorway, toll, unpaved, tunnel, country_border, state_border or point(<lng> <lat>)\n' +
|
|
250
|
+
'For custom locations you can use Point exclusions (note lng and lat are space separated and at most 50 points are allowed)\n' +
|
|
251
|
+
'Note: country_border excludes all controlled country borders; borders within the Schengen Area are not excluded.')
|
|
252
|
+
});
|
|
253
|
+
class DirectionsTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
|
|
254
|
+
fetch;
|
|
255
|
+
name = 'directions_tool';
|
|
256
|
+
description = 'Fetches directions from Mapbox API based on provided coordinates and direction method.';
|
|
257
|
+
constructor(fetch = fetchRequest_js_1.fetchClient) {
|
|
258
|
+
super({ inputSchema: exports.DirectionsInputSchema });
|
|
259
|
+
this.fetch = fetch;
|
|
260
|
+
}
|
|
261
|
+
async execute(input, accessToken) {
|
|
262
|
+
// Validate exclude parameter against the actual routing_profile
|
|
263
|
+
// This is needed because some exclusions are only driving specific
|
|
264
|
+
if (input.exclude) {
|
|
265
|
+
const commonExclusions = ['ferry', 'cash_only_tolls'];
|
|
266
|
+
const drivingOnlyExclusions = [
|
|
267
|
+
'toll',
|
|
268
|
+
'motorway',
|
|
269
|
+
'unpaved',
|
|
270
|
+
'tunnel',
|
|
271
|
+
'country_border',
|
|
272
|
+
'state_border'
|
|
273
|
+
];
|
|
274
|
+
const isDrivingProfile = input.routing_profile === 'driving-traffic' ||
|
|
275
|
+
input.routing_profile === 'driving';
|
|
276
|
+
const items = input.exclude.split(',').map((item) => item.trim());
|
|
277
|
+
for (const item of items) {
|
|
278
|
+
// Check for point exclusions
|
|
279
|
+
if (item.startsWith('point(') &&
|
|
280
|
+
item.endsWith(')') &&
|
|
281
|
+
!isDrivingProfile) {
|
|
282
|
+
throw new Error(`Point exclusions (${item}) are only available for 'driving' and 'driving-traffic' profiles`);
|
|
283
|
+
}
|
|
284
|
+
// Check for driving-only exclusions
|
|
285
|
+
else if (drivingOnlyExclusions.includes(item) && !isDrivingProfile) {
|
|
286
|
+
throw new Error(`Exclusion option '${item}' is only available for 'driving' and 'driving-traffic' profiles`);
|
|
287
|
+
}
|
|
288
|
+
// Check if it's one of the valid enum values
|
|
289
|
+
else if (!commonExclusions.includes(item) &&
|
|
290
|
+
!drivingOnlyExclusions.includes(item) &&
|
|
291
|
+
!(item.startsWith('point(') && item.endsWith(')'))) {
|
|
292
|
+
throw new Error(`Invalid exclude option: '${item}'.Available options:\n` +
|
|
293
|
+
'- All profiles: ferry, cash_only_tolls\n' +
|
|
294
|
+
'- Driving/Driving-traffic profiles only: `motorway`, `toll`, `unpaved`, `tunnel`, `country_border`, `state_border` or `point(<lng> <lat>)` for custom locations (note lng and lat are space separated)\n');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const isDrivingProfile = input.routing_profile === 'driving-traffic' ||
|
|
299
|
+
input.routing_profile === 'driving';
|
|
300
|
+
// Validate depart_at is only used with driving profiles
|
|
301
|
+
if (input.depart_at && !isDrivingProfile) {
|
|
302
|
+
throw new Error(`The depart_at parameter is only available for 'driving' and 'driving-traffic' profiles`);
|
|
303
|
+
}
|
|
304
|
+
// Validate arrive_by is only used with driving profile (not driving-traffic)
|
|
305
|
+
if (input.arrive_by && input.routing_profile !== 'driving') {
|
|
306
|
+
throw new Error(`The arrive_by parameter is only available for the 'driving' profile`);
|
|
307
|
+
}
|
|
308
|
+
// Validate that depart_at and arrive_by are not used together
|
|
309
|
+
if (input.depart_at && input.arrive_by) {
|
|
310
|
+
throw new Error(`The depart_at and arrive_by parameters cannot be used together in the same request`);
|
|
311
|
+
}
|
|
312
|
+
// Validate vehicle dimension parameters are only used with driving profiles
|
|
313
|
+
if ((input.max_height !== undefined ||
|
|
314
|
+
input.max_width !== undefined ||
|
|
315
|
+
input.max_weight !== undefined) &&
|
|
316
|
+
!isDrivingProfile) {
|
|
317
|
+
throw new Error(`Vehicle dimension parameters (max_height, max_width, max_weight) are only available for 'driving' and 'driving-traffic' profiles`);
|
|
318
|
+
}
|
|
319
|
+
const joined = input.coordinates
|
|
320
|
+
.map(([lng, lat]) => `${lng},${lat}`)
|
|
321
|
+
.join(';');
|
|
322
|
+
const encodedCoords = encodeURIComponent(joined);
|
|
323
|
+
// Build query parameters
|
|
324
|
+
const queryParams = new url_1.URLSearchParams();
|
|
325
|
+
queryParams.append('access_token', accessToken);
|
|
326
|
+
// Only add geometries parameter if not 'none'
|
|
327
|
+
if (input.geometries !== 'none') {
|
|
328
|
+
queryParams.append('geometries', input.geometries);
|
|
329
|
+
}
|
|
330
|
+
queryParams.append('alternatives', input.alternatives.toString());
|
|
331
|
+
// Add annotations parameter
|
|
332
|
+
if (input.routing_profile === 'driving-traffic') {
|
|
333
|
+
// congestion is available only when driving
|
|
334
|
+
queryParams.append('annotations', 'distance,congestion,speed');
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
queryParams.append('annotations', 'distance,speed');
|
|
338
|
+
}
|
|
339
|
+
// For annotations to work, overview must be set to 'full'
|
|
340
|
+
queryParams.append('overview', 'full');
|
|
341
|
+
// Add depart_at or arrive_by parameter if provided, converting format if needed
|
|
342
|
+
if (input.depart_at) {
|
|
343
|
+
const formattedDateTime = (0, formatIsoDateTime_js_1.formatIsoDateTime)(input.depart_at);
|
|
344
|
+
queryParams.append('depart_at', formattedDateTime);
|
|
345
|
+
}
|
|
346
|
+
else if (input.arrive_by) {
|
|
347
|
+
const formattedDateTime = (0, formatIsoDateTime_js_1.formatIsoDateTime)(input.arrive_by);
|
|
348
|
+
queryParams.append('arrive_by', formattedDateTime);
|
|
349
|
+
}
|
|
350
|
+
// Add vehicle dimension parameters if provided
|
|
351
|
+
if (input.max_height !== undefined) {
|
|
352
|
+
queryParams.append('max_height', input.max_height.toString());
|
|
353
|
+
}
|
|
354
|
+
if (input.max_width !== undefined) {
|
|
355
|
+
queryParams.append('max_width', input.max_width.toString());
|
|
356
|
+
}
|
|
357
|
+
if (input.max_weight !== undefined) {
|
|
358
|
+
queryParams.append('max_weight', input.max_weight.toString());
|
|
359
|
+
}
|
|
360
|
+
queryParams.append('steps', 'true');
|
|
361
|
+
let queryString = queryParams.toString();
|
|
362
|
+
// Add exclude parameter if provided (ensuring proper encoding of special characters)
|
|
363
|
+
if (input.exclude) {
|
|
364
|
+
// Custom encoding function to match the expected format in tests
|
|
365
|
+
const customEncodeForExclude = (str) => {
|
|
366
|
+
return str
|
|
367
|
+
.replace(/,/g, '%2C') // Encode comma
|
|
368
|
+
.replace(/\(/g, '%28') // Encode opening parenthesis
|
|
369
|
+
.replace(/\)/g, '%29') // Encode closing parenthesis
|
|
370
|
+
.replace(/ /g, '%20'); // Encode space as %20, not +
|
|
371
|
+
};
|
|
372
|
+
const excludeEncoded = customEncodeForExclude(input.exclude);
|
|
373
|
+
queryString += `&exclude=${excludeEncoded}`;
|
|
374
|
+
}
|
|
375
|
+
const url = `${MapboxApiBasedTool_js_1.MapboxApiBasedTool.mapboxApiEndpoint}directions/v5/mapbox/${input.routing_profile}/${encodedCoords}?${queryString}`;
|
|
376
|
+
const response = await this.fetch(url);
|
|
377
|
+
if (!response.ok) {
|
|
378
|
+
throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
|
|
379
|
+
}
|
|
380
|
+
const data = await response.json();
|
|
381
|
+
return (0, cleanResponseData_js_1.cleanResponseData)(input, data);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
exports.DirectionsTool = DirectionsTool;
|
|
385
|
+
//# sourceMappingURL=DirectionsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectionsTool.js","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":";;;AAAA,6BAAsC;AACtC,6BAAwB;AACxB,oEAA8D;AAC9D,iEAA2D;AAC3D,iEAA2D;AAC3D,iEAA0D;AAE1D,2DAA2D;AAE3D;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAC1B,GAAuB,EACvB,GAAoB,EACd,EAAE;IACR,IAAI,CAAC,GAAG;QAAE,OAAO,CAAC,6BAA6B;IAE/C,sEAAsE;IACtE,qDAAqD;IACrD,4DAA4D;IAC5D,gDAAgD;IAChD,wFAAwF;IACxF,MAAM,cAAc,GAClB,wKAAwK,CAAC;IAE3K,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EACL,gJAAgJ;YAClJ,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,OAAO,CAAC,+CAA+C;IACzD,CAAC;IAED,oDAAoD;IACpD,IAAI,CAAC;QACH,mCAAmC;QACnC,IAAI,kBAA4B,CAAC;QAEjC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,iCAAiC;YACjC,kBAAkB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC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