@mapbox/mcp-server 0.12.6 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.d.ts +3 -2
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.d.ts.map +1 -1
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.js +5 -3
- package/dist/commonjs/resources/ui-apps/DirectionsAppUIResource.js.map +1 -1
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.d.ts +20 -8
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.d.ts.map +1 -1
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.js +198 -18
- package/dist/commonjs/resources/ui-apps/directionsAppHtml.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.js +6 -2
- package/dist/commonjs/tools/directions-tool/DirectionsTool.input.schema.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js +52 -109
- package/dist/commonjs/tools/directions-tool/DirectionsTool.js.map +1 -1
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.d.ts +29 -0
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.js +63 -0
- package/dist/commonjs/tools/directions-tool/buildDirectionsRequestUrl.js.map +1 -0
- package/dist/commonjs/version.json +3 -3
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.d.ts +3 -2
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.d.ts.map +1 -1
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.js +5 -3
- package/dist/esm/resources/ui-apps/DirectionsAppUIResource.js.map +1 -1
- package/dist/esm/resources/ui-apps/directionsAppHtml.d.ts +20 -8
- package/dist/esm/resources/ui-apps/directionsAppHtml.d.ts.map +1 -1
- package/dist/esm/resources/ui-apps/directionsAppHtml.js +198 -18
- package/dist/esm/resources/ui-apps/directionsAppHtml.js.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.d.ts.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.js +6 -2
- package/dist/esm/tools/directions-tool/DirectionsTool.input.schema.js.map +1 -1
- package/dist/esm/tools/directions-tool/DirectionsTool.js +52 -109
- package/dist/esm/tools/directions-tool/DirectionsTool.js.map +1 -1
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.d.ts +29 -0
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.js +60 -0
- package/dist/esm/tools/directions-tool/buildDirectionsRequestUrl.js.map +1 -0
- package/dist/esm/version.json +3 -3
- package/package.json +1 -1
|
@@ -9,8 +9,9 @@ import type { HttpRequest } from '../../utils/types.js';
|
|
|
9
9
|
* event and renders the route from `structuredContent.routes[0]`.
|
|
10
10
|
*
|
|
11
11
|
* The legacy MCP-UI pathway (inline `rawHtml` on the tool result) uses the
|
|
12
|
-
* same HTML template via `renderDirectionsAppHtml` with
|
|
13
|
-
* tool-execute time
|
|
12
|
+
* same HTML template via `renderDirectionsAppHtml` with the call's input
|
|
13
|
+
* params baked in at tool-execute time; the iframe self-fetches the route
|
|
14
|
+
* from the Directions API using those params.
|
|
14
15
|
*/
|
|
15
16
|
export declare class DirectionsAppUIResource extends BaseResource {
|
|
16
17
|
readonly name = "Directions App UI";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionsAppUIResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/DirectionsAppUIResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD
|
|
1
|
+
{"version":3,"file":"DirectionsAppUIResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/DirectionsAppUIResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD;;;;;;;;;;GAUG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,GAAG,2CAA2C;IACvD,QAAQ,CAAC,WAAW,2FACsE;IAC1F,QAAQ,CAAC,QAAQ,+BAAsB;IAEvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;gBAE/B,MAAM,EAAE;QAClB,WAAW,EAAE,WAAW,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;KAC5B;IAQK,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAC7D,OAAO,CAAC,kBAAkB,CAAC;CAwC/B"}
|
|
@@ -14,8 +14,9 @@ const directionsAppHtml_js_1 = require("./directionsAppHtml.js");
|
|
|
14
14
|
* event and renders the route from `structuredContent.routes[0]`.
|
|
15
15
|
*
|
|
16
16
|
* The legacy MCP-UI pathway (inline `rawHtml` on the tool result) uses the
|
|
17
|
-
* same HTML template via `renderDirectionsAppHtml` with
|
|
18
|
-
* tool-execute time
|
|
17
|
+
* same HTML template via `renderDirectionsAppHtml` with the call's input
|
|
18
|
+
* params baked in at tool-execute time; the iframe self-fetches the route
|
|
19
|
+
* from the Directions API using those params.
|
|
19
20
|
*/
|
|
20
21
|
class DirectionsAppUIResource extends BaseResource_js_1.BaseResource {
|
|
21
22
|
name = 'Directions App UI';
|
|
@@ -41,7 +42,8 @@ class DirectionsAppUIResource extends BaseResource_js_1.BaseResource {
|
|
|
41
42
|
httpRequest: this.httpRequest
|
|
42
43
|
});
|
|
43
44
|
const html = (0, directionsAppHtml_js_1.renderDirectionsAppHtml)({
|
|
44
|
-
publicToken: publicToken ?? ''
|
|
45
|
+
publicToken: publicToken ?? '',
|
|
46
|
+
apiEndpoint: this.apiEndpoint()
|
|
45
47
|
});
|
|
46
48
|
return {
|
|
47
49
|
contents: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionsAppUIResource.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/DirectionsAppUIResource.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAQlC,kEAA2E;AAC3E,wDAAkD;AAElD,2EAA4E;AAC5E,iEAAiE;AAEjE
|
|
1
|
+
{"version":3,"file":"DirectionsAppUIResource.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/DirectionsAppUIResource.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAQlC,kEAA2E;AAC3E,wDAAkD;AAElD,2EAA4E;AAC5E,iEAAiE;AAEjE;;;;;;;;;;GAUG;AACH,MAAa,uBAAwB,SAAQ,8BAAY;IAC9C,IAAI,GAAG,mBAAmB,CAAC;IAC3B,GAAG,GAAG,uCAAuC,CAAC;IAC9C,WAAW,GAClB,uFAAuF,CAAC;IACjF,QAA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
|
|
@@ -11,22 +11,34 @@
|
|
|
11
11
|
*
|
|
12
12
|
* 2. **Legacy MCP-UI spec** — `directions_tool` inlines a `rawHtml`
|
|
13
13
|
* UIResource into its content array (gated by `isMcpUiEnabled()`). The
|
|
14
|
-
* HTML is generated at tool-execute time with the
|
|
15
|
-
* baked in as an `initialData` script block
|
|
16
|
-
*
|
|
14
|
+
* HTML is generated at tool-execute time with the call's input params
|
|
15
|
+
* baked in as an `initialData` script block; the iframe uses those params
|
|
16
|
+
* to self-fetch the route from the Directions API, so it never depends on
|
|
17
|
+
* the host delivering the tool result.
|
|
17
18
|
*
|
|
18
19
|
* One source of truth for the rendering logic; two slim entry conditions.
|
|
19
20
|
*/
|
|
20
21
|
export declare const MAPBOX_GL_VERSION = "3.12.0";
|
|
22
|
+
export interface DirectionsAppInitialParams {
|
|
23
|
+
coordinates: {
|
|
24
|
+
longitude: number;
|
|
25
|
+
latitude: number;
|
|
26
|
+
}[];
|
|
27
|
+
routing_profile?: string;
|
|
28
|
+
alternatives?: boolean;
|
|
29
|
+
exclude?: string;
|
|
30
|
+
depart_at?: string;
|
|
31
|
+
arrive_by?: string;
|
|
32
|
+
max_height?: number;
|
|
33
|
+
max_width?: number;
|
|
34
|
+
max_weight?: number;
|
|
35
|
+
}
|
|
21
36
|
export interface DirectionsAppInitialData {
|
|
22
|
-
|
|
23
|
-
type: string;
|
|
24
|
-
coordinates: [number, number][];
|
|
25
|
-
};
|
|
26
|
-
summary?: string;
|
|
37
|
+
params: DirectionsAppInitialParams;
|
|
27
38
|
}
|
|
28
39
|
export declare function renderDirectionsAppHtml(params: {
|
|
29
40
|
publicToken: string;
|
|
41
|
+
apiEndpoint: string;
|
|
30
42
|
glVersion?: string;
|
|
31
43
|
initialData?: DirectionsAppInitialData;
|
|
32
44
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directionsAppHtml.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"directionsAppHtml.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,0BAA0B,CAAC;CACpC;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC,GAAG,MAAM,CAmmBT"}
|
|
@@ -17,15 +17,16 @@ exports.renderDirectionsAppHtml = renderDirectionsAppHtml;
|
|
|
17
17
|
*
|
|
18
18
|
* 2. **Legacy MCP-UI spec** — `directions_tool` inlines a `rawHtml`
|
|
19
19
|
* UIResource into its content array (gated by `isMcpUiEnabled()`). The
|
|
20
|
-
* HTML is generated at tool-execute time with the
|
|
21
|
-
* baked in as an `initialData` script block
|
|
22
|
-
*
|
|
20
|
+
* HTML is generated at tool-execute time with the call's input params
|
|
21
|
+
* baked in as an `initialData` script block; the iframe uses those params
|
|
22
|
+
* to self-fetch the route from the Directions API, so it never depends on
|
|
23
|
+
* the host delivering the tool result.
|
|
23
24
|
*
|
|
24
25
|
* One source of truth for the rendering logic; two slim entry conditions.
|
|
25
26
|
*/
|
|
26
27
|
exports.MAPBOX_GL_VERSION = '3.12.0';
|
|
27
28
|
function renderDirectionsAppHtml(params) {
|
|
28
|
-
const { publicToken, initialData } = params;
|
|
29
|
+
const { publicToken, apiEndpoint, initialData } = params;
|
|
29
30
|
const glVersion = params.glVersion ?? exports.MAPBOX_GL_VERSION;
|
|
30
31
|
const initialDataScript = initialData
|
|
31
32
|
? `<script id="initial-data" type="application/json">${escapeForScript(JSON.stringify(initialData))}</script>`
|
|
@@ -72,6 +73,7 @@ ${initialDataScript}
|
|
|
72
73
|
<script>
|
|
73
74
|
(function() {
|
|
74
75
|
var TOKEN = ${JSON.stringify(publicToken)};
|
|
76
|
+
var API_ENDPOINT = ${JSON.stringify(apiEndpoint)};
|
|
75
77
|
|
|
76
78
|
var loadingEl = document.getElementById('loading');
|
|
77
79
|
var errorEl = document.getElementById('error');
|
|
@@ -84,6 +86,159 @@ ${initialDataScript}
|
|
|
84
86
|
// Track markers across re-renders so we can remove them before drawing the
|
|
85
87
|
// next route — otherwise a second tool-result delivery stacks pins.
|
|
86
88
|
var routeMarkers = [];
|
|
89
|
+
// One render "cycle" per tool call delivered to this iframe. A new
|
|
90
|
+
// tool-input (or baked initial-data) delivery starts a new cycle by
|
|
91
|
+
// bumping \`generation\`; async callbacks that captured an older value are
|
|
92
|
+
// stale and must not touch the UI. This dedupes self-fetch vs tool-result
|
|
93
|
+
// within one call WITHOUT permanently blocking later calls that reuse
|
|
94
|
+
// this same iframe instance.
|
|
95
|
+
var generation = 0;
|
|
96
|
+
var renderedGeneration = -1; // generation whose route is on screen (-1 = none)
|
|
97
|
+
var selfFetchGeneration = -1; // generation that started a self-fetch (-1 = none)
|
|
98
|
+
|
|
99
|
+
// -------------------------------------------------------------------------
|
|
100
|
+
// Self-fetch: build a Directions API request directly from the tool call's
|
|
101
|
+
// input parameters and fetch the route ourselves, so this map never
|
|
102
|
+
// depends on the tool response carrying geometries="geojson".
|
|
103
|
+
//
|
|
104
|
+
// Mirrors src/tools/directions-tool/buildDirectionsRequestUrl.ts — kept in
|
|
105
|
+
// sync by the parity test in
|
|
106
|
+
// test/tools/directions-tool/directionsUrlParity.test.ts. Always forces
|
|
107
|
+
// geometries=geojson regardless of what the tool call itself requested.
|
|
108
|
+
// -------------------------------------------------------------------------
|
|
109
|
+
function formatIsoDateTimeClient(dateTime) {
|
|
110
|
+
var noTzWithSeconds = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/;
|
|
111
|
+
if (noTzWithSeconds.test(dateTime)) {
|
|
112
|
+
return dateTime.substring(0, dateTime.lastIndexOf(':'));
|
|
113
|
+
}
|
|
114
|
+
return dateTime;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function encodeExcludeClient(value) {
|
|
118
|
+
return value
|
|
119
|
+
.replace(/,/g, '%2C')
|
|
120
|
+
.replace(/\\(/g, '%28')
|
|
121
|
+
.replace(/\\)/g, '%29')
|
|
122
|
+
.replace(/ /g, '%20');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function buildDirectionsApiUrl(params, publicToken, apiEndpoint) {
|
|
126
|
+
var coords = params.coordinates
|
|
127
|
+
.map(function(c) { return c.longitude + ',' + c.latitude; })
|
|
128
|
+
.join(';');
|
|
129
|
+
var encodedCoords = encodeURIComponent(coords);
|
|
130
|
+
var profile = params.routing_profile || 'mapbox/driving-traffic';
|
|
131
|
+
|
|
132
|
+
var qp = new URLSearchParams();
|
|
133
|
+
qp.append('access_token', publicToken);
|
|
134
|
+
qp.append('geometries', 'geojson');
|
|
135
|
+
qp.append('alternatives', params.alternatives ? 'true' : 'false');
|
|
136
|
+
qp.append(
|
|
137
|
+
'annotations',
|
|
138
|
+
profile === 'mapbox/driving-traffic'
|
|
139
|
+
? 'distance,congestion,speed'
|
|
140
|
+
: 'distance,speed'
|
|
141
|
+
);
|
|
142
|
+
qp.append('overview', 'full');
|
|
143
|
+
|
|
144
|
+
if (params.depart_at) {
|
|
145
|
+
qp.append('depart_at', formatIsoDateTimeClient(params.depart_at));
|
|
146
|
+
} else if (params.arrive_by) {
|
|
147
|
+
qp.append('arrive_by', formatIsoDateTimeClient(params.arrive_by));
|
|
148
|
+
}
|
|
149
|
+
if (params.max_height !== undefined && params.max_height !== null) {
|
|
150
|
+
qp.append('max_height', String(params.max_height));
|
|
151
|
+
}
|
|
152
|
+
if (params.max_width !== undefined && params.max_width !== null) {
|
|
153
|
+
qp.append('max_width', String(params.max_width));
|
|
154
|
+
}
|
|
155
|
+
if (params.max_weight !== undefined && params.max_weight !== null) {
|
|
156
|
+
qp.append('max_weight', String(params.max_weight));
|
|
157
|
+
}
|
|
158
|
+
qp.append('steps', 'true');
|
|
159
|
+
|
|
160
|
+
var queryString = qp.toString();
|
|
161
|
+
if (params.exclude) {
|
|
162
|
+
queryString += '&exclude=' + encodeExcludeClient(params.exclude);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return apiEndpoint + 'directions/v5/' + profile + '/' + encodedCoords + '?' + queryString;
|
|
166
|
+
}
|
|
167
|
+
// Exposed so the parity test (Node vm sandbox) can call this in isolation.
|
|
168
|
+
window.__buildDirectionsApiUrl = buildDirectionsApiUrl;
|
|
169
|
+
|
|
170
|
+
// Params arrive via postMessage and are untrusted: they get interpolated
|
|
171
|
+
// into the request URL, so validate the pieces our encoding does not
|
|
172
|
+
// neutralize. routing_profile is spliced into the URL path unencoded, and
|
|
173
|
+
// encodeExcludeClient only escapes ',', '(', ')' and spaces — characters
|
|
174
|
+
// like '&' or '../' path segments would otherwise let a hostile sibling
|
|
175
|
+
// frame reshape the request. Server-side input is zod-validated before it
|
|
176
|
+
// reaches buildDirectionsRequestUrl; this mirrors those guarantees for
|
|
177
|
+
// the client copy.
|
|
178
|
+
function isSafeDirectionsParams(params) {
|
|
179
|
+
if (!params || !Array.isArray(params.coordinates)) return false;
|
|
180
|
+
if (params.coordinates.length < 2) return false;
|
|
181
|
+
for (var i = 0; i < params.coordinates.length; i++) {
|
|
182
|
+
var c = params.coordinates[i];
|
|
183
|
+
if (!c || typeof c.longitude !== 'number' || !isFinite(c.longitude)) return false;
|
|
184
|
+
if (typeof c.latitude !== 'number' || !isFinite(c.latitude)) return false;
|
|
185
|
+
}
|
|
186
|
+
if (params.routing_profile !== undefined && params.routing_profile !== null) {
|
|
187
|
+
if (typeof params.routing_profile !== 'string') return false;
|
|
188
|
+
if (!/^mapbox\\/[a-z-]+$/.test(params.routing_profile)) return false;
|
|
189
|
+
}
|
|
190
|
+
if (params.exclude !== undefined && params.exclude !== null) {
|
|
191
|
+
if (typeof params.exclude !== 'string') return false;
|
|
192
|
+
if (!/^[A-Za-z0-9_,.() -]+$/.test(params.exclude)) return false;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function fetchRouteFromDirectionsApi(params) {
|
|
198
|
+
// Every delivery (tool-input notification or baked initial-data) starts
|
|
199
|
+
// a new render cycle, even when the guard below prevents the fetch from
|
|
200
|
+
// actually running — the new call must still invalidate the previous
|
|
201
|
+
// cycle's in-flight callbacks and error-suppression state.
|
|
202
|
+
generation++;
|
|
203
|
+
if (!TOKEN || !isSafeDirectionsParams(params)) return;
|
|
204
|
+
var gen = generation; // captured by the callbacks below
|
|
205
|
+
selfFetchGeneration = gen; // marked only when the fetch actually proceeds
|
|
206
|
+
var url = buildDirectionsApiUrl(params, TOKEN, API_ENDPOINT);
|
|
207
|
+
fetch(url)
|
|
208
|
+
.then(function(res) {
|
|
209
|
+
if (!res.ok) {
|
|
210
|
+
return res
|
|
211
|
+
.json()
|
|
212
|
+
.catch(function() { return null; })
|
|
213
|
+
.then(function(body) {
|
|
214
|
+
var msg =
|
|
215
|
+
body && body.message
|
|
216
|
+
? body.message
|
|
217
|
+
: 'Directions API error (' + res.status + ')';
|
|
218
|
+
throw new Error(msg);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return res.json();
|
|
222
|
+
})
|
|
223
|
+
.then(function(data) {
|
|
224
|
+
if (gen !== generation) return; // stale: a newer call started
|
|
225
|
+
if (renderedGeneration === gen) return; // cycle already drawn (tool-result won)
|
|
226
|
+
var route = data && data.routes && data.routes[0];
|
|
227
|
+
var picked = route ? pickRouteGeometry(route) : null;
|
|
228
|
+
if (picked) {
|
|
229
|
+
renderRoute(picked);
|
|
230
|
+
} else {
|
|
231
|
+
showError('Directions API returned no route.');
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
.catch(function(err) {
|
|
235
|
+
if (gen !== generation) return;
|
|
236
|
+
if (renderedGeneration === gen) return;
|
|
237
|
+
showError(
|
|
238
|
+
'Could not fetch route: ' + (err && err.message ? err.message : err)
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
87
242
|
|
|
88
243
|
// -------------------------------------------------------------------------
|
|
89
244
|
// MCP App postMessage protocol (skipped silently in MCP-UI rawHtml mode)
|
|
@@ -107,6 +262,14 @@ ${initialDataScript}
|
|
|
107
262
|
}
|
|
108
263
|
|
|
109
264
|
window.addEventListener('message', function(event) {
|
|
265
|
+
// Only the embedding host (parent frame) is a legitimate sender. Any
|
|
266
|
+
// frame in the page can obtain this window's reference and postMessage
|
|
267
|
+
// crafted notifications; pinning the source window blocks that while
|
|
268
|
+
// staying host-agnostic — the host's origin is unknowable at
|
|
269
|
+
// HTML-generation time, so an origin allowlist isn't possible for a
|
|
270
|
+
// portable MCP App. (Standalone/top-level, window.parent === window,
|
|
271
|
+
// so self-posted messages still work for manual testing.)
|
|
272
|
+
if (event.source !== window.parent) return;
|
|
110
273
|
var message = event.data;
|
|
111
274
|
if (!message || typeof message !== 'object') return;
|
|
112
275
|
|
|
@@ -117,6 +280,9 @@ ${initialDataScript}
|
|
|
117
280
|
else handlers.resolve(message.result);
|
|
118
281
|
return;
|
|
119
282
|
}
|
|
283
|
+
if (message.method === 'ui/notifications/tool-input' && message.params) {
|
|
284
|
+
fetchRouteFromDirectionsApi(message.params.arguments);
|
|
285
|
+
}
|
|
120
286
|
if (message.method === 'ui/notifications/tool-result' && message.params) {
|
|
121
287
|
handleToolResult(message.params);
|
|
122
288
|
}
|
|
@@ -180,31 +346,32 @@ ${initialDataScript}
|
|
|
180
346
|
initMap();
|
|
181
347
|
|
|
182
348
|
// -------------------------------------------------------------------------
|
|
183
|
-
// Initial data path (MCP-UI rawHtml):
|
|
184
|
-
//
|
|
349
|
+
// Initial data path (MCP-UI rawHtml): the tool call's input params were
|
|
350
|
+
// baked in server-side. Self-fetch the route from the Directions API
|
|
351
|
+
// rather than relying on baked-in geometry from the tool response.
|
|
185
352
|
// -------------------------------------------------------------------------
|
|
186
353
|
function consumeInitialData() {
|
|
187
354
|
var el = document.getElementById('initial-data');
|
|
188
355
|
if (!el || !el.textContent) return;
|
|
189
356
|
try {
|
|
190
357
|
var data = JSON.parse(el.textContent);
|
|
191
|
-
if (!data || !data.
|
|
192
|
-
|
|
193
|
-
var route = pickRouteGeometry({
|
|
194
|
-
geometry: data.geometry,
|
|
195
|
-
distance: data.distance,
|
|
196
|
-
duration: data.duration
|
|
197
|
-
});
|
|
198
|
-
if (route) {
|
|
199
|
-
if (data.summary) route.summary = data.summary;
|
|
200
|
-
drawRoute(route);
|
|
201
|
-
}
|
|
358
|
+
if (!data || !data.params) return;
|
|
359
|
+
fetchRouteFromDirectionsApi(data.params);
|
|
202
360
|
} catch (_) { /* ignore */ }
|
|
203
361
|
}
|
|
204
362
|
|
|
205
363
|
function handleToolResult(result) {
|
|
364
|
+
// A tool-result that isn't paired with this cycle's self-fetch (no
|
|
365
|
+
// tool-input was delivered for it — e.g. hosts that only send
|
|
366
|
+
// tool-result) represents a new tool call, so it starts its own render
|
|
367
|
+
// cycle. A paired result belongs to the cycle its tool-input opened;
|
|
368
|
+
// bumping for it would wrongly invalidate the in-flight self-fetch.
|
|
369
|
+
if (selfFetchGeneration !== generation) generation++;
|
|
206
370
|
var route = extractRoute(result);
|
|
207
371
|
if (route) {
|
|
372
|
+
// Authoritative geometry: always (re)render — drawRoute removes the
|
|
373
|
+
// previous route's layers/markers, which is what lets a host reuse
|
|
374
|
+
// one iframe across sequential directions_tool calls.
|
|
208
375
|
renderRoute(route);
|
|
209
376
|
return;
|
|
210
377
|
}
|
|
@@ -215,28 +382,39 @@ ${initialDataScript}
|
|
|
215
382
|
// MCP Apps host resources/read bridge.
|
|
216
383
|
var tempUri = findTempResourceUri(result);
|
|
217
384
|
if (tempUri) {
|
|
385
|
+
var gen = generation;
|
|
218
386
|
loadingEl.textContent = 'Fetching full route…';
|
|
219
387
|
sendRequest('resources/read', { uri: tempUri }).then(
|
|
220
388
|
function(rr) {
|
|
389
|
+
if (gen !== generation) return; // stale: a newer call started
|
|
221
390
|
var fetched = readResourceJson(rr);
|
|
222
391
|
var fetchedRoute = fetched ? extractRoute({ structuredContent: fetched }) : null;
|
|
223
392
|
if (fetchedRoute) {
|
|
224
393
|
renderRoute(fetchedRoute);
|
|
225
|
-
} else {
|
|
394
|
+
} else if (renderedGeneration !== gen) {
|
|
226
395
|
showError('Could not parse route from the temporary resource.');
|
|
227
396
|
}
|
|
228
397
|
},
|
|
229
398
|
function(err) {
|
|
399
|
+
if (gen !== generation || renderedGeneration === gen) return;
|
|
230
400
|
showError('Could not read temporary resource: ' + (err && err.message ? err.message : err));
|
|
231
401
|
}
|
|
232
402
|
);
|
|
233
403
|
return;
|
|
234
404
|
}
|
|
235
405
|
|
|
406
|
+
// No geometry in this result. Suppress the hard error only when this
|
|
407
|
+
// cycle's self-fetch is handling it (in flight, already rendered, or it
|
|
408
|
+
// already reported its own error via its .catch() handler). An unpaired
|
|
409
|
+
// result opened a fresh cycle above, so a route left over from an
|
|
410
|
+
// earlier call never suppresses this error.
|
|
411
|
+
if (selfFetchGeneration === generation) return;
|
|
412
|
+
|
|
236
413
|
showError('Could not find route data in tool result.');
|
|
237
414
|
}
|
|
238
415
|
|
|
239
416
|
function renderRoute(route) {
|
|
417
|
+
renderedGeneration = generation;
|
|
240
418
|
if (route.summary) {
|
|
241
419
|
summaryEl.textContent = route.summary;
|
|
242
420
|
summaryEl.style.display = 'block';
|
|
@@ -392,6 +570,8 @@ ${initialDataScript}
|
|
|
392
570
|
return;
|
|
393
571
|
}
|
|
394
572
|
|
|
573
|
+
errorEl.style.display = 'none';
|
|
574
|
+
|
|
395
575
|
if (route.summary && summaryEl.style.display === 'none') {
|
|
396
576
|
summaryEl.textContent = route.summary;
|
|
397
577
|
summaryEl.style.display = 'block';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directionsAppHtml.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;
|
|
1
|
+
{"version":3,"file":"directionsAppHtml.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/directionsAppHtml.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAyClC,0DAwmBC;AA/oBD;;;;;;;;;;;;;;;;;;;GAmBG;AAEU,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAkB1C,SAAgB,uBAAuB,CAAC,MAKvC;IACC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IACzD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,yBAAiB,CAAC;IAExD,MAAM,iBAAiB,GAAG,WAAW;QACnC,CAAC,CAAC,qDAAqD,eAAe,CAClE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAC5B,WAAW;QACd,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;;mDAM0C,SAAS;oDACR,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B3D,iBAAiB;;;;gBAIH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;uBACpB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8iB1C,CAAC;AACT,CAAC;AAED,SAAS,eAAe,CAAC,CAAS;IAChC,qEAAqE;IACrE,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DirectionsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,wBAAwB,EAEzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASzD,qBAAa,cAAe,SAAQ,kBAAkB,CACpD,OAAO,qBAAqB,EAC5B,OAAO,wBAAwB,CAChC;IACC,IAAI,SAAqB;IACzB,WAAW,SAM+B;IAC1C,WAAW;;;;;;MAMT;IACF,QAAQ,CAAC,IAAI;;;;;;;;MAQX;gBAEU,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;cAOhC,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC;CAyQ3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionsTool.input.schema.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.input.schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoHxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DirectionsTool.input.schema.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.input.schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoHxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;iBAsKhC,CAAC"}
|
|
@@ -122,8 +122,12 @@ exports.DirectionsInputSchema = zod_1.z.object({
|
|
|
122
122
|
.optional()
|
|
123
123
|
.default('none')
|
|
124
124
|
.describe('The format of the returned geometry. Options: \n' +
|
|
125
|
-
'- none (default): no geometry object is returned
|
|
126
|
-
'
|
|
125
|
+
'- none (default): no geometry object is returned in the response. The map preview UI ' +
|
|
126
|
+
'still renders the route on its own; use this whenever you do not need the raw ' +
|
|
127
|
+
'coordinates yourself.\n' +
|
|
128
|
+
'- geojson: as GeoJSON LineString (might be very long as there could be a lot of ' +
|
|
129
|
+
'points). Only needed when you (the caller) require the coordinates directly — not ' +
|
|
130
|
+
'required for the map preview to work.'),
|
|
127
131
|
max_height: zod_1.z
|
|
128
132
|
.number()
|
|
129
133
|
.min(0, 'Vehicle height must be between 0 and 10 meters')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionsTool.input.schema.js","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.input.schema.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6BAAwB;AACxB,uDAA0E;AAE1E;;;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,C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G,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;YAChC,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,OAAO,EAAE,oBAAoB,OAAO,6BAA6B;gBACjE,IAAI,EAAE,EAAE;aACT,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,uCAAuC,KAAK,EAAE;YACvD,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,OAAC;SACX,KAAK,CAAC,4BAAgB,CAAC;SACvB,GAAG,CAAC,CAAC,EAAE,6CAA6C,CAAC;SACrD,GAAG,CAAC,EAAE,EAAE,0CAA0C,CAAC;SACnD,QAAQ,CACP,wFAAwF;QACtF,yEAAyE;QACzE,2CAA2C,CAC9C;IACH,eAAe,EAAE,yBAAa;SAC3B,QAAQ,EAAE;SACV,OAAO,CAAC,wBAAwB,CAAC;SACjC,QAAQ,CACP,+DAA+D;QAC7D,kFAAkF;QAClF,yDAAyD;QACzD,uCAAuC;QACvC,2BAA2B,CAC9B;IACH,UAAU,EAAE,OAAC;SACV,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;SACzB,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CACP,kDAAkD;QAChD,
|
|
1
|
+
{"version":3,"file":"DirectionsTool.input.schema.js","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.input.schema.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6BAAwB;AACxB,uDAA0E;AAE1E;;;GAGG;AACH,MAAM,mBAA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