@dereekb/firebase-server 13.12.9 → 13.14.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/index.cjs.js +1 -0
- package/index.esm.js +1 -0
- package/mailgun/package.json +9 -9
- package/mcp/index.cjs.js +633 -95
- package/mcp/index.esm.js +628 -96
- package/mcp/package.json +11 -11
- package/mcp/src/lib/service/mcp.manifest.d.ts +13 -0
- package/mcp/src/lib/service/mcp.response-formatter.d.ts +10 -6
- package/mcp/src/lib/service/mcp.server.factory.d.ts +24 -0
- package/mcp/src/lib/service/mcp.tool-generator.d.ts +194 -13
- package/model/index.cjs.js +209 -0
- package/model/index.esm.js +208 -2
- package/model/package.json +9 -9
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +61 -1
- package/oidc/index.cjs.js +1025 -283
- package/oidc/index.esm.js +1016 -285
- package/oidc/package.json +10 -10
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +4 -1
- package/oidc/src/lib/controller/oidc.provider.controller.d.ts +17 -0
- package/oidc/src/lib/oidc.config.d.ts +60 -0
- package/oidc/src/lib/service/analytics/index.d.ts +4 -0
- package/oidc/src/lib/service/analytics/oidc.analytics.config.d.ts +46 -0
- package/oidc/src/lib/service/analytics/oidc.analytics.handler.d.ts +116 -0
- package/oidc/src/lib/service/analytics/oidc.analytics.module.d.ts +35 -0
- package/oidc/src/lib/service/analytics/oidc.analytics.service.d.ts +23 -0
- package/oidc/src/lib/service/index.d.ts +1 -0
- package/oidc/src/lib/service/oidc.account.service.d.ts +15 -0
- package/oidc/src/lib/service/oidc.client.service.d.ts +4 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +2 -2
- package/oidc/src/lib/service/oidc.service.d.ts +23 -1
- package/oidc/src/lib/service/oidc.session-ttl.d.ts +114 -0
- package/package.json +10 -10
- package/src/lib/nest/model/api.details.d.ts +117 -32
- package/test/index.cjs.js +11 -3
- package/test/index.esm.js +11 -3
- package/test/package.json +11 -11
- package/twilio/package.json +8 -8
- package/zoho/package.json +9 -9
package/mcp/index.esm.js
CHANGED
|
@@ -190,6 +190,35 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
190
190
|
return isDefault ? "".concat(modelType, ".").concat(call, "._") : "".concat(modelType, ".").concat(call, ".").concat(specifier);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
194
|
+
try {
|
|
195
|
+
var info = gen[key](arg);
|
|
196
|
+
var value = info.value;
|
|
197
|
+
} catch (error) {
|
|
198
|
+
reject(error);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (info.done) {
|
|
202
|
+
resolve(value);
|
|
203
|
+
} else {
|
|
204
|
+
Promise.resolve(value).then(_next, _throw);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function _async_to_generator$4(fn) {
|
|
208
|
+
return function() {
|
|
209
|
+
var self = this, args = arguments;
|
|
210
|
+
return new Promise(function(resolve, reject) {
|
|
211
|
+
var gen = fn.apply(self, args);
|
|
212
|
+
function _next(value) {
|
|
213
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
|
|
214
|
+
}
|
|
215
|
+
function _throw(err) {
|
|
216
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
|
|
217
|
+
}
|
|
218
|
+
_next(undefined);
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
}
|
|
193
222
|
function _instanceof(left, right) {
|
|
194
223
|
"@swc/helpers - instanceof";
|
|
195
224
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
@@ -198,6 +227,105 @@ function _instanceof(left, right) {
|
|
|
198
227
|
return left instanceof right;
|
|
199
228
|
}
|
|
200
229
|
}
|
|
230
|
+
function _ts_generator$4(thisArg, body) {
|
|
231
|
+
var f, y, t, _ = {
|
|
232
|
+
label: 0,
|
|
233
|
+
sent: function() {
|
|
234
|
+
if (t[0] & 1) throw t[1];
|
|
235
|
+
return t[1];
|
|
236
|
+
},
|
|
237
|
+
trys: [],
|
|
238
|
+
ops: []
|
|
239
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
240
|
+
return d(g, "next", {
|
|
241
|
+
value: verb(0)
|
|
242
|
+
}), d(g, "throw", {
|
|
243
|
+
value: verb(1)
|
|
244
|
+
}), d(g, "return", {
|
|
245
|
+
value: verb(2)
|
|
246
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
247
|
+
value: function() {
|
|
248
|
+
return this;
|
|
249
|
+
}
|
|
250
|
+
}), g;
|
|
251
|
+
function verb(n) {
|
|
252
|
+
return function(v) {
|
|
253
|
+
return step([
|
|
254
|
+
n,
|
|
255
|
+
v
|
|
256
|
+
]);
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function step(op) {
|
|
260
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
261
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
262
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
263
|
+
if (y = 0, t) op = [
|
|
264
|
+
op[0] & 2,
|
|
265
|
+
t.value
|
|
266
|
+
];
|
|
267
|
+
switch(op[0]){
|
|
268
|
+
case 0:
|
|
269
|
+
case 1:
|
|
270
|
+
t = op;
|
|
271
|
+
break;
|
|
272
|
+
case 4:
|
|
273
|
+
_.label++;
|
|
274
|
+
return {
|
|
275
|
+
value: op[1],
|
|
276
|
+
done: false
|
|
277
|
+
};
|
|
278
|
+
case 5:
|
|
279
|
+
_.label++;
|
|
280
|
+
y = op[1];
|
|
281
|
+
op = [
|
|
282
|
+
0
|
|
283
|
+
];
|
|
284
|
+
continue;
|
|
285
|
+
case 7:
|
|
286
|
+
op = _.ops.pop();
|
|
287
|
+
_.trys.pop();
|
|
288
|
+
continue;
|
|
289
|
+
default:
|
|
290
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
291
|
+
_ = 0;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
295
|
+
_.label = op[1];
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
299
|
+
_.label = t[1];
|
|
300
|
+
t = op;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
if (t && _.label < t[2]) {
|
|
304
|
+
_.label = t[2];
|
|
305
|
+
_.ops.push(op);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
if (t[2]) _.ops.pop();
|
|
309
|
+
_.trys.pop();
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
op = body.call(thisArg, _);
|
|
313
|
+
} catch (e) {
|
|
314
|
+
op = [
|
|
315
|
+
6,
|
|
316
|
+
e
|
|
317
|
+
];
|
|
318
|
+
y = 0;
|
|
319
|
+
} finally{
|
|
320
|
+
f = t = 0;
|
|
321
|
+
}
|
|
322
|
+
if (op[0] & 5) throw op[1];
|
|
323
|
+
return {
|
|
324
|
+
value: op[0] ? op[1] : void 0,
|
|
325
|
+
done: true
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
201
329
|
/**
|
|
202
330
|
* Default structured value emitted by MCP when a handler returns `undefined`.
|
|
203
331
|
*
|
|
@@ -210,46 +338,84 @@ function _instanceof(left, right) {
|
|
|
210
338
|
/**
|
|
211
339
|
* Resolves a dispatch result + handler API details into the MCP `CallToolResult` shape.
|
|
212
340
|
*
|
|
341
|
+
* When `mcp.mapSuccessfulResult` is set, the raw result is first mapped (async-capable) to the value
|
|
342
|
+
* exposed via MCP; the tiers and the default path then operate on the mapped value. The tier
|
|
343
|
+
* callbacks receive `(value, context)` where `context` carries both the raw + mapped values + params.
|
|
344
|
+
*
|
|
213
345
|
* Three-tier resolution as documented on {@link OnCallModelFunctionApiDetails.mcp}:
|
|
214
346
|
*
|
|
215
347
|
* - **Tier 3** — when `mcp.formatResponse` is set, its return value is used verbatim.
|
|
216
348
|
* - **Tier 2** — when `mcp.summarizeResponse` is set, the summary string is wrapped into a
|
|
217
|
-
* single text content block with the
|
|
218
|
-
* - **Tier 1** — default: JSON-stringify
|
|
219
|
-
* exposing
|
|
349
|
+
* single text content block with the (mapped) value exposed as `structuredContent`.
|
|
350
|
+
* - **Tier 1** — default: JSON-stringify the (mapped) value as a single text content block, also
|
|
351
|
+
* exposing it as `structuredContent`.
|
|
220
352
|
*
|
|
221
|
-
* @param result - The handler's return value.
|
|
353
|
+
* @param result - The handler's raw return value.
|
|
222
354
|
* @param params - The {@link OnCallTypedModelParams} that were dispatched.
|
|
223
|
-
* @param details - The handler-level API details (carries Tier 2/3 formatters).
|
|
355
|
+
* @param details - The handler-level API details (carries the mapper + Tier 2/3 formatters).
|
|
224
356
|
* @returns The MCP tool response content.
|
|
225
357
|
*/ function formatMcpToolResponse(result, params, details) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
358
|
+
return _async_to_generator$4(function() {
|
|
359
|
+
var mcp, value, _tmp, context, response, summary;
|
|
360
|
+
return _ts_generator$4(this, function(_state) {
|
|
361
|
+
switch(_state.label){
|
|
362
|
+
case 0:
|
|
363
|
+
mcp = details === null || details === void 0 ? void 0 : details.mcp;
|
|
364
|
+
if (!(mcp === null || mcp === void 0 ? void 0 : mcp.mapSuccessfulResult)) return [
|
|
365
|
+
3,
|
|
366
|
+
2
|
|
367
|
+
];
|
|
368
|
+
return [
|
|
369
|
+
4,
|
|
370
|
+
mcp.mapSuccessfulResult(result, params)
|
|
371
|
+
];
|
|
372
|
+
case 1:
|
|
373
|
+
_tmp = _state.sent();
|
|
374
|
+
return [
|
|
375
|
+
3,
|
|
376
|
+
3
|
|
377
|
+
];
|
|
378
|
+
case 2:
|
|
379
|
+
_tmp = result;
|
|
380
|
+
_state.label = 3;
|
|
381
|
+
case 3:
|
|
382
|
+
value = _tmp;
|
|
383
|
+
context = {
|
|
384
|
+
raw: result,
|
|
385
|
+
value: value,
|
|
386
|
+
params: params
|
|
387
|
+
};
|
|
388
|
+
if (mcp === null || mcp === void 0 ? void 0 : mcp.formatResponse) {
|
|
389
|
+
response = mcp.formatResponse(value, context);
|
|
390
|
+
} else if (mcp === null || mcp === void 0 ? void 0 : mcp.summarizeResponse) {
|
|
391
|
+
summary = mcp.summarizeResponse(value, context);
|
|
392
|
+
response = {
|
|
393
|
+
content: [
|
|
394
|
+
{
|
|
395
|
+
type: 'text',
|
|
396
|
+
text: summary
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
structuredContent: value
|
|
400
|
+
};
|
|
401
|
+
} else {
|
|
402
|
+
response = {
|
|
403
|
+
content: [
|
|
404
|
+
{
|
|
405
|
+
type: 'text',
|
|
406
|
+
text: stringifyResult(value)
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
structuredContent: value === undefined ? DEFAULT_VOID_MCP_SUCCESS_VALUE : value
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return [
|
|
413
|
+
2,
|
|
414
|
+
response
|
|
415
|
+
];
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
})();
|
|
253
419
|
}
|
|
254
420
|
/**
|
|
255
421
|
* Converts an error thrown from the dispatch chain into the MCP error response shape.
|
|
@@ -456,18 +622,124 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
456
622
|
* The default specifier key used when a handler is not behind a specifier router.
|
|
457
623
|
*/ var DEFAULT_SPECIFIER_KEY = '_';
|
|
458
624
|
/**
|
|
459
|
-
*
|
|
625
|
+
* Soft limit for an MCP tool name. Names longer than this still register, but the generator
|
|
626
|
+
* surfaces a `name_length_warning` so the drift toward the hard cap is visible at boot / build.
|
|
627
|
+
*/ var MCP_TOOL_NAME_WARN_LENGTH = 55;
|
|
628
|
+
/**
|
|
629
|
+
* Hard limit for an MCP tool name. Remote MCP clients reject a `tools/list` payload that contains
|
|
630
|
+
* any tool whose `name` exceeds this (`FrontendRemoteMcpToolDefinition.name: String should have at
|
|
631
|
+
* most 64 characters`), which fails the whole connection. Names over this are not registered.
|
|
632
|
+
*/ var MCP_TOOL_NAME_MAX_LENGTH = 64;
|
|
633
|
+
/**
|
|
634
|
+
* Classifies a tool name's length against the soft/hard MCP name-length limits.
|
|
635
|
+
*
|
|
636
|
+
* Shared by the runtime generator and the build-time manifest renderer so both apply the
|
|
637
|
+
* same thresholds and never drift.
|
|
638
|
+
*
|
|
639
|
+
* @param name - The fully-resolved tool name (including any per-handler override).
|
|
640
|
+
* @returns The length classification — `error` over {@link MCP_TOOL_NAME_MAX_LENGTH}, `warn` over
|
|
641
|
+
* {@link MCP_TOOL_NAME_WARN_LENGTH}, otherwise `ok`.
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```ts
|
|
645
|
+
* validateMcpToolName('worker-create'); // { name: 'worker-create', length: 13, level: 'ok' }
|
|
646
|
+
* ```
|
|
647
|
+
*/ function validateMcpToolName(name) {
|
|
648
|
+
var length = name.length;
|
|
649
|
+
var level = 'ok';
|
|
650
|
+
if (length > MCP_TOOL_NAME_MAX_LENGTH) {
|
|
651
|
+
level = 'error';
|
|
652
|
+
} else if (length > MCP_TOOL_NAME_WARN_LENGTH) {
|
|
653
|
+
level = 'warn';
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
name: name,
|
|
657
|
+
length: length,
|
|
658
|
+
level: level
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Builds the MCP tool name for a (modelSegment, callType, specifier) triple.
|
|
663
|
+
*
|
|
664
|
+
* The call-type segment is only emitted for the default (`_`) specifier, where it carries the
|
|
665
|
+
* meaning (`worker-create`, `worker-update`). Named specifiers drop it — the specifier already
|
|
666
|
+
* disambiguates (`worker-syncCheckHqEmployee`), which keeps names short and within the MCP
|
|
667
|
+
* 64-character cap. Apps can override the whole name per handler via
|
|
668
|
+
* {@link OnCallModelFunctionApiDetails.mcp.name}.
|
|
460
669
|
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
670
|
+
* This is the preferred (short) form. When two visible tools collide on it — two call types share a
|
|
671
|
+
* specifier once the call-type segment is dropped — the generator re-derives both names with
|
|
672
|
+
* {@link buildDisambiguatedMcpToolName} instead.
|
|
463
673
|
*
|
|
464
|
-
* @param
|
|
674
|
+
* @param modelSegment - The model segment of the name. Defaults to the model type, but may be a
|
|
675
|
+
* shorter per-model override (e.g. the collection prefix) resolved by the caller.
|
|
465
676
|
* @param callType - The call type (e.g., `invoke`).
|
|
466
677
|
* @param specifier - The specifier key, or `_` / undefined for the default entry.
|
|
467
678
|
* @returns The hyphen-joined tool name advertised on `tools/list`.
|
|
468
|
-
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```ts
|
|
682
|
+
* buildMcpToolName('worker', 'create'); // 'worker-create'
|
|
683
|
+
* buildMcpToolName('worker', 'update', 'syncCheckHqEmployee'); // 'worker-syncCheckHqEmployee'
|
|
684
|
+
* ```
|
|
685
|
+
*/ function buildMcpToolName(modelSegment, callType, specifier) {
|
|
686
|
+
var isDefault = specifier == null || specifier === DEFAULT_SPECIFIER_KEY;
|
|
687
|
+
return isDefault ? "".concat(modelSegment, "-").concat(callType) : "".concat(modelSegment, "-").concat(specifier);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Single-character abbreviations for the standard CRUDQ + invoke call types, used to disambiguate
|
|
691
|
+
* colliding tool names without re-introducing the full call-type segment everywhere.
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* ```ts
|
|
695
|
+
* MCP_CALL_TYPE_ABBREVIATIONS.update; // 'u'
|
|
696
|
+
* ```
|
|
697
|
+
*/ var MCP_CALL_TYPE_ABBREVIATIONS = {
|
|
698
|
+
create: 'c',
|
|
699
|
+
read: 'r',
|
|
700
|
+
update: 'u',
|
|
701
|
+
delete: 'd',
|
|
702
|
+
query: 'q',
|
|
703
|
+
invoke: 'i'
|
|
704
|
+
};
|
|
705
|
+
/**
|
|
706
|
+
* Abbreviates a call type for use in a disambiguated tool name. Known CRUDQ + invoke types collapse
|
|
707
|
+
* to a single character; a custom call type is returned unchanged so the name stays unambiguous.
|
|
708
|
+
*
|
|
709
|
+
* @param callType - The call type / verb.
|
|
710
|
+
* @returns The single-character abbreviation, or the original string for a custom call type.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```ts
|
|
714
|
+
* abbreviateMcpCallType('update'); // 'u'
|
|
715
|
+
* abbreviateMcpCallType('recompute'); // 'recompute'
|
|
716
|
+
* ```
|
|
717
|
+
*/ function abbreviateMcpCallType(callType) {
|
|
718
|
+
var _MCP_CALL_TYPE_ABBREVIATIONS_callType;
|
|
719
|
+
return (_MCP_CALL_TYPE_ABBREVIATIONS_callType = MCP_CALL_TYPE_ABBREVIATIONS[callType]) !== null && _MCP_CALL_TYPE_ABBREVIATIONS_callType !== void 0 ? _MCP_CALL_TYPE_ABBREVIATIONS_callType : callType;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Builds the disambiguated MCP tool name for a (modelSegment, callType, specifier) triple — the form
|
|
723
|
+
* used only when the preferred {@link buildMcpToolName} output collides with another visible tool.
|
|
724
|
+
*
|
|
725
|
+
* Named specifiers re-insert the call type, abbreviated, between the segment and specifier
|
|
726
|
+
* (`worker-u-syncCheckHqEmployee`); since the two colliding tools differ only by call type, their
|
|
727
|
+
* abbreviations differ and the names no longer clash. Default (`_`) specifiers already carry the
|
|
728
|
+
* full call type, so they are returned in their {@link buildMcpToolName} form unchanged.
|
|
729
|
+
*
|
|
730
|
+
* @param modelSegment - The model segment of the name (model type, or a per-model override).
|
|
731
|
+
* @param callType - The call type / verb.
|
|
732
|
+
* @param specifier - The specifier key, or `_` / undefined for the default entry.
|
|
733
|
+
* @returns The hyphen-joined disambiguated tool name.
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* ```ts
|
|
737
|
+
* buildDisambiguatedMcpToolName('worker', 'update', 'syncCheckHqEmployee'); // 'worker-u-syncCheckHqEmployee'
|
|
738
|
+
* buildDisambiguatedMcpToolName('worker', 'create'); // 'worker-create'
|
|
739
|
+
* ```
|
|
740
|
+
*/ function buildDisambiguatedMcpToolName(modelSegment, callType, specifier) {
|
|
469
741
|
var isDefault = specifier == null || specifier === DEFAULT_SPECIFIER_KEY;
|
|
470
|
-
return isDefault ? "".concat(
|
|
742
|
+
return isDefault ? "".concat(modelSegment, "-").concat(callType) : "".concat(modelSegment, "-").concat(abbreviateMcpCallType(callType), "-").concat(specifier);
|
|
471
743
|
}
|
|
472
744
|
/**
|
|
473
745
|
* Builds the default description used when no build-time MCP manifest
|
|
@@ -481,7 +753,6 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
481
753
|
var isDefault = specifier == null || specifier === DEFAULT_SPECIFIER_KEY;
|
|
482
754
|
return isDefault ? 'Performs the "'.concat(callType, '" call on the "').concat(modelType, '" model.') : 'Performs the "'.concat(callType, '" call on the "').concat(modelType, '" model with the "').concat(specifier, '" specifier.');
|
|
483
755
|
}
|
|
484
|
-
// MARK: Generation
|
|
485
756
|
/**
|
|
486
757
|
* Generates MCP tool definitions from a model-first API details tree.
|
|
487
758
|
*
|
|
@@ -489,17 +760,78 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
489
760
|
* `inputType.toJsonSchema(options)` for the schema, and applies any handler-level
|
|
490
761
|
* MCP `name` override. Descriptions and input/output schemas are pulled from the
|
|
491
762
|
* build-time manifest when supplied. Tools without an `inputType` are skipped and
|
|
492
|
-
* reported so callers can log the gap at startup.
|
|
763
|
+
* reported so callers can log the gap at startup. Tools whose resolved name exceeds
|
|
764
|
+
* {@link MCP_TOOL_NAME_MAX_LENGTH} are skipped so the advertised `tools/list` stays valid.
|
|
765
|
+
*
|
|
766
|
+
* Generation runs in two passes so a name clash is known before any name is finalized: the first
|
|
767
|
+
* pass plans every candidate and counts how many visible auto-named tools share each preferred name;
|
|
768
|
+
* the second builds each tool, re-deriving the colliding ones with the abbreviated call type
|
|
769
|
+
* ({@link buildDisambiguatedMcpToolName}) so both survive instead of one shadowing the other. A
|
|
770
|
+
* residual collision that disambiguation cannot resolve (e.g. an `mcp.name` override matching an auto
|
|
771
|
+
* name) drops the later tool so the dispatch map stays unambiguous.
|
|
493
772
|
*
|
|
494
773
|
* @param apiDetails - The model-first API details tree returned by `getModelApiDetails(callModelFn)`.
|
|
495
774
|
* @param options - Optional schema generation options forwarded to `toJsonSchema()`. Defaults to {@link DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS}.
|
|
496
|
-
* @param
|
|
775
|
+
* @param context - Optional build-time context (manifest overrides + per-model name segments).
|
|
497
776
|
* @returns The list of generated tool definitions plus any skip reports.
|
|
498
777
|
*/ function generateMcpToolDefinitions(apiDetails) {
|
|
499
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS,
|
|
778
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS, context = arguments.length > 2 ? arguments[2] : void 0;
|
|
500
779
|
var tools = [];
|
|
501
780
|
var neverVisibleTools = [];
|
|
502
781
|
var skipped = [];
|
|
782
|
+
var warnings = [];
|
|
783
|
+
var seenNames = new Set();
|
|
784
|
+
var manifest = context === null || context === void 0 ? void 0 : context.manifest;
|
|
785
|
+
var naming = context === null || context === void 0 ? void 0 : context.naming;
|
|
786
|
+
var candidates = planMcpToolCandidates(apiDetails, naming);
|
|
787
|
+
var clashCounts = countVisibleAutoNameClashes(candidates);
|
|
788
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
789
|
+
try {
|
|
790
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
791
|
+
var candidate = _step.value;
|
|
792
|
+
buildToolFromCandidate({
|
|
793
|
+
candidate: candidate,
|
|
794
|
+
clashCounts: clashCounts,
|
|
795
|
+
options: options,
|
|
796
|
+
manifest: manifest,
|
|
797
|
+
seenNames: seenNames,
|
|
798
|
+
outTools: tools,
|
|
799
|
+
outNeverVisibleTools: neverVisibleTools,
|
|
800
|
+
outSkipped: skipped,
|
|
801
|
+
outWarnings: warnings
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
} catch (err) {
|
|
805
|
+
_didIteratorError = true;
|
|
806
|
+
_iteratorError = err;
|
|
807
|
+
} finally{
|
|
808
|
+
try {
|
|
809
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
810
|
+
_iterator.return();
|
|
811
|
+
}
|
|
812
|
+
} finally{
|
|
813
|
+
if (_didIteratorError) {
|
|
814
|
+
throw _iteratorError;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
return {
|
|
819
|
+
tools: tools,
|
|
820
|
+
neverVisibleTools: neverVisibleTools,
|
|
821
|
+
skipped: skipped,
|
|
822
|
+
warnings: warnings
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* First pass: walk the API tree and plan one {@link McpToolCandidate} per handler. No schema
|
|
827
|
+
* generation happens here — only the cheap naming + visibility classification needed to detect
|
|
828
|
+
* clashes before any name is finalized.
|
|
829
|
+
*
|
|
830
|
+
* @param apiDetails - The model-first API details tree.
|
|
831
|
+
* @param naming - Optional per-model name-segment overrides.
|
|
832
|
+
* @returns One candidate per non-null handler, in tree order.
|
|
833
|
+
*/ function planMcpToolCandidates(apiDetails, naming) {
|
|
834
|
+
var candidates = [];
|
|
503
835
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
504
836
|
try {
|
|
505
837
|
for(var _iterator = Object.entries(apiDetails.models)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -511,16 +843,53 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
511
843
|
if (callDetails == null) {
|
|
512
844
|
continue;
|
|
513
845
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
846
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
847
|
+
try {
|
|
848
|
+
for(var _iterator2 = Object.entries(callDetails.specifiers)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
849
|
+
var _step_value2 = _sliced_to_array$2(_step2.value, 2), specifierKey = _step_value2[0], handlerDetails = _step_value2[1];
|
|
850
|
+
var _ref;
|
|
851
|
+
var _naming_modelSegments, _handlerDetails_mcp, _handlerDetails_mcp1;
|
|
852
|
+
if (handlerDetails == null) {
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
var specifier = callDetails.isSpecifier ? specifierKey : undefined;
|
|
856
|
+
var dispatch = {
|
|
857
|
+
call: callType,
|
|
858
|
+
modelType: modelType,
|
|
859
|
+
specifier: specifier
|
|
860
|
+
};
|
|
861
|
+
var modelSegment = (_ref = naming === null || naming === void 0 ? void 0 : (_naming_modelSegments = naming.modelSegments) === null || _naming_modelSegments === void 0 ? void 0 : _naming_modelSegments.get(modelType)) !== null && _ref !== void 0 ? _ref : modelType;
|
|
862
|
+
var overrideName = (_handlerDetails_mcp = handlerDetails.mcp) === null || _handlerDetails_mcp === void 0 ? void 0 : _handlerDetails_mcp.name;
|
|
863
|
+
var baseName = overrideName !== null && overrideName !== void 0 ? overrideName : buildMcpToolName(modelSegment, callType, specifier);
|
|
864
|
+
var classified = classifyVisibility((_handlerDetails_mcp1 = handlerDetails.mcp) === null || _handlerDetails_mcp1 === void 0 ? void 0 : _handlerDetails_mcp1.visibility);
|
|
865
|
+
var isVisible = classified.visibilityKind !== 'never';
|
|
866
|
+
candidates.push({
|
|
867
|
+
modelType: modelType,
|
|
868
|
+
callType: callType,
|
|
869
|
+
handlerDetails: handlerDetails,
|
|
870
|
+
specifier: specifier,
|
|
871
|
+
dispatch: dispatch,
|
|
872
|
+
modelSegment: modelSegment,
|
|
873
|
+
overrideName: overrideName,
|
|
874
|
+
baseName: baseName,
|
|
875
|
+
classified: classified,
|
|
876
|
+
isVisible: isVisible
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
} catch (err) {
|
|
880
|
+
_didIteratorError2 = true;
|
|
881
|
+
_iteratorError2 = err;
|
|
882
|
+
} finally{
|
|
883
|
+
try {
|
|
884
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
885
|
+
_iterator2.return();
|
|
886
|
+
}
|
|
887
|
+
} finally{
|
|
888
|
+
if (_didIteratorError2) {
|
|
889
|
+
throw _iteratorError2;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
524
893
|
}
|
|
525
894
|
} catch (err) {
|
|
526
895
|
_didIteratorError1 = true;
|
|
@@ -551,19 +920,24 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
551
920
|
}
|
|
552
921
|
}
|
|
553
922
|
}
|
|
554
|
-
return
|
|
555
|
-
tools: tools,
|
|
556
|
-
neverVisibleTools: neverVisibleTools,
|
|
557
|
-
skipped: skipped
|
|
558
|
-
};
|
|
923
|
+
return candidates;
|
|
559
924
|
}
|
|
560
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Counts how many visible, auto-named (no `mcp.name` override) candidates share each preferred name.
|
|
927
|
+
* Only these participate in clash detection — hidden tools never reach the wire, and overrides are
|
|
928
|
+
* explicit. A base name with a count over 1 is a clash that the build pass disambiguates.
|
|
929
|
+
*
|
|
930
|
+
* @param candidates - The planned candidates from {@link planMcpToolCandidates}.
|
|
931
|
+
* @returns A map of preferred name to the number of visible auto-named candidates producing it.
|
|
932
|
+
*/ function countVisibleAutoNameClashes(candidates) {
|
|
933
|
+
var counts = new Map();
|
|
561
934
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
562
935
|
try {
|
|
563
|
-
for(var _iterator =
|
|
564
|
-
var
|
|
565
|
-
if (
|
|
566
|
-
|
|
936
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
937
|
+
var candidate = _step.value;
|
|
938
|
+
if (candidate.isVisible && candidate.overrideName == null) {
|
|
939
|
+
var _counts_get;
|
|
940
|
+
counts.set(candidate.baseName, ((_counts_get = counts.get(candidate.baseName)) !== null && _counts_get !== void 0 ? _counts_get : 0) + 1);
|
|
567
941
|
}
|
|
568
942
|
}
|
|
569
943
|
} catch (err) {
|
|
@@ -580,20 +954,36 @@ function generateToolsForModelCall(context) {
|
|
|
580
954
|
}
|
|
581
955
|
}
|
|
582
956
|
}
|
|
957
|
+
return counts;
|
|
583
958
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
var
|
|
959
|
+
/**
|
|
960
|
+
* Second pass: turn one planned {@link McpToolCandidate} into a tool definition, resolving its final
|
|
961
|
+
* name (disambiguating a clash with the abbreviated call type), generating its schema, and routing it
|
|
962
|
+
* to the visible or never-visible bucket.
|
|
963
|
+
*
|
|
964
|
+
* @param context - The candidate plus the shared generation accumulators.
|
|
965
|
+
*/ function buildToolFromCandidate(context) {
|
|
966
|
+
var _clashCounts_get, _ref, _resolveRequiredScope;
|
|
967
|
+
var _handlerDetails_mcp, _handlerDetails_mcp1;
|
|
968
|
+
var candidate = context.candidate, clashCounts = context.clashCounts, options = context.options, manifest = context.manifest, seenNames = context.seenNames, outTools = context.outTools, outNeverVisibleTools = context.outNeverVisibleTools, outSkipped = context.outSkipped, outWarnings = context.outWarnings;
|
|
969
|
+
var modelType = candidate.modelType, callType = candidate.callType, handlerDetails = candidate.handlerDetails, specifier = candidate.specifier, dispatch = candidate.dispatch, modelSegment = candidate.modelSegment, overrideName = candidate.overrideName, baseName = candidate.baseName, classified = candidate.classified, isVisible = candidate.isVisible;
|
|
970
|
+
// A visible auto-named tool whose preferred name is produced by more than one visible tool is
|
|
971
|
+
// re-derived with the abbreviated call type so both survive on the wire. Overrides and hidden tools
|
|
972
|
+
// keep their preferred name (overrides are explicit; hidden tools never reach the wire).
|
|
973
|
+
var needsDisambiguation = isVisible && overrideName == null && ((_clashCounts_get = clashCounts.get(baseName)) !== null && _clashCounts_get !== void 0 ? _clashCounts_get : 0) > 1;
|
|
974
|
+
var name = needsDisambiguation ? buildDisambiguatedMcpToolName(modelSegment, callType, specifier) : baseName;
|
|
975
|
+
var nameValidation = validateMcpToolName(name);
|
|
976
|
+
// A name over the hard cap would make remote clients reject the whole tools/list payload — never advertise it.
|
|
977
|
+
if (nameValidation.level === 'error') {
|
|
978
|
+
outSkipped.push({
|
|
979
|
+
toolName: name,
|
|
980
|
+
reason: 'name_too_long',
|
|
981
|
+
dispatch: dispatch
|
|
982
|
+
});
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
595
985
|
var manifestEntry = manifest === null || manifest === void 0 ? void 0 : manifest.get(mcpManifestKey(modelType, callType, specifier));
|
|
596
|
-
var description = (
|
|
986
|
+
var description = (_ref = manifestEntry === null || manifestEntry === void 0 ? void 0 : manifestEntry.description) !== null && _ref !== void 0 ? _ref : buildDefaultMcpToolDescription(modelType, callType, specifier);
|
|
597
987
|
var inputSchema = resolveInputSchema({
|
|
598
988
|
handlerDetails: handlerDetails,
|
|
599
989
|
manifestEntry: manifestEntry,
|
|
@@ -605,9 +995,28 @@ function generateToolForSpecifier(context, specifierKey, handlerDetails) {
|
|
|
605
995
|
if (inputSchema == null) {
|
|
606
996
|
return;
|
|
607
997
|
}
|
|
608
|
-
|
|
998
|
+
// Cross-check the handler's mapSuccessfulResult against the manifest's mapped-result signal. Only
|
|
999
|
+
// meaningful when a manifest is supplied (it carries the `.api.ts` annotation outcome).
|
|
1000
|
+
if (manifest != null) {
|
|
1001
|
+
var _handlerDetails_mcp2;
|
|
1002
|
+
var hasMapper = ((_handlerDetails_mcp2 = handlerDetails.mcp) === null || _handlerDetails_mcp2 === void 0 ? void 0 : _handlerDetails_mcp2.mapSuccessfulResult) != null;
|
|
1003
|
+
var manifestMapped = (manifestEntry === null || manifestEntry === void 0 ? void 0 : manifestEntry.mcpResultTypeName) != null;
|
|
1004
|
+
if (hasMapper && !manifestMapped) {
|
|
1005
|
+
outWarnings.push({
|
|
1006
|
+
toolName: name,
|
|
1007
|
+
reason: 'mapper_without_mapped_manifest',
|
|
1008
|
+
dispatch: dispatch
|
|
1009
|
+
});
|
|
1010
|
+
} else if (!hasMapper && manifestMapped) {
|
|
1011
|
+
outWarnings.push({
|
|
1012
|
+
toolName: name,
|
|
1013
|
+
reason: 'mapped_manifest_without_mapper',
|
|
1014
|
+
dispatch: dispatch
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
609
1018
|
var requiredScope = (_resolveRequiredScope = resolveRequiredScope(callType)) !== null && _resolveRequiredScope !== void 0 ? _resolveRequiredScope : undefined;
|
|
610
|
-
var effectiveReadOnly = resolveEffectiveReadOnly((
|
|
1019
|
+
var effectiveReadOnly = resolveEffectiveReadOnly((_handlerDetails_mcp = handlerDetails.mcp) === null || _handlerDetails_mcp === void 0 ? void 0 : _handlerDetails_mcp.readOnly, callType);
|
|
611
1020
|
var filterMetadata;
|
|
612
1021
|
if (classified.visibilityKind === 'declarative') {
|
|
613
1022
|
filterMetadata = {
|
|
@@ -630,6 +1039,21 @@ function generateToolForSpecifier(context, specifierKey, handlerDetails) {
|
|
|
630
1039
|
effectiveReadOnly: effectiveReadOnly
|
|
631
1040
|
};
|
|
632
1041
|
}
|
|
1042
|
+
// Disambiguation has already separated the common dropped-call-type clash; this is the backstop for
|
|
1043
|
+
// a residual collision it cannot resolve (an `mcp.name` override matching an auto name, or two model
|
|
1044
|
+
// segments coinciding on the same call type) which would otherwise let one tool silently shadow the
|
|
1045
|
+
// other in the per-request name→definition map. Hidden tools never reach the map, so skip the check.
|
|
1046
|
+
if (isVisible) {
|
|
1047
|
+
if (seenNames.has(name)) {
|
|
1048
|
+
outSkipped.push({
|
|
1049
|
+
toolName: name,
|
|
1050
|
+
reason: 'duplicate_name',
|
|
1051
|
+
dispatch: dispatch
|
|
1052
|
+
});
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
seenNames.add(name);
|
|
1056
|
+
}
|
|
633
1057
|
var outputSchema = manifestEntry === null || manifestEntry === void 0 ? void 0 : manifestEntry.outputSchema;
|
|
634
1058
|
var staticWireEntry = buildStaticWireEntry({
|
|
635
1059
|
name: name,
|
|
@@ -646,12 +1070,12 @@ function generateToolForSpecifier(context, specifierKey, handlerDetails) {
|
|
|
646
1070
|
dispatch: dispatch,
|
|
647
1071
|
filterMetadata: filterMetadata,
|
|
648
1072
|
staticWireEntry: staticWireEntry,
|
|
649
|
-
toolDetailsBuilder: (
|
|
1073
|
+
toolDetailsBuilder: (_handlerDetails_mcp1 = handlerDetails.mcp) === null || _handlerDetails_mcp1 === void 0 ? void 0 : _handlerDetails_mcp1.toolDetails
|
|
650
1074
|
};
|
|
651
|
-
if (
|
|
652
|
-
outNeverVisibleTools.push(definition);
|
|
653
|
-
} else {
|
|
1075
|
+
if (isVisible) {
|
|
654
1076
|
outTools.push(definition);
|
|
1077
|
+
} else {
|
|
1078
|
+
outNeverVisibleTools.push(definition);
|
|
655
1079
|
}
|
|
656
1080
|
}
|
|
657
1081
|
function resolveInputSchema(context) {
|
|
@@ -2880,21 +3304,24 @@ var McpServerFactoryService_1;
|
|
|
2880
3304
|
result = {
|
|
2881
3305
|
tools: [],
|
|
2882
3306
|
neverVisibleTools: [],
|
|
2883
|
-
skipped: []
|
|
3307
|
+
skipped: [],
|
|
3308
|
+
warnings: []
|
|
2884
3309
|
};
|
|
2885
3310
|
} else {
|
|
2886
|
-
result = generateMcpToolDefinitions(apiDetails, undefined,
|
|
3311
|
+
result = generateMcpToolDefinitions(apiDetails, undefined, {
|
|
3312
|
+
manifest: manifest,
|
|
3313
|
+
naming: this._resolveToolNamingOptions()
|
|
3314
|
+
});
|
|
2887
3315
|
}
|
|
2888
3316
|
this._cachedTools = result;
|
|
2889
3317
|
}
|
|
2890
|
-
if (!this._loggedSkips && result.skipped.length > 0) {
|
|
3318
|
+
if (!this._loggedSkips && (result.skipped.length > 0 || result.warnings.length > 0)) {
|
|
2891
3319
|
this._loggedSkips = true;
|
|
2892
3320
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2893
3321
|
try {
|
|
2894
3322
|
for(var _iterator = result.skipped[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2895
3323
|
var skip = _step.value;
|
|
2896
|
-
|
|
2897
|
-
this._logger.warn("Skipped MCP tool ".concat(skip.toolName, " (").concat(skip.reason, ")").concat(errorSuffix));
|
|
3324
|
+
this._logSkip(skip);
|
|
2898
3325
|
}
|
|
2899
3326
|
} catch (err) {
|
|
2900
3327
|
_didIteratorError = true;
|
|
@@ -2910,6 +3337,107 @@ var McpServerFactoryService_1;
|
|
|
2910
3337
|
}
|
|
2911
3338
|
}
|
|
2912
3339
|
}
|
|
3340
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3341
|
+
try {
|
|
3342
|
+
for(var _iterator1 = result.warnings[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3343
|
+
var warning = _step1.value;
|
|
3344
|
+
this._logger.warn(this._describeToolGenerationWarning(warning));
|
|
3345
|
+
}
|
|
3346
|
+
} catch (err) {
|
|
3347
|
+
_didIteratorError1 = true;
|
|
3348
|
+
_iteratorError1 = err;
|
|
3349
|
+
} finally{
|
|
3350
|
+
try {
|
|
3351
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3352
|
+
_iterator1.return();
|
|
3353
|
+
}
|
|
3354
|
+
} finally{
|
|
3355
|
+
if (_didIteratorError1) {
|
|
3356
|
+
throw _iteratorError1;
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
return result;
|
|
3362
|
+
}
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
/**
|
|
3366
|
+
* Builds the per-model tool-name segment overrides from the loaded manifest's `models` catalog.
|
|
3367
|
+
*
|
|
3368
|
+
* Sourcing the segments from the manifest (rather than runtime config) keeps the runtime in
|
|
3369
|
+
* agreement with the build-time manifest validation, which reads the same `mcpToolNameSegment`.
|
|
3370
|
+
*
|
|
3371
|
+
* @returns Naming options carrying the segment map, or `undefined` when no model declares one.
|
|
3372
|
+
*/ key: "_resolveToolNamingOptions",
|
|
3373
|
+
value: function _resolveToolNamingOptions() {
|
|
3374
|
+
var models = this._cachedManifestModels;
|
|
3375
|
+
var result;
|
|
3376
|
+
if (models != null && models.length > 0) {
|
|
3377
|
+
var modelSegments = new Map();
|
|
3378
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3379
|
+
try {
|
|
3380
|
+
for(var _iterator = models[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3381
|
+
var model = _step.value;
|
|
3382
|
+
if (model.mcpToolNameSegment != null && model.mcpToolNameSegment.length > 0) {
|
|
3383
|
+
modelSegments.set(model.modelType, model.mcpToolNameSegment);
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
} catch (err) {
|
|
3387
|
+
_didIteratorError = true;
|
|
3388
|
+
_iteratorError = err;
|
|
3389
|
+
} finally{
|
|
3390
|
+
try {
|
|
3391
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3392
|
+
_iterator.return();
|
|
3393
|
+
}
|
|
3394
|
+
} finally{
|
|
3395
|
+
if (_didIteratorError) {
|
|
3396
|
+
throw _iteratorError;
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
if (modelSegments.size > 0) {
|
|
3401
|
+
result = {
|
|
3402
|
+
modelSegments: modelSegments
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
return result;
|
|
3407
|
+
}
|
|
3408
|
+
},
|
|
3409
|
+
{
|
|
3410
|
+
/**
|
|
3411
|
+
* Logs one skipped tool at the appropriate level: name-cap and collision skips are errors (they
|
|
3412
|
+
* would otherwise break or shadow tools on the wire), the rest are warnings.
|
|
3413
|
+
*
|
|
3414
|
+
* @param skip - The skipped-tool report to log.
|
|
3415
|
+
*/ key: "_logSkip",
|
|
3416
|
+
value: function _logSkip(skip) {
|
|
3417
|
+
var errorSuffix = skip.error ? ": ".concat(skip.error.message) : '';
|
|
3418
|
+
if (skip.reason === 'name_too_long') {
|
|
3419
|
+
this._logger.error("Dropped MCP tool ".concat(skip.toolName, " — its name is ").concat(skip.toolName.length, " chars, over the ").concat(MCP_TOOL_NAME_MAX_LENGTH, "-char limit. Shorten the model/specifier, hide it (mcp.visibility: false), or set an mcp.name override."));
|
|
3420
|
+
} else if (skip.reason === 'duplicate_name') {
|
|
3421
|
+
this._logger.error("Dropped MCP tool ".concat(skip.toolName, " — another visible tool already resolved to this name. Give one an mcp.name override to disambiguate."));
|
|
3422
|
+
} else {
|
|
3423
|
+
this._logger.warn("Skipped MCP tool ".concat(skip.toolName, " (").concat(skip.reason, ")").concat(errorSuffix));
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
},
|
|
3427
|
+
{
|
|
3428
|
+
/**
|
|
3429
|
+
* Renders a human-readable boot-time warning for an MCP-result mapping inconsistency between a
|
|
3430
|
+
* handler's `mapSuccessfulResult` and the build-time manifest.
|
|
3431
|
+
*
|
|
3432
|
+
* @param warning - The tool-generation warning to describe.
|
|
3433
|
+
* @returns The log line to emit at startup.
|
|
3434
|
+
*/ key: "_describeToolGenerationWarning",
|
|
3435
|
+
value: function _describeToolGenerationWarning(warning) {
|
|
3436
|
+
var result;
|
|
3437
|
+
if (warning.reason === 'mapper_without_mapped_manifest') {
|
|
3438
|
+
result = "MCP tool ".concat(warning.toolName, " declares mcp.mapSuccessfulResult but its manifest entry has no mapped result type — annotate the matching '.api.ts' leaf with '@dbxModelApiMcpResult <TypeName>' and regenerate the manifest so the advertised output schema matches the mapped result.");
|
|
3439
|
+
} else {
|
|
3440
|
+
result = "MCP tool ".concat(warning.toolName, " has a '@dbxModelApiMcpResult' manifest annotation but its handler no longer declares mcp.mapSuccessfulResult — remove the stale annotation and regenerate the manifest, or restore the mapper.");
|
|
2913
3441
|
}
|
|
2914
3442
|
return result;
|
|
2915
3443
|
}
|
|
@@ -3422,7 +3950,7 @@ var McpServerFactoryService_1;
|
|
|
3422
3950
|
key: "_handleCallModelToolCall",
|
|
3423
3951
|
value: function _handleCallModelToolCall(definition, args, ctx) {
|
|
3424
3952
|
return _async_to_generator$2(function() {
|
|
3425
|
-
var params, outcome, result, error;
|
|
3953
|
+
var params, outcome, result, _tmp, error;
|
|
3426
3954
|
return _ts_generator$2(this, function(_state) {
|
|
3427
3955
|
switch(_state.label){
|
|
3428
3956
|
case 0:
|
|
@@ -3436,9 +3964,9 @@ var McpServerFactoryService_1;
|
|
|
3436
3964
|
case 1:
|
|
3437
3965
|
_state.trys.push([
|
|
3438
3966
|
1,
|
|
3439
|
-
|
|
3967
|
+
4,
|
|
3440
3968
|
,
|
|
3441
|
-
|
|
3969
|
+
5
|
|
3442
3970
|
]);
|
|
3443
3971
|
return [
|
|
3444
3972
|
4,
|
|
@@ -3446,14 +3974,18 @@ var McpServerFactoryService_1;
|
|
|
3446
3974
|
];
|
|
3447
3975
|
case 2:
|
|
3448
3976
|
result = _state.sent();
|
|
3449
|
-
|
|
3450
|
-
response: formatMcpToolResponse(result, params, definition.details)
|
|
3451
|
-
};
|
|
3977
|
+
_tmp = {};
|
|
3452
3978
|
return [
|
|
3453
|
-
|
|
3454
|
-
|
|
3979
|
+
4,
|
|
3980
|
+
formatMcpToolResponse(result, params, definition.details)
|
|
3455
3981
|
];
|
|
3456
3982
|
case 3:
|
|
3983
|
+
outcome = (_tmp.response = _state.sent(), _tmp);
|
|
3984
|
+
return [
|
|
3985
|
+
3,
|
|
3986
|
+
5
|
|
3987
|
+
];
|
|
3988
|
+
case 4:
|
|
3457
3989
|
error = _state.sent();
|
|
3458
3990
|
outcome = {
|
|
3459
3991
|
response: formatMcpToolErrorResponse(error),
|
|
@@ -3461,9 +3993,9 @@ var McpServerFactoryService_1;
|
|
|
3461
3993
|
};
|
|
3462
3994
|
return [
|
|
3463
3995
|
3,
|
|
3464
|
-
|
|
3996
|
+
5
|
|
3465
3997
|
];
|
|
3466
|
-
case
|
|
3998
|
+
case 5:
|
|
3467
3999
|
return [
|
|
3468
4000
|
2,
|
|
3469
4001
|
outcome
|
|
@@ -4277,4 +4809,4 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
4277
4809
|
};
|
|
4278
4810
|
}
|
|
4279
4811
|
|
|
4280
|
-
export { DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS, DEFAULT_MCP_ANALYTICS_EVENT_NAME, DEFAULT_MCP_PATH, DEFAULT_MCP_SERVER_INSTRUCTIONS, DEFAULT_MCP_SERVER_NAME, DEFAULT_SPECIFIER_KEY, DEFAULT_VOID_MCP_SUCCESS_VALUE, FIREBASE_SERVER_MCP_ANALYTICS_CONFIG, FIREBASE_SERVER_MCP_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, FirebaseServerMcpAnalyticsService, MCP_ANALYTICS_SERVICE, MCP_AUTH_ROLE_READER, MCP_MANIFEST_VERSION, MCP_MODEL_GET_BATCH_SIZE, MODEL_DECODE_DISPATCH_CALL, MODEL_DECODE_DISPATCH_MODEL_TYPE, MODEL_DECODE_TOOL_NAME, MODEL_GET_DISPATCH_CALL, MODEL_GET_DISPATCH_MODEL_TYPE, MODEL_GET_TOOL_NAME, MODEL_INFO_DISPATCH_CALL, MODEL_INFO_DISPATCH_MODEL_TYPE, MODEL_INFO_GROUPS_HINT, MODEL_INFO_TOOL_NAME, MODEL_INFO_UNGROUPED_LABEL, McpAnalyticsService, McpController, McpModuleConfig, McpServerFactoryService, McpWellKnownController, appMcpAnalyticsModuleMetadata, buildDefaultMcpToolDescription, buildMcpToolName, buildStaticWireEntry, classifyVisibility, createModelDecodeTool, createModelGetTool, createModelInfoTool, decodeFirestoreModelKey, findModelEntry, formatMcpToolErrorResponse, formatMcpToolResponse, generateMcpToolDefinitions, handleStreamableHttpMcpRequest, mcpManifestKey, mcpModuleMetadata, noopMcpAnalyticsService, resolveEffectiveReadOnly, resolveRequiredScope };
|
|
4812
|
+
export { DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS, DEFAULT_MCP_ANALYTICS_EVENT_NAME, DEFAULT_MCP_PATH, DEFAULT_MCP_SERVER_INSTRUCTIONS, DEFAULT_MCP_SERVER_NAME, DEFAULT_SPECIFIER_KEY, DEFAULT_VOID_MCP_SUCCESS_VALUE, FIREBASE_SERVER_MCP_ANALYTICS_CONFIG, FIREBASE_SERVER_MCP_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, FirebaseServerMcpAnalyticsService, MCP_ANALYTICS_SERVICE, MCP_AUTH_ROLE_READER, MCP_CALL_TYPE_ABBREVIATIONS, MCP_MANIFEST_VERSION, MCP_MODEL_GET_BATCH_SIZE, MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_WARN_LENGTH, MODEL_DECODE_DISPATCH_CALL, MODEL_DECODE_DISPATCH_MODEL_TYPE, MODEL_DECODE_TOOL_NAME, MODEL_GET_DISPATCH_CALL, MODEL_GET_DISPATCH_MODEL_TYPE, MODEL_GET_TOOL_NAME, MODEL_INFO_DISPATCH_CALL, MODEL_INFO_DISPATCH_MODEL_TYPE, MODEL_INFO_GROUPS_HINT, MODEL_INFO_TOOL_NAME, MODEL_INFO_UNGROUPED_LABEL, McpAnalyticsService, McpController, McpModuleConfig, McpServerFactoryService, McpWellKnownController, abbreviateMcpCallType, appMcpAnalyticsModuleMetadata, buildDefaultMcpToolDescription, buildDisambiguatedMcpToolName, buildMcpToolName, buildStaticWireEntry, classifyVisibility, createModelDecodeTool, createModelGetTool, createModelInfoTool, decodeFirestoreModelKey, findModelEntry, formatMcpToolErrorResponse, formatMcpToolResponse, generateMcpToolDefinitions, handleStreamableHttpMcpRequest, mcpManifestKey, mcpModuleMetadata, noopMcpAnalyticsService, resolveEffectiveReadOnly, resolveRequiredScope, validateMcpToolName };
|