@modelcontextprotocol/server-customer-segmentation 1.3.2 → 1.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/dist/index.js +180 -108
- package/dist/mcp-app.html +17 -17
- package/dist/server.js +287 -89
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -4585,6 +4585,7 @@ var require_limitLength = __commonJS((exports) => {
|
|
|
4585
4585
|
var require_pattern = __commonJS((exports) => {
|
|
4586
4586
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4587
4587
|
var code_1 = require_code2();
|
|
4588
|
+
var util_1 = require_util();
|
|
4588
4589
|
var codegen_1 = require_codegen();
|
|
4589
4590
|
var error48 = {
|
|
4590
4591
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
@@ -4597,10 +4598,18 @@ var require_pattern = __commonJS((exports) => {
|
|
|
4597
4598
|
$data: true,
|
|
4598
4599
|
error: error48,
|
|
4599
4600
|
code(cxt) {
|
|
4600
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
4601
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
4601
4602
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4602
|
-
|
|
4603
|
-
|
|
4603
|
+
if ($data) {
|
|
4604
|
+
const { regExp } = it.opts.code;
|
|
4605
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
4606
|
+
const valid = gen.let("valid");
|
|
4607
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
4608
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4609
|
+
} else {
|
|
4610
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
4611
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4612
|
+
}
|
|
4604
4613
|
}
|
|
4605
4614
|
};
|
|
4606
4615
|
exports.default = def;
|
|
@@ -24044,7 +24053,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
|
|
|
24044
24053
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
24045
24054
|
var CursorSchema = string2();
|
|
24046
24055
|
var TaskCreationParamsSchema = looseObject({
|
|
24047
|
-
ttl:
|
|
24056
|
+
ttl: number2().optional(),
|
|
24048
24057
|
pollInterval: number2().optional()
|
|
24049
24058
|
});
|
|
24050
24059
|
var TaskMetadataSchema = object2({
|
|
@@ -24198,7 +24207,8 @@ var ClientCapabilitiesSchema = object2({
|
|
|
24198
24207
|
roots: object2({
|
|
24199
24208
|
listChanged: boolean2().optional()
|
|
24200
24209
|
}).optional(),
|
|
24201
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
24210
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
24211
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24202
24212
|
});
|
|
24203
24213
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
24204
24214
|
protocolVersion: string2(),
|
|
@@ -24223,7 +24233,8 @@ var ServerCapabilitiesSchema = object2({
|
|
|
24223
24233
|
tools: object2({
|
|
24224
24234
|
listChanged: boolean2().optional()
|
|
24225
24235
|
}).optional(),
|
|
24226
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
24236
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
24237
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
24227
24238
|
});
|
|
24228
24239
|
var InitializeResultSchema = ResultSchema.extend({
|
|
24229
24240
|
protocolVersion: string2(),
|
|
@@ -24338,6 +24349,7 @@ var ResourceSchema = object2({
|
|
|
24338
24349
|
uri: string2(),
|
|
24339
24350
|
description: optional(string2()),
|
|
24340
24351
|
mimeType: optional(string2()),
|
|
24352
|
+
size: optional(number2()),
|
|
24341
24353
|
annotations: AnnotationsSchema.optional(),
|
|
24342
24354
|
_meta: optional(looseObject({}))
|
|
24343
24355
|
});
|
|
@@ -26329,6 +26341,9 @@ class Protocol {
|
|
|
26329
26341
|
}
|
|
26330
26342
|
}
|
|
26331
26343
|
async connect(transport) {
|
|
26344
|
+
if (this._transport) {
|
|
26345
|
+
throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
26346
|
+
}
|
|
26332
26347
|
this._transport = transport;
|
|
26333
26348
|
const _onclose = this.transport?.onclose;
|
|
26334
26349
|
this._transport.onclose = () => {
|
|
@@ -26361,6 +26376,14 @@ class Protocol {
|
|
|
26361
26376
|
this._progressHandlers.clear();
|
|
26362
26377
|
this._taskProgressTokens.clear();
|
|
26363
26378
|
this._pendingDebouncedNotifications.clear();
|
|
26379
|
+
for (const info of this._timeoutInfo.values()) {
|
|
26380
|
+
clearTimeout(info.timeoutId);
|
|
26381
|
+
}
|
|
26382
|
+
this._timeoutInfo.clear();
|
|
26383
|
+
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
26384
|
+
controller.abort();
|
|
26385
|
+
}
|
|
26386
|
+
this._requestHandlerAbortControllers.clear();
|
|
26364
26387
|
const error48 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
26365
26388
|
this._transport = undefined;
|
|
26366
26389
|
this.onclose?.();
|
|
@@ -26411,6 +26434,8 @@ class Protocol {
|
|
|
26411
26434
|
sessionId: capturedTransport?.sessionId,
|
|
26412
26435
|
_meta: request.params?._meta,
|
|
26413
26436
|
sendNotification: async (notification) => {
|
|
26437
|
+
if (abortController.signal.aborted)
|
|
26438
|
+
return;
|
|
26414
26439
|
const notificationOptions = { relatedRequestId: request.id };
|
|
26415
26440
|
if (relatedTaskId) {
|
|
26416
26441
|
notificationOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -26418,6 +26443,9 @@ class Protocol {
|
|
|
26418
26443
|
await this.notification(notification, notificationOptions);
|
|
26419
26444
|
},
|
|
26420
26445
|
sendRequest: async (r, resultSchema, options) => {
|
|
26446
|
+
if (abortController.signal.aborted) {
|
|
26447
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
26448
|
+
}
|
|
26421
26449
|
const requestOptions = { ...options, relatedRequestId: request.id };
|
|
26422
26450
|
if (relatedTaskId && !requestOptions.relatedTask) {
|
|
26423
26451
|
requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -26482,7 +26510,9 @@ class Protocol {
|
|
|
26482
26510
|
await capturedTransport?.send(errorResponse);
|
|
26483
26511
|
}
|
|
26484
26512
|
}).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
|
|
26485
|
-
this._requestHandlerAbortControllers.
|
|
26513
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
26514
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
26515
|
+
}
|
|
26486
26516
|
});
|
|
26487
26517
|
}
|
|
26488
26518
|
_onprogress(notification) {
|
|
@@ -27031,6 +27061,62 @@ class ExperimentalServerTasks {
|
|
|
27031
27061
|
requestStream(request, resultSchema, options) {
|
|
27032
27062
|
return this._server.requestStream(request, resultSchema, options);
|
|
27033
27063
|
}
|
|
27064
|
+
createMessageStream(params, options) {
|
|
27065
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
27066
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
27067
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
27068
|
+
}
|
|
27069
|
+
if (params.messages.length > 0) {
|
|
27070
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
27071
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
27072
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
27073
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
27074
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
27075
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
27076
|
+
if (hasToolResults) {
|
|
27077
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
27078
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
27079
|
+
}
|
|
27080
|
+
if (!hasPreviousToolUse) {
|
|
27081
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
27082
|
+
}
|
|
27083
|
+
}
|
|
27084
|
+
if (hasPreviousToolUse) {
|
|
27085
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
27086
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
27087
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
27088
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
27089
|
+
}
|
|
27090
|
+
}
|
|
27091
|
+
}
|
|
27092
|
+
return this.requestStream({
|
|
27093
|
+
method: "sampling/createMessage",
|
|
27094
|
+
params
|
|
27095
|
+
}, CreateMessageResultSchema, options);
|
|
27096
|
+
}
|
|
27097
|
+
elicitInputStream(params, options) {
|
|
27098
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
27099
|
+
const mode = params.mode ?? "form";
|
|
27100
|
+
switch (mode) {
|
|
27101
|
+
case "url": {
|
|
27102
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
27103
|
+
throw new Error("Client does not support url elicitation.");
|
|
27104
|
+
}
|
|
27105
|
+
break;
|
|
27106
|
+
}
|
|
27107
|
+
case "form": {
|
|
27108
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
27109
|
+
throw new Error("Client does not support form elicitation.");
|
|
27110
|
+
}
|
|
27111
|
+
break;
|
|
27112
|
+
}
|
|
27113
|
+
}
|
|
27114
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
27115
|
+
return this.requestStream({
|
|
27116
|
+
method: "elicitation/create",
|
|
27117
|
+
params: normalizedParams
|
|
27118
|
+
}, ElicitResultSchema, options);
|
|
27119
|
+
}
|
|
27034
27120
|
async getTask(taskId, options) {
|
|
27035
27121
|
return this._server.getTask({ taskId }, options);
|
|
27036
27122
|
}
|
|
@@ -28083,6 +28169,9 @@ class McpServer {
|
|
|
28083
28169
|
annotations = rest.shift();
|
|
28084
28170
|
}
|
|
28085
28171
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
28172
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
28173
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
28174
|
+
}
|
|
28086
28175
|
annotations = rest.shift();
|
|
28087
28176
|
}
|
|
28088
28177
|
}
|
|
@@ -28175,6 +28264,9 @@ function getZodSchemaObject(schema) {
|
|
|
28175
28264
|
if (isZodRawShapeCompat(schema)) {
|
|
28176
28265
|
return objectFromShape(schema);
|
|
28177
28266
|
}
|
|
28267
|
+
if (!isZodSchemaInstance(schema)) {
|
|
28268
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
28269
|
+
}
|
|
28178
28270
|
return schema;
|
|
28179
28271
|
}
|
|
28180
28272
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -28224,10 +28316,74 @@ import fs from "node:fs/promises";
|
|
|
28224
28316
|
import path from "node:path";
|
|
28225
28317
|
|
|
28226
28318
|
// ../../node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
|
|
28227
|
-
|
|
28228
|
-
|
|
28319
|
+
class j extends Protocol {
|
|
28320
|
+
_registeredMethods = new Set;
|
|
28321
|
+
_eventSlots = new Map;
|
|
28322
|
+
onEventDispatch(Z, $) {}
|
|
28323
|
+
_ensureEventSlot(Z) {
|
|
28324
|
+
let $ = this._eventSlots.get(Z);
|
|
28325
|
+
if (!$) {
|
|
28326
|
+
let J = this.eventSchemas[Z];
|
|
28327
|
+
if (!J)
|
|
28328
|
+
throw Error(`Unknown event: ${String(Z)}`);
|
|
28329
|
+
$ = { listeners: [] }, this._eventSlots.set(Z, $);
|
|
28330
|
+
let X = J.shape.method.value;
|
|
28331
|
+
this._registeredMethods.add(X);
|
|
28332
|
+
let V = $;
|
|
28333
|
+
super.setNotificationHandler(J, (D) => {
|
|
28334
|
+
let G = D.params;
|
|
28335
|
+
this.onEventDispatch(Z, G), V.onHandler?.(G);
|
|
28336
|
+
for (let L of [...V.listeners])
|
|
28337
|
+
L(G);
|
|
28338
|
+
});
|
|
28339
|
+
}
|
|
28340
|
+
return $;
|
|
28341
|
+
}
|
|
28342
|
+
setEventHandler(Z, $) {
|
|
28343
|
+
let J = this._ensureEventSlot(Z);
|
|
28344
|
+
if (J.onHandler && $)
|
|
28345
|
+
console.warn(`[MCP Apps] on${String(Z)} handler replaced. Use addEventListener("${String(Z)}", …) to add multiple listeners without replacing.`);
|
|
28346
|
+
J.onHandler = $;
|
|
28347
|
+
}
|
|
28348
|
+
getEventHandler(Z) {
|
|
28349
|
+
return this._eventSlots.get(Z)?.onHandler;
|
|
28350
|
+
}
|
|
28351
|
+
addEventListener(Z, $) {
|
|
28352
|
+
this._ensureEventSlot(Z).listeners.push($);
|
|
28353
|
+
}
|
|
28354
|
+
removeEventListener(Z, $) {
|
|
28355
|
+
let J = this._eventSlots.get(Z);
|
|
28356
|
+
if (!J)
|
|
28357
|
+
return;
|
|
28358
|
+
let X = J.listeners.indexOf($);
|
|
28359
|
+
if (X !== -1)
|
|
28360
|
+
J.listeners.splice(X, 1);
|
|
28361
|
+
}
|
|
28362
|
+
setRequestHandler = (Z, $) => {
|
|
28363
|
+
this._assertMethodNotRegistered(Z, "setRequestHandler"), super.setRequestHandler(Z, $);
|
|
28364
|
+
};
|
|
28365
|
+
setNotificationHandler = (Z, $) => {
|
|
28366
|
+
this._assertMethodNotRegistered(Z, "setNotificationHandler"), super.setNotificationHandler(Z, $);
|
|
28367
|
+
};
|
|
28368
|
+
warnIfRequestHandlerReplaced(Z, $, J) {
|
|
28369
|
+
if ($ && J)
|
|
28370
|
+
console.warn(`[MCP Apps] ${Z} handler replaced. Previous handler will no longer be called.`);
|
|
28371
|
+
}
|
|
28372
|
+
replaceRequestHandler = (Z, $) => {
|
|
28373
|
+
let J = Z.shape.method.value;
|
|
28374
|
+
this._registeredMethods.add(J), super.setRequestHandler(Z, $);
|
|
28375
|
+
};
|
|
28376
|
+
_assertMethodNotRegistered(Z, $) {
|
|
28377
|
+
let J = Z.shape.method.value;
|
|
28378
|
+
if (this._registeredMethods.has(J))
|
|
28379
|
+
throw Error(`Handler for "${J}" already registered (via ${$}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);
|
|
28380
|
+
this._registeredMethods.add(J);
|
|
28381
|
+
}
|
|
28382
|
+
}
|
|
28383
|
+
var F = "2026-01-26";
|
|
28384
|
+
var z2 = "ui/notifications/tool-input-partial";
|
|
28229
28385
|
|
|
28230
|
-
class
|
|
28386
|
+
class B {
|
|
28231
28387
|
eventTarget;
|
|
28232
28388
|
eventSource;
|
|
28233
28389
|
messageListener;
|
|
@@ -28252,7 +28408,7 @@ class j {
|
|
|
28252
28408
|
window.addEventListener("message", this.messageListener);
|
|
28253
28409
|
}
|
|
28254
28410
|
async send(Z, $) {
|
|
28255
|
-
if (Z.method !==
|
|
28411
|
+
if (Z.method !== z2)
|
|
28256
28412
|
console.debug("Sending message", Z);
|
|
28257
28413
|
this.eventTarget.postMessage(Z, "*");
|
|
28258
28414
|
}
|
|
@@ -28265,10 +28421,10 @@ class j {
|
|
|
28265
28421
|
sessionId;
|
|
28266
28422
|
setProtocolVersion;
|
|
28267
28423
|
}
|
|
28268
|
-
var
|
|
28269
|
-
var
|
|
28270
|
-
var
|
|
28271
|
-
var
|
|
28424
|
+
var S = exports_external.union([exports_external.literal("light"), exports_external.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
28425
|
+
var W = exports_external.union([exports_external.literal("inline"), exports_external.literal("fullscreen"), exports_external.literal("pip")]).describe("Display mode for UI presentation.");
|
|
28426
|
+
var i = exports_external.union([exports_external.literal("--color-background-primary"), exports_external.literal("--color-background-secondary"), exports_external.literal("--color-background-tertiary"), exports_external.literal("--color-background-inverse"), exports_external.literal("--color-background-ghost"), exports_external.literal("--color-background-info"), exports_external.literal("--color-background-danger"), exports_external.literal("--color-background-success"), exports_external.literal("--color-background-warning"), exports_external.literal("--color-background-disabled"), exports_external.literal("--color-text-primary"), exports_external.literal("--color-text-secondary"), exports_external.literal("--color-text-tertiary"), exports_external.literal("--color-text-inverse"), exports_external.literal("--color-text-ghost"), exports_external.literal("--color-text-info"), exports_external.literal("--color-text-danger"), exports_external.literal("--color-text-success"), exports_external.literal("--color-text-warning"), exports_external.literal("--color-text-disabled"), exports_external.literal("--color-border-primary"), exports_external.literal("--color-border-secondary"), exports_external.literal("--color-border-tertiary"), exports_external.literal("--color-border-inverse"), exports_external.literal("--color-border-ghost"), exports_external.literal("--color-border-info"), exports_external.literal("--color-border-danger"), exports_external.literal("--color-border-success"), exports_external.literal("--color-border-warning"), exports_external.literal("--color-border-disabled"), exports_external.literal("--color-ring-primary"), exports_external.literal("--color-ring-secondary"), exports_external.literal("--color-ring-inverse"), exports_external.literal("--color-ring-info"), exports_external.literal("--color-ring-danger"), exports_external.literal("--color-ring-success"), exports_external.literal("--color-ring-warning"), exports_external.literal("--font-sans"), exports_external.literal("--font-mono"), exports_external.literal("--font-weight-normal"), exports_external.literal("--font-weight-medium"), exports_external.literal("--font-weight-semibold"), exports_external.literal("--font-weight-bold"), exports_external.literal("--font-text-xs-size"), exports_external.literal("--font-text-sm-size"), exports_external.literal("--font-text-md-size"), exports_external.literal("--font-text-lg-size"), exports_external.literal("--font-heading-xs-size"), exports_external.literal("--font-heading-sm-size"), exports_external.literal("--font-heading-md-size"), exports_external.literal("--font-heading-lg-size"), exports_external.literal("--font-heading-xl-size"), exports_external.literal("--font-heading-2xl-size"), exports_external.literal("--font-heading-3xl-size"), exports_external.literal("--font-text-xs-line-height"), exports_external.literal("--font-text-sm-line-height"), exports_external.literal("--font-text-md-line-height"), exports_external.literal("--font-text-lg-line-height"), exports_external.literal("--font-heading-xs-line-height"), exports_external.literal("--font-heading-sm-line-height"), exports_external.literal("--font-heading-md-line-height"), exports_external.literal("--font-heading-lg-line-height"), exports_external.literal("--font-heading-xl-line-height"), exports_external.literal("--font-heading-2xl-line-height"), exports_external.literal("--font-heading-3xl-line-height"), exports_external.literal("--border-radius-xs"), exports_external.literal("--border-radius-sm"), exports_external.literal("--border-radius-md"), exports_external.literal("--border-radius-lg"), exports_external.literal("--border-radius-xl"), exports_external.literal("--border-radius-full"), exports_external.literal("--border-width-regular"), exports_external.literal("--shadow-hairline"), exports_external.literal("--shadow-sm"), exports_external.literal("--shadow-md"), exports_external.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming.");
|
|
28427
|
+
var n = exports_external.record(i.describe(`Style variables for theming MCP apps.
|
|
28272
28428
|
|
|
28273
28429
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
28274
28430
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -28287,30 +28443,30 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
|
28287
28443
|
|
|
28288
28444
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
28289
28445
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
|
|
28290
|
-
var
|
|
28291
|
-
var
|
|
28292
|
-
var
|
|
28293
|
-
var
|
|
28294
|
-
var
|
|
28295
|
-
var
|
|
28446
|
+
var o = exports_external.object({ method: exports_external.literal("ui/open-link"), params: exports_external.object({ url: exports_external.string().describe("URL to open in the host's browser") }) });
|
|
28447
|
+
var O = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough();
|
|
28448
|
+
var I = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough();
|
|
28449
|
+
var w = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
|
|
28450
|
+
var a = exports_external.object({ method: exports_external.literal("ui/notifications/sandbox-proxy-ready"), params: exports_external.object({}) });
|
|
28451
|
+
var K = exports_external.object({ connectDomains: exports_external.array(exports_external.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
28296
28452
|
|
|
28297
28453
|
- Maps to CSP \`connect-src\` directive
|
|
28298
28454
|
- Empty or omitted → no network connections (secure default)`), resourceDomains: exports_external.array(exports_external.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"), frameDomains: exports_external.array(exports_external.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"), baseUriDomains: exports_external.array(exports_external.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)") });
|
|
28299
|
-
var
|
|
28300
|
-
var
|
|
28301
|
-
var
|
|
28302
|
-
var
|
|
28303
|
-
var
|
|
28455
|
+
var N = exports_external.object({ camera: exports_external.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: exports_external.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: exports_external.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: exports_external.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
|
|
28456
|
+
var s = exports_external.object({ method: exports_external.literal("ui/notifications/size-changed"), params: exports_external.object({ width: exports_external.number().optional().describe("New width in pixels."), height: exports_external.number().optional().describe("New height in pixels.") }) });
|
|
28457
|
+
var A = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") }) });
|
|
28458
|
+
var P = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input-partial"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") }) });
|
|
28459
|
+
var H = exports_external.object({ method: exports_external.literal("ui/notifications/tool-cancelled"), params: exports_external.object({ reason: exports_external.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").') }) });
|
|
28304
28460
|
var b = exports_external.object({ fonts: exports_external.string().optional() });
|
|
28305
|
-
var
|
|
28306
|
-
var
|
|
28307
|
-
var
|
|
28308
|
-
var
|
|
28309
|
-
var
|
|
28310
|
-
var
|
|
28311
|
-
var
|
|
28312
|
-
var
|
|
28313
|
-
var
|
|
28461
|
+
var C = exports_external.object({ variables: n.optional().describe("CSS variables for theming the app."), css: b.optional().describe("CSS blocks that apps can inject.") });
|
|
28462
|
+
var _ = exports_external.object({ method: exports_external.literal("ui/resource-teardown"), params: exports_external.object({}) });
|
|
28463
|
+
var t = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
28464
|
+
var q = exports_external.object({ text: exports_external.object({}).optional().describe("Host supports text content blocks."), image: exports_external.object({}).optional().describe("Host supports image content blocks."), audio: exports_external.object({}).optional().describe("Host supports audio content blocks."), resource: exports_external.object({}).optional().describe("Host supports resource content blocks."), resourceLink: exports_external.object({}).optional().describe("Host supports resource link content blocks."), structuredContent: exports_external.object({}).optional().describe("Host supports structured content.") });
|
|
28465
|
+
var e = exports_external.object({ method: exports_external.literal("ui/notifications/request-teardown"), params: exports_external.object({}).optional() });
|
|
28466
|
+
var y = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), openLinks: exports_external.object({}).optional().describe("Host supports opening external URLs."), downloadFile: exports_external.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: exports_external.object({}).optional().describe("Host accepts log messages."), sandbox: exports_external.object({ permissions: N.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: K.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
|
|
28467
|
+
var v = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), tools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: exports_external.array(W).optional().describe("Display modes the app supports.") });
|
|
28468
|
+
var QQ = exports_external.object({ method: exports_external.literal("ui/notifications/initialized"), params: exports_external.object({}).optional() });
|
|
28469
|
+
var ZQ = exports_external.object({ csp: K.optional().describe("Content Security Policy configuration for UI resources."), permissions: N.optional().describe("Sandbox permissions requested by the UI resource."), domain: exports_external.string().optional().describe(`Dedicated origin for view sandbox.
|
|
28314
28470
|
|
|
28315
28471
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
28316
28472
|
|
|
@@ -28325,33 +28481,38 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
28325
28481
|
- \`true\`: request visible border + background
|
|
28326
28482
|
- \`false\`: request no visible border + background
|
|
28327
28483
|
- omitted: host decides border`) });
|
|
28328
|
-
var
|
|
28329
|
-
var
|
|
28330
|
-
var
|
|
28331
|
-
var
|
|
28484
|
+
var $Q = exports_external.object({ method: exports_external.literal("ui/request-display-mode"), params: exports_external.object({ mode: W.describe("The display mode being requested.") }) });
|
|
28485
|
+
var T = exports_external.object({ mode: W.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
28486
|
+
var f = exports_external.union([exports_external.literal("model"), exports_external.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
28487
|
+
var JQ = exports_external.object({ resourceUri: exports_external.string().optional(), visibility: exports_external.array(f).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
28332
28488
|
- "model": Tool visible to and callable by the agent
|
|
28333
28489
|
- "app": Tool callable by the app from this server only`) });
|
|
28334
|
-
var
|
|
28335
|
-
var
|
|
28336
|
-
var
|
|
28337
|
-
var
|
|
28338
|
-
var
|
|
28339
|
-
var E = exports_external.object({ toolInfo: exports_external.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme:
|
|
28490
|
+
var UQ = exports_external.object({ mimeTypes: exports_external.array(exports_external.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
|
|
28491
|
+
var XQ = exports_external.object({ method: exports_external.literal("ui/download-file"), params: exports_external.object({ contents: exports_external.array(exports_external.union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") }) });
|
|
28492
|
+
var VQ = exports_external.object({ method: exports_external.literal("ui/message"), params: exports_external.object({ role: exports_external.literal("user").describe('Message role, currently only "user" is supported.'), content: exports_external.array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).") }) });
|
|
28493
|
+
var DQ = exports_external.object({ method: exports_external.literal("ui/notifications/sandbox-resource-ready"), params: exports_external.object({ html: exports_external.string().describe("HTML content to load into the inner iframe."), sandbox: exports_external.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: K.optional().describe("CSP configuration from resource metadata."), permissions: N.optional().describe("Sandbox permissions from resource metadata.") }) });
|
|
28494
|
+
var R = exports_external.object({ method: exports_external.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
|
|
28495
|
+
var E = exports_external.object({ toolInfo: exports_external.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: S.optional().describe("Current color theme preference."), styles: C.optional().describe("Style configuration for theming the app."), displayMode: W.optional().describe("How the UI is currently displayed."), availableDisplayModes: exports_external.array(W).optional().describe("Display modes the host supports."), containerDimensions: exports_external.union([exports_external.object({ height: exports_external.number().describe("Fixed container height in pixels.") }), exports_external.object({ maxHeight: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(exports_external.union([exports_external.object({ width: exports_external.number().describe("Fixed container width in pixels.") }), exports_external.object({ maxWidth: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
28340
28496
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`), locale: exports_external.string().optional().describe("User's language and region preference in BCP 47 format."), timeZone: exports_external.string().optional().describe("User's timezone in IANA format."), userAgent: exports_external.string().optional().describe("Host application identifier."), platform: exports_external.union([exports_external.literal("web"), exports_external.literal("desktop"), exports_external.literal("mobile")]).optional().describe("Platform type for responsive design decisions."), deviceCapabilities: exports_external.object({ touch: exports_external.boolean().optional().describe("Whether the device supports touch input."), hover: exports_external.boolean().optional().describe("Whether the device supports hover interactions.") }).optional().describe("Device input capabilities."), safeAreaInsets: exports_external.object({ top: exports_external.number().describe("Top safe area inset in pixels."), right: exports_external.number().describe("Right safe area inset in pixels."), bottom: exports_external.number().describe("Bottom safe area inset in pixels."), left: exports_external.number().describe("Left safe area inset in pixels.") }).optional().describe("Mobile safe area boundaries in pixels.") }).passthrough();
|
|
28341
|
-
var
|
|
28342
|
-
var
|
|
28343
|
-
var
|
|
28344
|
-
var
|
|
28345
|
-
var
|
|
28346
|
-
var
|
|
28497
|
+
var U = exports_external.object({ method: exports_external.literal("ui/notifications/host-context-changed"), params: E.describe("Partial context update containing only changed fields.") });
|
|
28498
|
+
var GQ = exports_external.object({ method: exports_external.literal("ui/update-model-context"), params: exports_external.object({ content: exports_external.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: exports_external.record(exports_external.string(), exports_external.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
|
|
28499
|
+
var LQ = exports_external.object({ method: exports_external.literal("ui/initialize"), params: exports_external.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: v.describe("Features and capabilities this app provides."), protocolVersion: exports_external.string().describe("Protocol version this app supports.") }) });
|
|
28500
|
+
var k = exports_external.object({ protocolVersion: exports_external.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'), hostInfo: ImplementationSchema.describe("Host application identification and version."), hostCapabilities: y.describe("Features and capabilities provided by the host."), hostContext: E.describe("Rich context about the host environment.") }).passthrough();
|
|
28501
|
+
var M = "ui/resourceUri";
|
|
28502
|
+
var u = "text/html;profile=mcp-app";
|
|
28347
28503
|
|
|
28348
|
-
class
|
|
28504
|
+
class zQ extends j {
|
|
28349
28505
|
_appInfo;
|
|
28350
28506
|
_capabilities;
|
|
28351
28507
|
options;
|
|
28352
28508
|
_hostCapabilities;
|
|
28353
28509
|
_hostInfo;
|
|
28354
28510
|
_hostContext;
|
|
28511
|
+
eventSchemas = { toolinput: A, toolinputpartial: P, toolresult: R, toolcancelled: H, hostcontextchanged: U };
|
|
28512
|
+
onEventDispatch(Z, $) {
|
|
28513
|
+
if (Z === "hostcontextchanged")
|
|
28514
|
+
this._hostContext = { ...this._hostContext, ...$ };
|
|
28515
|
+
}
|
|
28355
28516
|
constructor(Z, $ = {}, J = { autoResize: true }) {
|
|
28356
28517
|
super(J);
|
|
28357
28518
|
this._appInfo = Z;
|
|
@@ -28359,7 +28520,7 @@ class FQ extends Protocol {
|
|
|
28359
28520
|
this.options = J;
|
|
28360
28521
|
this.setRequestHandler(PingRequestSchema, (X) => {
|
|
28361
28522
|
return console.log("Received ping:", X.params), {};
|
|
28362
|
-
}), this.
|
|
28523
|
+
}), this.setEventHandler("hostcontextchanged", undefined);
|
|
28363
28524
|
}
|
|
28364
28525
|
getHostCapabilities() {
|
|
28365
28526
|
return this._hostCapabilities;
|
|
@@ -28370,31 +28531,68 @@ class FQ extends Protocol {
|
|
|
28370
28531
|
getHostContext() {
|
|
28371
28532
|
return this._hostContext;
|
|
28372
28533
|
}
|
|
28534
|
+
get ontoolinput() {
|
|
28535
|
+
return this.getEventHandler("toolinput");
|
|
28536
|
+
}
|
|
28373
28537
|
set ontoolinput(Z) {
|
|
28374
|
-
this.
|
|
28538
|
+
this.setEventHandler("toolinput", Z);
|
|
28539
|
+
}
|
|
28540
|
+
get ontoolinputpartial() {
|
|
28541
|
+
return this.getEventHandler("toolinputpartial");
|
|
28375
28542
|
}
|
|
28376
28543
|
set ontoolinputpartial(Z) {
|
|
28377
|
-
this.
|
|
28544
|
+
this.setEventHandler("toolinputpartial", Z);
|
|
28545
|
+
}
|
|
28546
|
+
get ontoolresult() {
|
|
28547
|
+
return this.getEventHandler("toolresult");
|
|
28378
28548
|
}
|
|
28379
28549
|
set ontoolresult(Z) {
|
|
28380
|
-
this.
|
|
28550
|
+
this.setEventHandler("toolresult", Z);
|
|
28551
|
+
}
|
|
28552
|
+
get ontoolcancelled() {
|
|
28553
|
+
return this.getEventHandler("toolcancelled");
|
|
28381
28554
|
}
|
|
28382
28555
|
set ontoolcancelled(Z) {
|
|
28383
|
-
this.
|
|
28556
|
+
this.setEventHandler("toolcancelled", Z);
|
|
28557
|
+
}
|
|
28558
|
+
get onhostcontextchanged() {
|
|
28559
|
+
return this.getEventHandler("hostcontextchanged");
|
|
28384
28560
|
}
|
|
28385
28561
|
set onhostcontextchanged(Z) {
|
|
28386
|
-
this.
|
|
28387
|
-
|
|
28388
|
-
|
|
28562
|
+
this.setEventHandler("hostcontextchanged", Z);
|
|
28563
|
+
}
|
|
28564
|
+
_onteardown;
|
|
28565
|
+
get onteardown() {
|
|
28566
|
+
return this._onteardown;
|
|
28389
28567
|
}
|
|
28390
28568
|
set onteardown(Z) {
|
|
28391
|
-
this.
|
|
28569
|
+
this.warnIfRequestHandlerReplaced("onteardown", this._onteardown, Z), this._onteardown = Z, this.replaceRequestHandler(_, ($, J) => {
|
|
28570
|
+
if (!this._onteardown)
|
|
28571
|
+
throw Error("No onteardown handler set");
|
|
28572
|
+
return this._onteardown($.params, J);
|
|
28573
|
+
});
|
|
28574
|
+
}
|
|
28575
|
+
_oncalltool;
|
|
28576
|
+
get oncalltool() {
|
|
28577
|
+
return this._oncalltool;
|
|
28392
28578
|
}
|
|
28393
28579
|
set oncalltool(Z) {
|
|
28394
|
-
this.
|
|
28580
|
+
this.warnIfRequestHandlerReplaced("oncalltool", this._oncalltool, Z), this._oncalltool = Z, this.replaceRequestHandler(CallToolRequestSchema, ($, J) => {
|
|
28581
|
+
if (!this._oncalltool)
|
|
28582
|
+
throw Error("No oncalltool handler set");
|
|
28583
|
+
return this._oncalltool($.params, J);
|
|
28584
|
+
});
|
|
28585
|
+
}
|
|
28586
|
+
_onlisttools;
|
|
28587
|
+
get onlisttools() {
|
|
28588
|
+
return this._onlisttools;
|
|
28395
28589
|
}
|
|
28396
28590
|
set onlisttools(Z) {
|
|
28397
|
-
this.
|
|
28591
|
+
this.warnIfRequestHandlerReplaced("onlisttools", this._onlisttools, Z), this._onlisttools = Z, this.replaceRequestHandler(ListToolsRequestSchema, ($, J) => {
|
|
28592
|
+
if (!this._onlisttools)
|
|
28593
|
+
throw Error("No onlisttools handler set");
|
|
28594
|
+
return this._onlisttools($.params, J);
|
|
28595
|
+
});
|
|
28398
28596
|
}
|
|
28399
28597
|
assertCapabilityForMethod(Z) {}
|
|
28400
28598
|
assertRequestHandlerCapability(Z) {
|
|
@@ -28430,7 +28628,7 @@ class FQ extends Protocol {
|
|
|
28430
28628
|
return await this.request({ method: "resources/list", params: Z }, ListResourcesResultSchema, $);
|
|
28431
28629
|
}
|
|
28432
28630
|
sendMessage(Z, $) {
|
|
28433
|
-
return this.request({ method: "ui/message", params: Z },
|
|
28631
|
+
return this.request({ method: "ui/message", params: Z }, w, $);
|
|
28434
28632
|
}
|
|
28435
28633
|
sendLog(Z) {
|
|
28436
28634
|
return this.notification({ method: "notifications/message", params: Z });
|
|
@@ -28439,17 +28637,17 @@ class FQ extends Protocol {
|
|
|
28439
28637
|
return this.request({ method: "ui/update-model-context", params: Z }, EmptyResultSchema, $);
|
|
28440
28638
|
}
|
|
28441
28639
|
openLink(Z, $) {
|
|
28442
|
-
return this.request({ method: "ui/open-link", params: Z },
|
|
28640
|
+
return this.request({ method: "ui/open-link", params: Z }, O, $);
|
|
28443
28641
|
}
|
|
28444
28642
|
sendOpenLink = this.openLink;
|
|
28445
28643
|
downloadFile(Z, $) {
|
|
28446
|
-
return this.request({ method: "ui/download-file", params: Z },
|
|
28644
|
+
return this.request({ method: "ui/download-file", params: Z }, I, $);
|
|
28447
28645
|
}
|
|
28448
28646
|
requestTeardown(Z = {}) {
|
|
28449
28647
|
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
28450
28648
|
}
|
|
28451
28649
|
requestDisplayMode(Z, $) {
|
|
28452
|
-
return this.request({ method: "ui/request-display-mode", params: Z },
|
|
28650
|
+
return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
|
|
28453
28651
|
}
|
|
28454
28652
|
sendSizeChanged(Z) {
|
|
28455
28653
|
return this.notification({ method: "ui/notifications/size-changed", params: Z });
|
|
@@ -28460,25 +28658,25 @@ class FQ extends Protocol {
|
|
|
28460
28658
|
return;
|
|
28461
28659
|
Z = true, requestAnimationFrame(() => {
|
|
28462
28660
|
Z = false;
|
|
28463
|
-
let
|
|
28464
|
-
|
|
28465
|
-
let
|
|
28466
|
-
|
|
28467
|
-
let
|
|
28468
|
-
if (
|
|
28469
|
-
$ =
|
|
28661
|
+
let D = document.documentElement, G = D.style.height;
|
|
28662
|
+
D.style.height = "max-content";
|
|
28663
|
+
let L = Math.ceil(D.getBoundingClientRect().height);
|
|
28664
|
+
D.style.height = G;
|
|
28665
|
+
let Y = Math.ceil(window.innerWidth);
|
|
28666
|
+
if (Y !== $ || L !== J)
|
|
28667
|
+
$ = Y, J = L, this.sendSizeChanged({ width: Y, height: L });
|
|
28470
28668
|
});
|
|
28471
28669
|
};
|
|
28472
28670
|
X();
|
|
28473
28671
|
let V = new ResizeObserver(X);
|
|
28474
28672
|
return V.observe(document.documentElement), V.observe(document.body), () => V.disconnect();
|
|
28475
28673
|
}
|
|
28476
|
-
async connect(Z = new
|
|
28674
|
+
async connect(Z = new B(window.parent, window.parent), $) {
|
|
28477
28675
|
if (this.transport)
|
|
28478
28676
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
28479
28677
|
await super.connect(Z);
|
|
28480
28678
|
try {
|
|
28481
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion:
|
|
28679
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, k, $);
|
|
28482
28680
|
if (J === undefined)
|
|
28483
28681
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
28484
28682
|
if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
|
|
@@ -28488,16 +28686,16 @@ class FQ extends Protocol {
|
|
|
28488
28686
|
}
|
|
28489
28687
|
}
|
|
28490
28688
|
}
|
|
28491
|
-
function
|
|
28492
|
-
let V = J._meta,
|
|
28493
|
-
if (
|
|
28494
|
-
|
|
28495
|
-
else if (
|
|
28496
|
-
|
|
28497
|
-
return Z.registerTool($, { ...J, _meta:
|
|
28689
|
+
function hZ(Z, $, J, X) {
|
|
28690
|
+
let V = J._meta, D = V.ui, G = V[M], L = V;
|
|
28691
|
+
if (D?.resourceUri && !G)
|
|
28692
|
+
L = { ...V, [M]: D.resourceUri };
|
|
28693
|
+
else if (G && !D?.resourceUri)
|
|
28694
|
+
L = { ...V, ui: { ...D, resourceUri: G } };
|
|
28695
|
+
return Z.registerTool($, { ...J, _meta: L }, X);
|
|
28498
28696
|
}
|
|
28499
|
-
function
|
|
28500
|
-
return Z.registerResource($, J, { mimeType:
|
|
28697
|
+
function mZ(Z, $, J, X, V) {
|
|
28698
|
+
return Z.registerResource($, J, { mimeType: u, ...X }, V);
|
|
28501
28699
|
}
|
|
28502
28700
|
|
|
28503
28701
|
// src/types.ts
|
|
@@ -28727,7 +28925,7 @@ function createServer() {
|
|
|
28727
28925
|
});
|
|
28728
28926
|
{
|
|
28729
28927
|
const resourceUri = "ui://customer-segmentation/mcp-app.html";
|
|
28730
|
-
|
|
28928
|
+
hZ(server, "get-customer-data", {
|
|
28731
28929
|
title: "Get Customer Data",
|
|
28732
28930
|
description: "Returns customer data with segment information for visualization. Optionally filter by segment.",
|
|
28733
28931
|
inputSchema: GetCustomerDataInputSchema.shape,
|
|
@@ -28740,8 +28938,8 @@ function createServer() {
|
|
|
28740
28938
|
structuredContent: data
|
|
28741
28939
|
};
|
|
28742
28940
|
});
|
|
28743
|
-
|
|
28744
|
-
mimeType:
|
|
28941
|
+
mZ(server, resourceUri, resourceUri, {
|
|
28942
|
+
mimeType: u,
|
|
28745
28943
|
description: "Customer Segmentation Explorer UI"
|
|
28746
28944
|
}, async () => {
|
|
28747
28945
|
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");
|
|
@@ -28749,7 +28947,7 @@ function createServer() {
|
|
|
28749
28947
|
contents: [
|
|
28750
28948
|
{
|
|
28751
28949
|
uri: resourceUri,
|
|
28752
|
-
mimeType:
|
|
28950
|
+
mimeType: u,
|
|
28753
28951
|
text: html
|
|
28754
28952
|
}
|
|
28755
28953
|
]
|