@mapbox/mcp-server 0.0.2 → 0.1.1-dev.2
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 +26 -1
- package/dist/cjs/package.json +3 -0
- package/dist/esm/package.json +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/MapboxApiBasedTool.d.ts +75 -0
- package/dist/tools/MapboxApiBasedTool.d.ts.map +1 -0
- package/dist/tools/MapboxApiBasedTool.js +78 -0
- package/dist/tools/MapboxApiBasedTool.js.map +1 -0
- package/dist/tools/category-search-tool/CategorySearchTool.d.ts +39 -0
- package/dist/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -0
- package/dist/tools/category-search-tool/CategorySearchTool.js +638 -0
- package/dist/tools/category-search-tool/CategorySearchTool.js.map +1 -0
- package/dist/tools/category-search-tool/CategorySearchTool.test.d.ts +2 -0
- package/dist/tools/category-search-tool/CategorySearchTool.test.d.ts.map +1 -0
- package/dist/tools/category-search-tool/CategorySearchTool.test.js +289 -0
- package/dist/tools/category-search-tool/CategorySearchTool.test.js.map +1 -0
- package/dist/tools/directions-tool/DirectionsTool.d.ts +53 -0
- package/dist/tools/directions-tool/DirectionsTool.d.ts.map +1 -0
- package/dist/tools/directions-tool/DirectionsTool.js +405 -0
- package/dist/tools/directions-tool/DirectionsTool.js.map +1 -0
- package/dist/tools/directions-tool/DirectionsTool.test.d.ts +2 -0
- package/dist/tools/directions-tool/DirectionsTool.test.d.ts.map +1 -0
- package/dist/tools/directions-tool/DirectionsTool.test.js +867 -0
- package/dist/tools/directions-tool/DirectionsTool.test.js.map +1 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts +51 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.d.ts.map +1 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.js +182 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.js.map +1 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.d.ts +2 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.d.ts.map +1 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.js +335 -0
- package/dist/tools/forward-geocode-tool/ForwardGeocodeTool.test.js.map +1 -0
- package/dist/tools/isochrone-tool/IsochroneTool.d.ts +44 -0
- package/dist/tools/isochrone-tool/IsochroneTool.d.ts.map +1 -0
- package/dist/tools/isochrone-tool/IsochroneTool.js +108 -0
- package/dist/tools/isochrone-tool/IsochroneTool.js.map +1 -0
- package/dist/tools/isochrone-tool/IsochroneTool.test.d.ts +2 -0
- package/dist/tools/isochrone-tool/IsochroneTool.test.d.ts.map +1 -0
- package/dist/tools/isochrone-tool/IsochroneTool.test.js +110 -0
- package/dist/tools/isochrone-tool/IsochroneTool.test.js.map +1 -0
- package/dist/tools/matrix-tool/MatrixTool.d.ts +35 -0
- package/dist/tools/matrix-tool/MatrixTool.d.ts.map +1 -0
- package/dist/tools/matrix-tool/MatrixTool.js +195 -0
- package/dist/tools/matrix-tool/MatrixTool.js.map +1 -0
- package/dist/tools/matrix-tool/MatrixTool.test.d.ts +2 -0
- package/dist/tools/matrix-tool/MatrixTool.test.d.ts.map +1 -0
- package/dist/tools/matrix-tool/MatrixTool.test.js +803 -0
- package/dist/tools/matrix-tool/MatrixTool.test.js.map +1 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.d.ts +54 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.d.ts.map +1 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.js +193 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.js.map +1 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.test.d.ts +2 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.test.d.ts.map +1 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.test.js +338 -0
- package/dist/tools/poi-search-tool/PoiSearchTool.test.js.map +1 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts +42 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.d.ts.map +1 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.js +131 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.js.map +1 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.d.ts +2 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.d.ts.map +1 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.js +340 -0
- package/dist/tools/reverse-geocode-tool/ReverseGeocodeTool.test.js.map +1 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.d.ts +148 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.js +406 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.d.ts +2 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.d.ts.map +1 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.js +440 -0
- package/dist/tools/static-map-image-tool/StaticMapImageTool.test.js.map +1 -0
- package/dist/utils/requestUtils.d.ts +6 -0
- package/dist/utils/requestUtils.d.ts.map +1 -0
- package/dist/utils/requestUtils.js +29 -0
- package/dist/utils/requestUtils.js.map +1 -0
- package/dist/utils/requestUtils.test-helpers.d.ts +3 -0
- package/dist/utils/requestUtils.test-helpers.d.ts.map +1 -0
- package/dist/utils/requestUtils.test-helpers.js +28 -0
- package/dist/utils/requestUtils.test-helpers.js.map +1 -0
- package/dist/utils/versionUtils.d.ts +9 -0
- package/dist/utils/versionUtils.d.ts.map +1 -0
- package/dist/utils/versionUtils.js +25 -0
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/version.json +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { URLSearchParams } from 'url';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { MapboxApiBasedTool } from '../MapboxApiBasedTool.js';
|
|
4
|
+
// Docs: https://docs.mapbox.com/api/navigation/directions/
|
|
5
|
+
/**
|
|
6
|
+
* Validates ISO 8601 date-time formats used by Mapbox Directions API
|
|
7
|
+
* for both depart_at and arrive_by parameters
|
|
8
|
+
*/
|
|
9
|
+
const validateIsoDateTime = (val, ctx) => {
|
|
10
|
+
if (!val)
|
|
11
|
+
return; // Optional, so empty is fine
|
|
12
|
+
// ISO 8601 regex patterns for the three formats mentioned in the docs
|
|
13
|
+
// 1. YYYY-MM-DDThh:mm:ssZ (exactly one Z at the end)
|
|
14
|
+
// 2. YYYY-MM-DDThh:mm:ss±hh:mm (timezone offset with colon)
|
|
15
|
+
// 3. YYYY-MM-DDThh:mm (no seconds, no timezone)
|
|
16
|
+
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}$)/;
|
|
17
|
+
if (!iso8601Pattern.test(val)) {
|
|
18
|
+
ctx.addIssue({
|
|
19
|
+
code: z.ZodIssueCode.custom,
|
|
20
|
+
message: 'Invalid date-time format. Must be in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm',
|
|
21
|
+
path: []
|
|
22
|
+
});
|
|
23
|
+
return; // Stop further validation if format is invalid
|
|
24
|
+
}
|
|
25
|
+
// Parse the date-time components to validate ranges
|
|
26
|
+
try {
|
|
27
|
+
// Extract date and time components
|
|
28
|
+
let dateTimeComponents;
|
|
29
|
+
let timezonePart = '';
|
|
30
|
+
if (val.includes('Z')) {
|
|
31
|
+
// Format 1: YYYY-MM-DDThh:mm:ssZ
|
|
32
|
+
dateTimeComponents = val.substring(0, val.indexOf('Z')).split('T');
|
|
33
|
+
}
|
|
34
|
+
else if (val.includes('+') || val.includes('-', 10)) {
|
|
35
|
+
// Check for timezone offset (skip the date's hyphens)
|
|
36
|
+
// Format 2: YYYY-MM-DDThh:mmss±hh:mm
|
|
37
|
+
const timezoneSeparatorIndex = Math.max(val.lastIndexOf('+'), val.lastIndexOf('-'));
|
|
38
|
+
dateTimeComponents = val.substring(0, timezoneSeparatorIndex).split('T');
|
|
39
|
+
timezonePart = val.substring(timezoneSeparatorIndex);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Format 3: YYYY-MM-DDThh:mm
|
|
43
|
+
dateTimeComponents = val.split('T');
|
|
44
|
+
}
|
|
45
|
+
const [datePart, timePart] = dateTimeComponents;
|
|
46
|
+
const [year, month, day] = datePart.split('-').map(Number);
|
|
47
|
+
let hours = 0, minutes = 0, seconds = 0;
|
|
48
|
+
if (timePart.includes(':')) {
|
|
49
|
+
const timeParts = timePart.split(':').map(Number);
|
|
50
|
+
hours = timeParts[0];
|
|
51
|
+
minutes = timeParts[1];
|
|
52
|
+
if (timeParts.length > 2)
|
|
53
|
+
seconds = timeParts[2];
|
|
54
|
+
}
|
|
55
|
+
// Validate ranges
|
|
56
|
+
if (month < 1 || month > 12) {
|
|
57
|
+
ctx.addIssue({
|
|
58
|
+
code: z.ZodIssueCode.custom,
|
|
59
|
+
message: `Invalid month: ${month}. Must be between 1 and 12.`,
|
|
60
|
+
path: []
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Check days in month (simplified - doesn't account for leap years)
|
|
64
|
+
const daysInMonth = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
65
|
+
if (day < 1 || day > daysInMonth[month]) {
|
|
66
|
+
ctx.addIssue({
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: `Invalid day: ${day}. Must be between 1 and ${daysInMonth[month]} for month ${month}.`,
|
|
69
|
+
path: []
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (hours < 0 || hours > 23) {
|
|
73
|
+
ctx.addIssue({
|
|
74
|
+
code: z.ZodIssueCode.custom,
|
|
75
|
+
message: `Invalid hours: ${hours}. Must be between 0 and 23.`,
|
|
76
|
+
path: []
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (minutes < 0 || minutes > 59) {
|
|
80
|
+
ctx.addIssue({
|
|
81
|
+
code: z.ZodIssueCode.custom,
|
|
82
|
+
message: `Invalid minutes: ${minutes}. Must be between 0 and 59.`,
|
|
83
|
+
path: []
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (seconds < 0 || seconds > 59) {
|
|
87
|
+
ctx.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
message: `Invalid seconds: ${seconds}. Must be between 0 and 59.`,
|
|
90
|
+
path: []
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
ctx.addIssue({
|
|
96
|
+
code: z.ZodIssueCode.custom,
|
|
97
|
+
message: `Error parsing date-time components: ${error}`,
|
|
98
|
+
path: []
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const DirectionsInputSchema = z.object({
|
|
103
|
+
coordinates: z
|
|
104
|
+
.array(z.tuple([
|
|
105
|
+
z
|
|
106
|
+
.number()
|
|
107
|
+
.min(-180, 'Longitude must be between -180 and 180 degrees')
|
|
108
|
+
.max(180, 'Longitude must be between -180 and 180 degrees'),
|
|
109
|
+
z
|
|
110
|
+
.number()
|
|
111
|
+
.min(-90, 'Latitude must be between -90 and 90 degrees')
|
|
112
|
+
.max(90, 'Latitude must be between -90 and 90 degrees')
|
|
113
|
+
]))
|
|
114
|
+
.min(2, 'At least two coordinate pairs are required.')
|
|
115
|
+
.max(25, 'Up to 25 coordinate pairs are supported.')
|
|
116
|
+
.describe('Array of [longitude, latitude] coordinate pairs to visit in order. ' +
|
|
117
|
+
'Must include at least 2 coordinate pairs (starting and ending points). ' +
|
|
118
|
+
'Up to 25 coordinates total are supported.'),
|
|
119
|
+
routing_profile: z
|
|
120
|
+
.enum(['driving-traffic', 'driving', 'walking', 'cycling'])
|
|
121
|
+
.optional()
|
|
122
|
+
.default('driving-traffic')
|
|
123
|
+
.describe('Routing profile for different modes of transport. Options: \n' +
|
|
124
|
+
'- driving-traffic (default): automotive with current traffic conditions\n' +
|
|
125
|
+
'- driving: automotive based on typical traffic\n' +
|
|
126
|
+
'- walking: pedestrian/hiking\n' +
|
|
127
|
+
'- cycling: bicycle'),
|
|
128
|
+
walking_speed: z
|
|
129
|
+
.number()
|
|
130
|
+
.min(0.14, 'Walking speed must be between 0.14 and 6.94 meters per second')
|
|
131
|
+
.max(6.94, 'Walking speed must be between 0.14 and 6.94 meters per second')
|
|
132
|
+
.optional()
|
|
133
|
+
.describe('The walking speed, in meters per second. Must be between 0.14 m/s (0.5 km/h) and ' +
|
|
134
|
+
'6.94 m/s (25 km/h). Defaults to 1.42 m/s (5.1 km/h). Only available for walking profile.'),
|
|
135
|
+
walkway_bias: z
|
|
136
|
+
.number()
|
|
137
|
+
.min(-1, 'Walkway bias must be between -1 and 1')
|
|
138
|
+
.max(1, 'Walkway bias must be between -1 and 1')
|
|
139
|
+
.optional()
|
|
140
|
+
.describe('A scale from -1 to 1, where -1 biases the route against walkways and 1 biases the ' +
|
|
141
|
+
'route toward walkways. The default is 0, which is neutral. Only available for walking profile.'),
|
|
142
|
+
geometries: z
|
|
143
|
+
.enum(['geojson', 'polyline', 'polyline6'])
|
|
144
|
+
.optional()
|
|
145
|
+
.default('polyline')
|
|
146
|
+
.describe('The format of the returned geometry. Options: \n' +
|
|
147
|
+
'- geojson: as GeoJSON LineString\n' +
|
|
148
|
+
'- polyline (default): a polyline with a precision of five decimal places\n' +
|
|
149
|
+
'- polyline6: a polyline with a precision of six decimal places'),
|
|
150
|
+
max_height: z
|
|
151
|
+
.number()
|
|
152
|
+
.min(0, 'Vehicle height must be between 0 and 10 meters')
|
|
153
|
+
.max(10, 'Vehicle height must be between 0 and 10 meters')
|
|
154
|
+
.optional()
|
|
155
|
+
.describe('The max vehicle height, in meters. The Directions API will compute a route that includes only roads ' +
|
|
156
|
+
'with a height limit greater than or equal to the max vehicle height. ' +
|
|
157
|
+
'Must be between 0 and 10 meters. The default value is 1.6 meters. ' +
|
|
158
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
159
|
+
max_width: z
|
|
160
|
+
.number()
|
|
161
|
+
.min(0, 'Vehicle width must be between 0 and 10 meters')
|
|
162
|
+
.max(10, 'Vehicle width must be between 0 and 10 meters')
|
|
163
|
+
.optional()
|
|
164
|
+
.describe('The max vehicle width, in meters. The Directions API will compute a route that includes only roads ' +
|
|
165
|
+
'with a width limit greater than or equal to the max vehicle width. ' +
|
|
166
|
+
'Must be between 0 and 10 meters. The default value is 1.9 meters. ' +
|
|
167
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
168
|
+
max_weight: z
|
|
169
|
+
.number()
|
|
170
|
+
.min(0, 'Vehicle weight must be between 0 and 100 metric tons')
|
|
171
|
+
.max(100, 'Vehicle weight must be between 0 and 100 metric tons')
|
|
172
|
+
.optional()
|
|
173
|
+
.describe('The max vehicle weight, in metric tons (1000 kg). The Directions API will compute a route that includes only roads ' +
|
|
174
|
+
'with a weight limit greater than or equal to the max vehicle weight. ' +
|
|
175
|
+
'Must be between 0 and 100 metric tons. The default value is 2.5 metric tons. ' +
|
|
176
|
+
'Only available for driving and driving-traffic profiles.'),
|
|
177
|
+
alternatives: z
|
|
178
|
+
.boolean()
|
|
179
|
+
.optional()
|
|
180
|
+
.default(false)
|
|
181
|
+
.describe('Whether to try to return alternative routes (true) or not (false, default). ' +
|
|
182
|
+
'Up to two alternatives may be returned.'),
|
|
183
|
+
annotations: z
|
|
184
|
+
.array(
|
|
185
|
+
// Note: more options are available in the Directions API documentation, not added here for simplicity
|
|
186
|
+
z.enum(['distance', 'duration', 'speed', 'congestion']))
|
|
187
|
+
.optional()
|
|
188
|
+
.describe('Return additional details about the route leg. Options: \n' +
|
|
189
|
+
'- distance: distance in meters between each coordinate pair\n' +
|
|
190
|
+
'- duration: estimated travel time in seconds between points\n' +
|
|
191
|
+
'- speed: average speed in m/s for each coordinate pair\n' +
|
|
192
|
+
'- congestion: traffic congestion level ("severe", "heavy", "moderate", "low")\n'),
|
|
193
|
+
depart_at: z
|
|
194
|
+
.string()
|
|
195
|
+
.optional()
|
|
196
|
+
.superRefine(validateIsoDateTime)
|
|
197
|
+
.describe('The departure time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm). ' +
|
|
198
|
+
'This parameter is only available for the driving and driving-traffic profiles. ' +
|
|
199
|
+
'The travel time will be calculated based on historical and real-time traffic data.'),
|
|
200
|
+
arrive_by: z
|
|
201
|
+
.string()
|
|
202
|
+
.optional()
|
|
203
|
+
.superRefine(validateIsoDateTime)
|
|
204
|
+
.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). ' +
|
|
205
|
+
'This parameter is only available for the driving profile and is not supported by other profiles, not even driving-traffic. ' +
|
|
206
|
+
'The travel time will be calculated based on historical and real-time traffic data.'),
|
|
207
|
+
exclude: z
|
|
208
|
+
.string()
|
|
209
|
+
.optional()
|
|
210
|
+
.superRefine((val, ctx) => {
|
|
211
|
+
if (!val)
|
|
212
|
+
return; // Optional, so empty is fine
|
|
213
|
+
const items = val.split(',').map((item) => item.trim());
|
|
214
|
+
for (const item of items) {
|
|
215
|
+
// Check if it's a point exclusion
|
|
216
|
+
if (item.startsWith('point(') && item.endsWith(')')) {
|
|
217
|
+
const coordStr = item.substring(6, item.length - 1).trim();
|
|
218
|
+
const [lngStr, latStr] = coordStr.split(' ');
|
|
219
|
+
// Validate both parts exist
|
|
220
|
+
if (!lngStr || !latStr) {
|
|
221
|
+
ctx.addIssue({
|
|
222
|
+
code: z.ZodIssueCode.custom,
|
|
223
|
+
message: `Invalid point format in exclude parameter: '${item}'. Format should be point(<lng> <lat>)`,
|
|
224
|
+
path: []
|
|
225
|
+
});
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// Parse and validate longitude
|
|
229
|
+
const lng = Number(lngStr);
|
|
230
|
+
if (isNaN(lng) || lng < -180 || lng > 180) {
|
|
231
|
+
ctx.addIssue({
|
|
232
|
+
code: z.ZodIssueCode.custom,
|
|
233
|
+
message: `Invalid longitude in exclude parameter: '${lngStr}'. Must be a number between -180 and 180`,
|
|
234
|
+
path: []
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// Parse and validate latitude
|
|
238
|
+
const lat = Number(latStr);
|
|
239
|
+
if (isNaN(lat) || lat < -90 || lat > 90) {
|
|
240
|
+
ctx.addIssue({
|
|
241
|
+
code: z.ZodIssueCode.custom,
|
|
242
|
+
message: `Invalid latitude in exclude parameter: '${latStr}'. Must be a number between -90 and 90`,
|
|
243
|
+
path: []
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Check if it's one of the enum values
|
|
248
|
+
else if (![
|
|
249
|
+
'toll',
|
|
250
|
+
'cash_only_tolls',
|
|
251
|
+
'motorway',
|
|
252
|
+
'ferry',
|
|
253
|
+
'unpaved',
|
|
254
|
+
'tunnel',
|
|
255
|
+
'country_border',
|
|
256
|
+
'state_border'
|
|
257
|
+
].includes(item)) {
|
|
258
|
+
ctx.addIssue({
|
|
259
|
+
code: z.ZodIssueCode.custom,
|
|
260
|
+
message: `Invalid exclude option: '${item}'. Available options are: toll, motorway, ferry, unpaved, tunnel, country_border, state_border, or point(<lng> <lat>)`,
|
|
261
|
+
path: []
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
.describe('Whether to exclude certain road types and custom locations from routing. ' +
|
|
267
|
+
'Multiple values can be specified as a comma-separated list. ' +
|
|
268
|
+
'Available options:\n' +
|
|
269
|
+
'- All profiles: ferry, cash_only_tolls\n' +
|
|
270
|
+
'- Driving/Driving-traffic profiles only: motorway, toll, unpaved, tunnel, country_border, state_border or point(<lng> <lat>)\n' +
|
|
271
|
+
'For custom locations you can use Point exclusions (note lng and lat are space separated and at most 50 points are allowed)\n' +
|
|
272
|
+
'Note: country_border excludes all controlled country borders; borders within the Schengen Area are not excluded.')
|
|
273
|
+
});
|
|
274
|
+
export class DirectionsTool extends MapboxApiBasedTool {
|
|
275
|
+
name = 'DirectionsTool';
|
|
276
|
+
description = 'Fetches directions from Mapbox API based on provided coordinates and direction method.';
|
|
277
|
+
constructor() {
|
|
278
|
+
super({ inputSchema: DirectionsInputSchema });
|
|
279
|
+
}
|
|
280
|
+
async execute(input) {
|
|
281
|
+
// Validate exclude parameter against the actual routing_profile
|
|
282
|
+
// This is needed because some exclusions are only driving specific
|
|
283
|
+
if (input.exclude) {
|
|
284
|
+
const commonExclusions = ['ferry', 'cash_only_tolls'];
|
|
285
|
+
const drivingOnlyExclusions = [
|
|
286
|
+
'toll',
|
|
287
|
+
'motorway',
|
|
288
|
+
'unpaved',
|
|
289
|
+
'tunnel',
|
|
290
|
+
'country_border',
|
|
291
|
+
'state_border'
|
|
292
|
+
];
|
|
293
|
+
const isDrivingProfile = input.routing_profile === 'driving-traffic' ||
|
|
294
|
+
input.routing_profile === 'driving';
|
|
295
|
+
const items = input.exclude.split(',').map((item) => item.trim());
|
|
296
|
+
for (const item of items) {
|
|
297
|
+
// Check for point exclusions
|
|
298
|
+
if (item.startsWith('point(') &&
|
|
299
|
+
item.endsWith(')') &&
|
|
300
|
+
!isDrivingProfile) {
|
|
301
|
+
throw new Error(`Point exclusions (${item}) are only available for 'driving' and 'driving-traffic' profiles`);
|
|
302
|
+
}
|
|
303
|
+
// Check for driving-only exclusions
|
|
304
|
+
else if (drivingOnlyExclusions.includes(item) && !isDrivingProfile) {
|
|
305
|
+
throw new Error(`Exclusion option '${item}' is only available for 'driving' and 'driving-traffic' profiles`);
|
|
306
|
+
}
|
|
307
|
+
// Check if it's one of the valid enum values
|
|
308
|
+
else if (!commonExclusions.includes(item) &&
|
|
309
|
+
!drivingOnlyExclusions.includes(item) &&
|
|
310
|
+
!(item.startsWith('point(') && item.endsWith(')'))) {
|
|
311
|
+
throw new Error(`Invalid exclude option: '${item}'.Available options:\n` +
|
|
312
|
+
'- All profiles: ferry, cash_only_tolls\n' +
|
|
313
|
+
'- 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');
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
const isDrivingProfile = input.routing_profile === 'driving-traffic' ||
|
|
318
|
+
input.routing_profile === 'driving';
|
|
319
|
+
// Validate depart_at is only used with driving profiles
|
|
320
|
+
if (input.depart_at && !isDrivingProfile) {
|
|
321
|
+
throw new Error(`The depart_at parameter is only available for 'driving' and 'driving-traffic' profiles`);
|
|
322
|
+
}
|
|
323
|
+
// Validate arrive_by is only used with driving profile (not driving-traffic)
|
|
324
|
+
if (input.arrive_by && input.routing_profile !== 'driving') {
|
|
325
|
+
throw new Error(`The arrive_by parameter is only available for the 'driving' profile`);
|
|
326
|
+
}
|
|
327
|
+
// Validate that depart_at and arrive_by are not used together
|
|
328
|
+
if (input.depart_at && input.arrive_by) {
|
|
329
|
+
throw new Error(`The depart_at and arrive_by parameters cannot be used together in the same request`);
|
|
330
|
+
}
|
|
331
|
+
// Validate vehicle dimension parameters are only used with driving profiles
|
|
332
|
+
if ((input.max_height !== undefined ||
|
|
333
|
+
input.max_width !== undefined ||
|
|
334
|
+
input.max_weight !== undefined) &&
|
|
335
|
+
!isDrivingProfile) {
|
|
336
|
+
throw new Error(`Vehicle dimension parameters (max_height, max_width, max_weight) are only available for 'driving' and 'driving-traffic' profiles`);
|
|
337
|
+
}
|
|
338
|
+
// Validate walking-specific parameters are only used with walking profile
|
|
339
|
+
if ((input.walking_speed !== undefined || input.walkway_bias !== undefined) &&
|
|
340
|
+
input.routing_profile !== 'walking') {
|
|
341
|
+
throw new Error(`Walking parameters (walking_speed, walkway_bias) are only available for the 'walking' profile`);
|
|
342
|
+
}
|
|
343
|
+
const joined = input.coordinates
|
|
344
|
+
.map(([lng, lat]) => `${lng},${lat}`)
|
|
345
|
+
.join(';');
|
|
346
|
+
const encodedCoords = encodeURIComponent(joined);
|
|
347
|
+
// Build query parameters
|
|
348
|
+
const queryParams = new URLSearchParams();
|
|
349
|
+
queryParams.append('access_token', MapboxApiBasedTool.MAPBOX_ACCESS_TOKEN);
|
|
350
|
+
queryParams.append('geometries', input.geometries);
|
|
351
|
+
queryParams.append('alternatives', input.alternatives.toString());
|
|
352
|
+
// Add annotations parameter if provided
|
|
353
|
+
if (input.annotations && input.annotations.length > 0) {
|
|
354
|
+
queryParams.append('annotations', input.annotations.join(','));
|
|
355
|
+
// For annotations to work, overview must be set to 'full'
|
|
356
|
+
queryParams.append('overview', 'full');
|
|
357
|
+
}
|
|
358
|
+
// Add depart_at or arrive_by parameter if provided
|
|
359
|
+
if (input.depart_at) {
|
|
360
|
+
queryParams.append('depart_at', input.depart_at);
|
|
361
|
+
}
|
|
362
|
+
else if (input.arrive_by) {
|
|
363
|
+
queryParams.append('arrive_by', input.arrive_by);
|
|
364
|
+
}
|
|
365
|
+
// Add vehicle dimension parameters if provided
|
|
366
|
+
if (input.max_height !== undefined) {
|
|
367
|
+
queryParams.append('max_height', input.max_height.toString());
|
|
368
|
+
}
|
|
369
|
+
if (input.max_width !== undefined) {
|
|
370
|
+
queryParams.append('max_width', input.max_width.toString());
|
|
371
|
+
}
|
|
372
|
+
if (input.max_weight !== undefined) {
|
|
373
|
+
queryParams.append('max_weight', input.max_weight.toString());
|
|
374
|
+
}
|
|
375
|
+
// Add walking-specific parameters if provided
|
|
376
|
+
if (input.walking_speed !== undefined) {
|
|
377
|
+
queryParams.append('walking_speed', input.walking_speed.toString());
|
|
378
|
+
}
|
|
379
|
+
if (input.walkway_bias !== undefined) {
|
|
380
|
+
queryParams.append('walkway_bias', input.walkway_bias.toString());
|
|
381
|
+
}
|
|
382
|
+
let queryString = queryParams.toString();
|
|
383
|
+
// Add exclude parameter if provided (ensuring proper encoding of special characters)
|
|
384
|
+
if (input.exclude) {
|
|
385
|
+
// Custom encoding function to match the expected format in tests
|
|
386
|
+
const customEncodeForExclude = (str) => {
|
|
387
|
+
return str
|
|
388
|
+
.replace(/,/g, '%2C') // Encode comma
|
|
389
|
+
.replace(/\(/g, '%28') // Encode opening parenthesis
|
|
390
|
+
.replace(/\)/g, '%29') // Encode closing parenthesis
|
|
391
|
+
.replace(/ /g, '%20'); // Encode space as %20, not +
|
|
392
|
+
};
|
|
393
|
+
const excludeEncoded = customEncodeForExclude(input.exclude);
|
|
394
|
+
queryString += `&exclude=${excludeEncoded}`;
|
|
395
|
+
}
|
|
396
|
+
const url = `${MapboxApiBasedTool.MAPBOX_API_ENDPOINT}directions/v5/mapbox/${input.routing_profile}/${encodedCoords}?${queryString}`;
|
|
397
|
+
const response = await fetch(url);
|
|
398
|
+
if (!response.ok) {
|
|
399
|
+
throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
|
|
400
|
+
}
|
|
401
|
+
const data = await response.json();
|
|
402
|
+
return data;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
//# sourceMappingURL=DirectionsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectionsTool.js","sourceRoot":"","sources":["../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,2DAA2D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