@modelcontextprotocol/inspector 2.2.0 → 2.3.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.
@@ -407,6 +407,60 @@ function cleanRoots(roots) {
407
407
  function envRecordToPairs(env) {
408
408
  return env ? Object.entries(env).map(([key, value]) => ({ key, value })) : [];
409
409
  }
410
+ function envPairsToRecord(pairs) {
411
+ const out = {};
412
+ for (const { key, value } of pairs) {
413
+ if (key.trim() === "") continue;
414
+ out[key] = value;
415
+ }
416
+ return out;
417
+ }
418
+ function cleanAuthorizationParams(params) {
419
+ if (params === void 0) return void 0;
420
+ if (typeof params !== "object" || params === null || Array.isArray(params)) {
421
+ console.warn(
422
+ "Ignoring `oauth.authorizationParams`: expected an object of string values, got",
423
+ Array.isArray(params) ? "array" : typeof params
424
+ );
425
+ return void 0;
426
+ }
427
+ const out = {};
428
+ for (const [key, value] of Object.entries(params)) {
429
+ if (typeof value !== "string") {
430
+ console.warn(
431
+ `Dropping \`oauth.authorizationParams.${key}\`: expected a string value, got ${typeof value}.`
432
+ );
433
+ continue;
434
+ }
435
+ if (key.trim() === "") continue;
436
+ out[key] = value;
437
+ }
438
+ return Object.keys(out).length > 0 ? out : void 0;
439
+ }
440
+ function oauthAuthorizationParamsFromSettings(settings) {
441
+ if (!settings.oauthAuthorizationParams) return void 0;
442
+ const record2 = envPairsToRecord(settings.oauthAuthorizationParams);
443
+ return Object.keys(record2).length > 0 ? record2 : void 0;
444
+ }
445
+ function cleanEndpointOverride(value, field) {
446
+ if (value === void 0) return void 0;
447
+ if (typeof value !== "string") {
448
+ console.warn(
449
+ `Ignoring \`oauth.${field}\`: expected a string, got ${typeof value}.`
450
+ );
451
+ return void 0;
452
+ }
453
+ return value.trim() || void 0;
454
+ }
455
+ function oauthEndpointOverridesFromSettings(settings) {
456
+ const authorizationUrl = settings.oauthAuthorizationUrl?.trim();
457
+ const tokenUrl = settings.oauthTokenUrl?.trim();
458
+ if (!authorizationUrl && !tokenUrl) return void 0;
459
+ return {
460
+ ...authorizationUrl && { authorizationUrl },
461
+ ...tokenUrl && { tokenUrl }
462
+ };
463
+ }
410
464
  function storedFieldsToInspectorSettings(stored) {
411
465
  const hasAny = stored.headers !== void 0 || stored.metadata !== void 0 || stored.connectionTimeout !== void 0 || stored.requestTimeout !== void 0 || stored.taskTtl !== void 0 || stored.autoRefreshOnListChanged !== void 0 || stored.paginatedLists !== void 0 || stored.advertisedExtensions !== void 0 || stored.maxFetchRequests !== void 0 || stored.oauth !== void 0 || stored.roots !== void 0 || stored.protocolEra !== void 0 || stored.modernLogLevel !== void 0 || stored.env !== void 0 || stored.cwd !== void 0;
412
466
  if (!hasAny) return void 0;
@@ -444,6 +498,19 @@ function storedFieldsToInspectorSettings(stored) {
444
498
  if (stored.oauth?.clientSecret)
445
499
  settings.oauthClientSecret = stored.oauth.clientSecret;
446
500
  if (stored.oauth?.scopes) settings.oauthScopes = stored.oauth.scopes;
501
+ const authorizationParams = cleanAuthorizationParams(
502
+ stored.oauth?.authorizationParams
503
+ );
504
+ if (authorizationParams) {
505
+ settings.oauthAuthorizationParams = envRecordToPairs(authorizationParams);
506
+ }
507
+ const authorizationUrl = cleanEndpointOverride(
508
+ stored.oauth?.authorizationUrl,
509
+ "authorizationUrl"
510
+ );
511
+ if (authorizationUrl) settings.oauthAuthorizationUrl = authorizationUrl;
512
+ const tokenUrl = cleanEndpointOverride(stored.oauth?.tokenUrl, "tokenUrl");
513
+ if (tokenUrl) settings.oauthTokenUrl = tokenUrl;
447
514
  if (stored.oauth?.onInsufficientScope) {
448
515
  settings.oauthOnInsufficientScope = stored.oauth.onInsufficientScope;
449
516
  }
@@ -2539,7 +2606,10 @@ import {
2539
2606
  ListToolsResultSchema,
2540
2607
  ListResourcesResultSchema,
2541
2608
  ListResourceTemplatesResultSchema,
2542
- ListPromptsResultSchema
2609
+ ListPromptsResultSchema,
2610
+ ResourceSchema,
2611
+ ResourceTemplateSchema,
2612
+ PromptSchema
2543
2613
  } from "@modelcontextprotocol/core";
2544
2614
  import { AjvJsonSchemaValidator } from "@modelcontextprotocol/client/validators/ajv";
2545
2615
 
@@ -2559,16 +2629,322 @@ function validateToolOutput(provider, tool, result) {
2559
2629
  }
2560
2630
  }
2561
2631
 
2632
+ // ../../core/mcp/listSalvage.ts
2633
+ import { z as z2 } from "zod/v4";
2634
+ import { SdkError, SdkErrorCode } from "@modelcontextprotocol/client";
2635
+ import { ToolSchema } from "@modelcontextprotocol/core";
2636
+ var LIST_MAX_PAGES = 64;
2637
+ function listPaginationExceeded(method) {
2638
+ return new Error(
2639
+ `Salvage walk for ${method} exceeded ${LIST_MAX_PAGES} pages without the server's pagination converging`
2640
+ );
2641
+ }
2642
+ function isClientDecodeRejection(err) {
2643
+ return SdkError.isInstance(err) && (err.code === SdkErrorCode.InvalidResult || err.code === SdkErrorCode.UnsupportedResultType);
2644
+ }
2645
+ function isSalvageableRejection(err) {
2646
+ return SdkError.isInstance(err) && err.code === SdkErrorCode.InvalidResult;
2647
+ }
2648
+ function lenientListPageSchema(resultSchema, itemsKey) {
2649
+ return resultSchema.extend({ [itemsKey]: z2.array(z2.unknown()) });
2650
+ }
2651
+ function nextCursorOf(page) {
2652
+ if (typeof page !== "object" || page === null) return void 0;
2653
+ const value = page.nextCursor;
2654
+ return typeof value === "string" ? value : void 0;
2655
+ }
2656
+ var ModernResultEnvelopeSchema = z2.looseObject({
2657
+ resultType: z2.literal("complete"),
2658
+ // A non-negative INTEGER, matching the codec: `ttlMs: -1` or `0.5` is an
2659
+ // envelope violation the strict path rejects, and accepting it here on the
2660
+ // strength of an unrelated bad entry would hide it.
2661
+ ttlMs: z2.int().min(0),
2662
+ cacheScope: z2.enum(["public", "private"])
2663
+ });
2664
+ function rawItemsOf(page, itemsKey) {
2665
+ if (typeof page !== "object" || page === null) return void 0;
2666
+ const value = page[itemsKey];
2667
+ return Array.isArray(value) ? value : void 0;
2668
+ }
2669
+ function labelForRawItem(value) {
2670
+ if (typeof value !== "object" || value === null) return void 0;
2671
+ const record2 = value;
2672
+ for (const key of ["name", "uriTemplate", "uri", "title"]) {
2673
+ const candidate = record2[key];
2674
+ if (typeof candidate === "string" && candidate.length > 0) return candidate;
2675
+ }
2676
+ return void 0;
2677
+ }
2678
+ function describeIssues(error) {
2679
+ const [issue] = error.issues;
2680
+ if (!issue) return "did not match the expected shape";
2681
+ const path2 = issue.path.join(".");
2682
+ const detail = expectedDetail(issue);
2683
+ const message = detail ? `${issue.message} (${detail})` : issue.message;
2684
+ return path2.length > 0 ? `${path2}: ${message}` : message;
2685
+ }
2686
+ function expectedDetail(issue) {
2687
+ if (!("expected" in issue) || typeof issue.expected !== "string") {
2688
+ return void 0;
2689
+ }
2690
+ const detail = `expected ${issue.expected}`;
2691
+ return issue.message.includes(detail) ? void 0 : detail;
2692
+ }
2693
+ function salvageListItems({
2694
+ method,
2695
+ items,
2696
+ schema,
2697
+ startIndex = 0
2698
+ }) {
2699
+ const valid = [];
2700
+ const malformed = [];
2701
+ items.forEach((item, offset) => {
2702
+ const parsed = schema.safeParse(item);
2703
+ if (parsed.success) {
2704
+ valid.push(parsed.data);
2705
+ return;
2706
+ }
2707
+ const label = labelForRawItem(item);
2708
+ malformed.push({
2709
+ method,
2710
+ index: startIndex + offset,
2711
+ ...label !== void 0 && { label },
2712
+ reason: describeIssues(parsed.error)
2713
+ });
2714
+ });
2715
+ return { valid, malformed };
2716
+ }
2717
+ function summarizeMalformed(malformed) {
2718
+ const [first] = malformed;
2719
+ if (!first) return "";
2720
+ const where = first.label ?? `index ${first.index}`;
2721
+ const rest = malformed.length > 1 ? ` (+${malformed.length - 1} more)` : "";
2722
+ return `Dropped ${malformed.length} malformed ${malformed.length === 1 ? "entry" : "entries"} \u2014 ${where}: ${first.reason}${rest}`;
2723
+ }
2724
+ function toolItemSchemaForEra(isModern) {
2725
+ return isModern ? eraToolItemSchema(ModernToolWireSchema, stripExecution) : eraToolItemSchema(LegacyToolWireSchema, (tool) => tool);
2726
+ }
2727
+ var LegacyToolWireSchema = ToolSchema.extend({
2728
+ outputSchema: ToolSchema.shape.inputSchema.optional()
2729
+ });
2730
+ var ModernToolWireSchema = ToolSchema.extend({
2731
+ inputSchema: z2.looseObject({
2732
+ type: z2.literal("object"),
2733
+ $schema: z2.string().optional()
2734
+ })
2735
+ });
2736
+ function stripExecution(tool) {
2737
+ if (tool.execution === void 0) return tool;
2738
+ const { execution: _execution, ...rest } = tool;
2739
+ return rest;
2740
+ }
2741
+ function eraToolItemSchema(wire, normalize) {
2742
+ return wire.transform((parsed) => normalize(parsed));
2743
+ }
2744
+
2562
2745
  // ../../core/mcp/taskNotificationSchemas.ts
2563
2746
  import { NotificationSchema } from "@modelcontextprotocol/core";
2564
- import { z as z2 } from "zod/v4";
2747
+ import { z as z3 } from "zod/v4";
2565
2748
  var TasksListChangedNotificationSchema = NotificationSchema.extend({
2566
- method: z2.literal("notifications/tasks/list_changed"),
2567
- params: z2.record(z2.string(), z2.unknown()).optional()
2749
+ method: z3.literal("notifications/tasks/list_changed"),
2750
+ params: z3.record(z3.string(), z3.unknown()).optional()
2568
2751
  });
2569
2752
 
2570
- // ../../core/mcp/inspectorClient.ts
2753
+ // ../../core/mcp/uriTemplate.ts
2571
2754
  import { UriTemplate } from "@modelcontextprotocol/client";
2755
+ var OPERATORS = ["+", "#", ".", "/", ";", "?", "&"];
2756
+ var NAMED_OPERATORS = /* @__PURE__ */ new Set([";", "?", "&"]);
2757
+ var VARCHAR = String.raw`(?:[A-Za-z0-9_]|%[0-9A-Fa-f]{2})`;
2758
+ var TOLERATED_VARCHAR = String.raw`[-~]`;
2759
+ function varnameGrammar(varchar) {
2760
+ return `${varchar}(?:\\.?${varchar})*`;
2761
+ }
2762
+ var MODIFIER = String.raw`(?:\*|:([1-9][0-9]{0,3}))?`;
2763
+ var CONFORMING_VARSPEC = new RegExp(
2764
+ `^(${varnameGrammar(VARCHAR)})${MODIFIER}$`
2765
+ );
2766
+ var TOLERATED_VARSPEC = new RegExp(
2767
+ `^(${varnameGrammar(`(?:${VARCHAR}|${TOLERATED_VARCHAR})`)})${MODIFIER}$`
2768
+ );
2769
+ function parseVarSpec(raw) {
2770
+ const conforming = CONFORMING_VARSPEC.exec(raw);
2771
+ const match = conforming ?? TOLERATED_VARSPEC.exec(raw);
2772
+ if (match === null) return "invalid";
2773
+ const [, name, maxLength] = match;
2774
+ return {
2775
+ name,
2776
+ ...maxLength === void 0 ? {} : { maxLength: +maxLength },
2777
+ ...conforming === null ? { conforming: false } : {}
2778
+ };
2779
+ }
2780
+ function parseUriTemplate(uriTemplate) {
2781
+ const parts = [];
2782
+ let literal2 = "";
2783
+ let i2 = 0;
2784
+ while (i2 < uriTemplate.length) {
2785
+ if (uriTemplate[i2] !== "{") {
2786
+ literal2 += uriTemplate[i2];
2787
+ i2 += 1;
2788
+ continue;
2789
+ }
2790
+ const end = uriTemplate.indexOf("}", i2);
2791
+ if (end === -1) {
2792
+ literal2 += uriTemplate.slice(i2);
2793
+ break;
2794
+ }
2795
+ if (literal2) {
2796
+ parts.push({ kind: "literal", text: literal2 });
2797
+ literal2 = "";
2798
+ }
2799
+ const body = uriTemplate.slice(i2 + 1, end);
2800
+ const operator = OPERATORS.find((op) => body.startsWith(op)) ?? "";
2801
+ const parsed = body.slice(operator.length).split(",").map(parseVarSpec);
2802
+ const varspecs = parsed.filter(
2803
+ (spec) => spec !== "invalid"
2804
+ );
2805
+ parts.push({
2806
+ kind: "expression",
2807
+ source: uriTemplate.slice(i2, end + 1),
2808
+ operator,
2809
+ varspecs,
2810
+ names: varspecs.map((spec) => spec.name),
2811
+ invalid: parsed.includes("invalid")
2812
+ });
2813
+ i2 = end + 1;
2814
+ }
2815
+ if (literal2) parts.push({ kind: "literal", text: literal2 });
2816
+ return parts;
2817
+ }
2818
+ function readValue(values, name) {
2819
+ return Object.hasOwn(values, name) ? values[name] : void 0;
2820
+ }
2821
+ var ALLOW_RESERVED = /[^A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=]/gu;
2822
+ function encodeLiteral(text) {
2823
+ return text.split(/([{}])/g).map(
2824
+ (chunk, index) => index % 2 === 1 ? chunk : encodeAllowReserved(chunk)
2825
+ ).join("");
2826
+ }
2827
+ function encodeAllowReserved(value) {
2828
+ return value.split(/(%[0-9A-Fa-f]{2})/g).map(
2829
+ (chunk, index) => index % 2 === 1 ? chunk : chunk.replace(ALLOW_RESERVED, (char) => encodeURIComponent(char))
2830
+ ).join("");
2831
+ }
2832
+ var FORCE_ENCODED = {
2833
+ "!": "%21",
2834
+ "'": "%27",
2835
+ "(": "%28",
2836
+ ")": "%29",
2837
+ "*": "%2A"
2838
+ };
2839
+ function encodeUnreserved(value) {
2840
+ return encodeURIComponent(value).replace(
2841
+ /[!'()*]/g,
2842
+ (char) => FORCE_ENCODED[char]
2843
+ );
2844
+ }
2845
+ function allowsReserved(operator) {
2846
+ return operator === "+" || operator === "#";
2847
+ }
2848
+ function encodeValue(value, operator) {
2849
+ return allowsReserved(operator) ? encodeAllowReserved(value) : encodeUnreserved(value);
2850
+ }
2851
+ var CONTINUATION = String.raw`%[89AB][0-9A-F]`;
2852
+ var UTF8_SEQUENCE = [
2853
+ String.raw`(?:%F0%(?:9[0-9A-F]|[AB][0-9A-F])|%F[1-3]${CONTINUATION}|%F4%8[0-9A-F])${CONTINUATION}${CONTINUATION}`,
2854
+ String.raw`(?:%E0%[AB][0-9A-F]|%E[1-9ABCEF]${CONTINUATION}|%ED%[89][0-9A-F])${CONTINUATION}`,
2855
+ String.raw`%(?:C[2-9A-F]|D[0-9A-F])${CONTINUATION}`
2856
+ ].join("|");
2857
+ var PREFIX_UNIT = new RegExp(`${UTF8_SEQUENCE}|%[0-9A-F]{2}|[\\s\\S]`, "giu");
2858
+ function prefixUnits(value) {
2859
+ return value.match(PREFIX_UNIT) ?? [];
2860
+ }
2861
+ function renderValue(value, spec, operator) {
2862
+ const truncated = spec.maxLength === void 0 ? value : prefixUnits(value).slice(0, spec.maxLength).join("");
2863
+ return encodeValue(truncated, operator);
2864
+ }
2865
+ function expandTemplateExpression(part, values) {
2866
+ const present = part.varspecs.flatMap((spec) => {
2867
+ const value = readValue(values, spec.name);
2868
+ return value === void 0 ? [] : [{ spec, value }];
2869
+ });
2870
+ if (present.length === 0) return "";
2871
+ const { operator } = part;
2872
+ if (NAMED_OPERATORS.has(operator)) {
2873
+ const pairs = present.map(({ spec, value }) => {
2874
+ const rendered2 = renderValue(value, spec, operator);
2875
+ return operator === ";" && rendered2.length === 0 ? spec.name : `${spec.name}=${rendered2}`;
2876
+ });
2877
+ return operator === ";" ? `;${pairs.join(";")}` : `${operator}${pairs.join("&")}`;
2878
+ }
2879
+ const rendered = present.map(
2880
+ ({ spec, value }) => renderValue(value, spec, operator)
2881
+ );
2882
+ switch (operator) {
2883
+ case "#":
2884
+ return `#${rendered.join(",")}`;
2885
+ case ".":
2886
+ return `.${rendered.join(".")}`;
2887
+ case "/":
2888
+ return `/${rendered.join("/")}`;
2889
+ // "" and "+" — a bare comma-joined list, no prefix.
2890
+ default:
2891
+ return rendered.join(",");
2892
+ }
2893
+ }
2894
+ function expandParts(parts, values) {
2895
+ return parts.map(
2896
+ (part) => part.kind === "literal" ? encodeLiteral(part.text) : expandTemplateExpression(part, values)
2897
+ ).join("");
2898
+ }
2899
+ function expandUriTemplateStrict(uriTemplate, values) {
2900
+ const sdk = sdkTemplateError(uriTemplate);
2901
+ if (sdk) throw new Error(sdk);
2902
+ const parts = parseUriTemplate(uriTemplate);
2903
+ const invalid = partsError(uriTemplate, parts);
2904
+ if (invalid) throw new Error(invalid);
2905
+ const tooLong = valueLengthError(values, declaredNames(parts));
2906
+ if (tooLong) throw new Error(tooLong);
2907
+ return expandParts(parts, values);
2908
+ }
2909
+ function sdkTemplateError(uriTemplate) {
2910
+ try {
2911
+ new UriTemplate(uriTemplate);
2912
+ return null;
2913
+ } catch (error) {
2914
+ return error instanceof Error ? error.message : String(error);
2915
+ }
2916
+ }
2917
+ function partsError(uriTemplate, parts) {
2918
+ const stray = parts.find(
2919
+ (part) => part.kind === "literal" && /[{}]/.test(part.text)
2920
+ );
2921
+ if (stray) {
2922
+ return `Unmatched brace in "${uriTemplate}" \u2014 an expression must be a complete {\u2026}.`;
2923
+ }
2924
+ const bad = parts.find((part) => part.kind === "expression" && part.invalid);
2925
+ if (bad) {
2926
+ return `Invalid RFC 6570 varspec in "${uriTemplate}": ${bad.kind === "expression" ? bad.source : ""} \u2014 each varspec must name a variable, optionally with an explode (*) or a 1-9999 prefix modifier.`;
2927
+ }
2928
+ return null;
2929
+ }
2930
+ var MAX_VALUE_LENGTH = 1e6;
2931
+ function valueLengthError(values, names) {
2932
+ const considered = names === void 0 ? Object.keys(values) : [...new Set(names)];
2933
+ for (const name of considered) {
2934
+ const value = readValue(values, name);
2935
+ if (value !== void 0 && value.length > MAX_VALUE_LENGTH) {
2936
+ return `The value for "${name}" exceeds the ${MAX_VALUE_LENGTH}-character limit.`;
2937
+ }
2938
+ }
2939
+ return null;
2940
+ }
2941
+ function declaredNames(parts) {
2942
+ return [
2943
+ ...new Set(
2944
+ parts.flatMap((part) => part.kind === "expression" ? part.names : [])
2945
+ )
2946
+ ];
2947
+ }
2572
2948
 
2573
2949
  // ../../core/mcp/typedEventTarget.ts
2574
2950
  var TypedEventGeneric = class extends CustomEvent {
@@ -2835,6 +3211,136 @@ var ToolCallCancelledError = class extends Error {
2835
3211
  }
2836
3212
  };
2837
3213
 
3214
+ // ../../core/auth/endpointOverrides.ts
3215
+ var OVERRIDE_FIELDS = {
3216
+ authorizationUrl: "authorization_endpoint",
3217
+ tokenUrl: "token_endpoint"
3218
+ };
3219
+ function oauthEndpointUrlError(value) {
3220
+ const trimmed = value.trim();
3221
+ if (trimmed === "") return void 0;
3222
+ let parsed;
3223
+ try {
3224
+ parsed = new URL(trimmed);
3225
+ } catch {
3226
+ return `"${trimmed}" is not an absolute URL.`;
3227
+ }
3228
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
3229
+ return `"${trimmed}" is not an http(s) URL.`;
3230
+ }
3231
+ if (parsed.username || parsed.password) {
3232
+ return "URL must not contain a username or password.";
3233
+ }
3234
+ return void 0;
3235
+ }
3236
+ function normalizeEndpointUrl(value, field) {
3237
+ if (value === void 0) return void 0;
3238
+ const trimmed = value.trim();
3239
+ if (trimmed === "") return void 0;
3240
+ const error = oauthEndpointUrlError(trimmed);
3241
+ if (error) {
3242
+ console.warn(`[oauth] Ignoring \`${field}\`: ${error}`);
3243
+ return void 0;
3244
+ }
3245
+ return trimmed;
3246
+ }
3247
+ function normalizeOAuthEndpointOverrides(overrides) {
3248
+ if (!overrides) return void 0;
3249
+ const authorizationUrl = normalizeEndpointUrl(
3250
+ overrides.authorizationUrl,
3251
+ "authorizationUrl"
3252
+ );
3253
+ const tokenUrl = normalizeEndpointUrl(overrides.tokenUrl, "tokenUrl");
3254
+ if (!authorizationUrl && !tokenUrl) return void 0;
3255
+ return {
3256
+ ...authorizationUrl && { authorizationUrl },
3257
+ ...tokenUrl && { tokenUrl }
3258
+ };
3259
+ }
3260
+ function isAuthorizationServerMetadata(value) {
3261
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
3262
+ return false;
3263
+ }
3264
+ const doc = value;
3265
+ if (typeof doc.issuer !== "string") return false;
3266
+ return typeof doc.authorization_endpoint === "string" || typeof doc.token_endpoint === "string";
3267
+ }
3268
+ function applyOAuthEndpointOverrides(metadata, overrides) {
3269
+ const patched = { ...metadata };
3270
+ for (const [key, field] of Object.entries(OVERRIDE_FIELDS)) {
3271
+ const override = overrides[key];
3272
+ if (override) patched[field] = override;
3273
+ }
3274
+ return patched;
3275
+ }
3276
+ var AS_METADATA_WELL_KNOWN_PATHS = [
3277
+ "/.well-known/oauth-authorization-server",
3278
+ "/.well-known/openid-configuration"
3279
+ ];
3280
+ function requestUrlOf(input) {
3281
+ if (typeof input === "string") return input;
3282
+ if (input instanceof URL) return input.href;
3283
+ return input.url;
3284
+ }
3285
+ function isAuthorizationServerMetadataRequest(input) {
3286
+ const raw = requestUrlOf(input);
3287
+ let pathname;
3288
+ try {
3289
+ pathname = new URL(raw).pathname;
3290
+ } catch {
3291
+ pathname = raw;
3292
+ }
3293
+ return AS_METADATA_WELL_KNOWN_PATHS.some((path2) => pathname.includes(path2));
3294
+ }
3295
+ function isJsonDocumentResponse(contentType) {
3296
+ if (!contentType) return false;
3297
+ const mediaType = contentType.split(";")[0].trim().toLowerCase();
3298
+ return mediaType === "application/json" || mediaType.endsWith("+json");
3299
+ }
3300
+ function responseWithBody(response, body) {
3301
+ const headers = new Headers(response.headers);
3302
+ headers.delete("content-length");
3303
+ headers.delete("content-encoding");
3304
+ return new Response(body, {
3305
+ status: response.status,
3306
+ statusText: response.statusText,
3307
+ headers
3308
+ });
3309
+ }
3310
+ function withOAuthEndpointOverrides(fetchFn, getOverrides) {
3311
+ let lastKey;
3312
+ let lastNormalized;
3313
+ const resolveOverrides = () => {
3314
+ const raw = getOverrides();
3315
+ const key = JSON.stringify([raw?.authorizationUrl, raw?.tokenUrl]);
3316
+ if (key !== lastKey) {
3317
+ lastKey = key;
3318
+ lastNormalized = normalizeOAuthEndpointOverrides(raw);
3319
+ }
3320
+ return lastNormalized;
3321
+ };
3322
+ return async (input, init) => {
3323
+ const response = await fetchFn(input, init);
3324
+ const overrides = resolveOverrides();
3325
+ if (!overrides) return response;
3326
+ if (!isAuthorizationServerMetadataRequest(input)) return response;
3327
+ if (!response.ok) return response;
3328
+ if (!isJsonDocumentResponse(response.headers.get("content-type")))
3329
+ return response;
3330
+ let parsed;
3331
+ try {
3332
+ parsed = await response.clone().json();
3333
+ } catch {
3334
+ return response;
3335
+ }
3336
+ if (!isAuthorizationServerMetadata(parsed)) return response;
3337
+ return responseWithBody(
3338
+ response,
3339
+ JSON.stringify(applyOAuthEndpointOverrides(parsed, overrides))
3340
+ );
3341
+ };
3342
+ }
3343
+
2838
3344
  // ../../core/logging/logger.ts
2839
3345
  var noop = () => {
2840
3346
  };
@@ -2854,6 +3360,41 @@ function createSilentLogger() {
2854
3360
  }
2855
3361
  var silentLogger = createSilentLogger();
2856
3362
 
3363
+ // ../../core/auth/authorizationParams.ts
3364
+ var RESERVED_AUTHORIZATION_PARAMS = [
3365
+ "client_id",
3366
+ "code_challenge",
3367
+ "code_challenge_method",
3368
+ "redirect_uri",
3369
+ "resource",
3370
+ "response_type",
3371
+ "scope",
3372
+ "state"
3373
+ ];
3374
+ var RESERVED = new Set(RESERVED_AUTHORIZATION_PARAMS);
3375
+ function isReservedAuthorizationParam(key) {
3376
+ return RESERVED.has(key.trim().toLowerCase());
3377
+ }
3378
+ function applyAuthorizationParams(authorizationUrl, params) {
3379
+ if (!params) return authorizationUrl;
3380
+ const applicable = Object.entries(params).filter(([key]) => {
3381
+ if (key.trim() === "") return false;
3382
+ if (isReservedAuthorizationParam(key)) {
3383
+ console.warn(
3384
+ `[oauth] Ignoring reserved authorization parameter "${key.trim()}" \u2014 it is set by the authorization flow.`
3385
+ );
3386
+ return false;
3387
+ }
3388
+ return true;
3389
+ });
3390
+ if (applicable.length === 0) return authorizationUrl;
3391
+ const merged = new URL(authorizationUrl.href);
3392
+ for (const [key, value] of applicable) {
3393
+ merged.searchParams.set(key.trim(), value);
3394
+ }
3395
+ return merged;
3396
+ }
3397
+
2857
3398
  // ../../core/auth/providers.ts
2858
3399
  var MutableRedirectUrlProvider = class {
2859
3400
  redirectUrl = "";
@@ -2889,12 +3430,15 @@ var BaseOAuthClientProvider = class {
2889
3430
  redirectUrlProvider;
2890
3431
  navigation;
2891
3432
  clientMetadataUrl;
3433
+ /** Custom authorization-request parameters (#2018). Authorize URL only. */
3434
+ authorizationParams;
2892
3435
  constructor(serverUrl, oauthConfig) {
2893
3436
  this.serverUrl = serverUrl;
2894
3437
  this.storage = oauthConfig.storage;
2895
3438
  this.redirectUrlProvider = oauthConfig.redirectUrlProvider;
2896
3439
  this.navigation = oauthConfig.navigation;
2897
3440
  this.clientMetadataUrl = oauthConfig.clientMetadataUrl;
3441
+ this.authorizationParams = oauthConfig.authorizationParams;
2898
3442
  }
2899
3443
  /**
2900
3444
  * Load persisted scope into {@link cachedScope} before SDK `auth()` (which
@@ -3001,6 +3545,27 @@ var BaseOAuthClientProvider = class {
3001
3545
  });
3002
3546
  }
3003
3547
  redirectToAuthorization(authorizationUrl) {
3548
+ this.performAuthorizationRedirect(
3549
+ applyAuthorizationParams(authorizationUrl, this.authorizationParams)
3550
+ );
3551
+ }
3552
+ /**
3553
+ * Redirect to an authorize URL belonging to a **different** authorization
3554
+ * server than the one this provider was configured for, so the per-server
3555
+ * custom parameters (#2018) MUST NOT be applied.
3556
+ *
3557
+ * The only caller is the enterprise-managed (EMA) transport provider, which
3558
+ * discards the resource AS URL and sends the user to the enterprise IdP
3559
+ * instead. Parameters a user configured for their MCP server's authorization
3560
+ * server — a `kc_idp_hint`, an `audience` — are meaningless and potentially
3561
+ * flow-breaking on the IdP's, and appending them there would leak per-server
3562
+ * config across an authorization-server boundary.
3563
+ */
3564
+ redirectToExternalAuthorization(authorizationUrl) {
3565
+ this.performAuthorizationRedirect(authorizationUrl);
3566
+ }
3567
+ /** Capture, announce, and navigate to a finished authorize URL. */
3568
+ performAuthorizationRedirect(authorizationUrl) {
3004
3569
  this.capturedAuthUrl = authorizationUrl;
3005
3570
  if (!this.suppressAuthorizationNavigation) {
3006
3571
  if (this.eventTarget) {
@@ -3865,7 +4430,7 @@ var EmaTransportOAuthProvider = class {
3865
4430
  async redirectToAuthorization(_authorizationUrl) {
3866
4431
  const idpAuthorizationUrl = await startEmaIdpAuthorization(this.emaConfig);
3867
4432
  this.inner.clearCapturedAuthUrl();
3868
- this.inner.redirectToAuthorization(idpAuthorizationUrl);
4433
+ this.inner.redirectToExternalAuthorization(idpAuthorizationUrl);
3869
4434
  }
3870
4435
  saveCodeVerifier(codeVerifier) {
3871
4436
  return this.inner.saveCodeVerifier(codeVerifier);
@@ -3982,6 +4547,30 @@ var OAuthManager = class {
3982
4547
  getServerUrl() {
3983
4548
  return this.params.getServerUrl();
3984
4549
  }
4550
+ /**
4551
+ * The per-server authorization/token endpoint overrides, read live so a
4552
+ * `setOAuthConfig` between requests takes effect without rebuilding the
4553
+ * client's fetch. `InspectorClient` reads this from inside its fetch wrapper.
4554
+ * (#1906)
4555
+ *
4556
+ * Returns nothing under enterprise-managed authorization, for the same reason
4557
+ * `redirectToExternalAuthorization` skips the custom authorization parameters
4558
+ * (#2018): the EMA leg authorizes against the enterprise IdP, a *different*
4559
+ * authorization server, and its OIDC discovery runs through this same fetch
4560
+ * (`emaFlow` → `idpOidc`). Rewriting that document would point the IdP login —
4561
+ * or the IdP code/refresh-token exchange — at the resource server's
4562
+ * authorization server, which is both wrong and a way to leak an IdP
4563
+ * credential across an authorization-server boundary.
4564
+ */
4565
+ getEndpointOverrides() {
4566
+ if (this.isEnterpriseManaged()) return void 0;
4567
+ const { authorizationUrl, tokenUrl } = this.oauthConfig;
4568
+ if (!authorizationUrl && !tokenUrl) return void 0;
4569
+ return {
4570
+ ...authorizationUrl && { authorizationUrl },
4571
+ ...tokenUrl && { tokenUrl }
4572
+ };
4573
+ }
3985
4574
  /**
3986
4575
  * Return the configured OAuth storage, throwing a clear error if it is
3987
4576
  * absent. Used on the EMA re-mint/persist paths, which are only reached for
@@ -4005,7 +4594,12 @@ var OAuthManager = class {
4005
4594
  storage: this.oauthConfig.storage,
4006
4595
  redirectUrlProvider: this.oauthConfig.redirectUrlProvider,
4007
4596
  navigation: this.oauthConfig.navigation,
4008
- clientMetadataUrl: this.oauthConfig.clientMetadataUrl
4597
+ clientMetadataUrl: this.oauthConfig.clientMetadataUrl,
4598
+ // #2018: per-server custom authorization-request parameters. Carried on
4599
+ // the provider (not in OAuth storage like `scope`) — they are pure config
4600
+ // read from mcp.json, and nothing in the flow needs to persist or union
4601
+ // them.
4602
+ authorizationParams: this.oauthConfig.authorizationParams
4009
4603
  });
4010
4604
  provider.setEventTarget(this.params.getEventTarget());
4011
4605
  await provider.prepareForAuth();
@@ -5231,6 +5825,11 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
5231
5825
  // annotations (SEP-2243), recomputed on every aggregate tools refresh and
5232
5826
  // surfaced so the Tools tab can show why a tool vanished (#1632).
5233
5827
  excludedTools = [];
5828
+ // Entries the Inspector dropped from a list result because they failed the
5829
+ // spec schema for that primitive, keyed by list method. Populated only by the
5830
+ // salvage fallback in `listAllSalvaging` — empty against a conforming server
5831
+ // (#1909).
5832
+ malformedListItems = /* @__PURE__ */ new Map();
5234
5833
  // The capabilities this Inspector client advertises to the server during the
5235
5834
  // initialize handshake. Built once in setupClient() and snapshotted here so
5236
5835
  // UI surfaces (Server Info modal) can display them without poking at the
@@ -5409,6 +6008,10 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
5409
6008
  resources: options.listChangedNotifications?.resources ?? true,
5410
6009
  prompts: options.listChangedNotifications?.prompts ?? true
5411
6010
  };
6011
+ this.fetchFn = withOAuthEndpointOverrides(
6012
+ this.fetchFn ?? fetch,
6013
+ () => this.oauthManager?.getEndpointOverrides()
6014
+ );
5412
6015
  this.effectiveAuthFetch = this.buildEffectiveAuthFetch();
5413
6016
  this.sessionId = options.sessionId;
5414
6017
  if (options.oauth || options.environment.oauth) {
@@ -5436,6 +6039,11 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
5436
6039
  });
5437
6040
  }
5438
6041
  const clientOptions = {
6042
+ // Bound the SDK's auto-aggregate with the SAME constant the #1909 salvage
6043
+ // re-walks use, so the strict path and its fallback cannot drift apart.
6044
+ // This is the SDK's own default today; setting it explicitly is what makes
6045
+ // the shared value a fact rather than a copied guess.
6046
+ listMaxPages: LIST_MAX_PAGES,
5439
6047
  // Per-server protocol era (SEP §7.8), threaded from config via
5440
6048
  // `eraToVersionNegotiation` and defaulted to `{ mode: "legacy" }` in the
5441
6049
  // constructor. "legacy" keeps the wire byte-identical to a 2025 client;
@@ -6105,6 +6713,14 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6105
6713
  this.cancelledTaskIds.clear();
6106
6714
  this.outboundRequestMethods.clear();
6107
6715
  this.lastAnsweredRequestByMethod.clear();
6716
+ if (this.malformedListItems.size > 0) {
6717
+ this.malformedListItems.clear();
6718
+ this.dispatchTypedEvent("malformedListItemsChange", []);
6719
+ }
6720
+ if (this.excludedTools.length > 0) {
6721
+ this.excludedTools = [];
6722
+ this.dispatchTypedEvent("excludedToolsChange", []);
6723
+ }
6108
6724
  for (const [, controller] of this.taskInputAbortControllers) {
6109
6725
  controller.abort(new Error("Connection ended"));
6110
6726
  }
@@ -6328,7 +6944,7 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6328
6944
  this.status = "connected";
6329
6945
  this.dispatchTypedEvent("statusChange", this.status);
6330
6946
  await this.fetchServerInfo();
6331
- if (this.initialLoggingLevel && this.capabilities?.logging) {
6947
+ if (this.initialLoggingLevel && this.capabilities?.logging && this.protocolEra !== "modern") {
6332
6948
  await this.client.setLoggingLevel(
6333
6949
  this.initialLoggingLevel,
6334
6950
  this.getRequestOptions()
@@ -6473,6 +7089,7 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6473
7089
  this.protocolEra = void 0;
6474
7090
  this.discoverResult = void 0;
6475
7091
  this.excludedTools = [];
7092
+ this.malformedListItems.clear();
6476
7093
  this.modernLogLevel = void 0;
6477
7094
  this.dispatchTypedEvent("pendingSamplesChange", this.pendingSamples);
6478
7095
  this.dispatchTypedEvent(
@@ -6486,6 +7103,7 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6486
7103
  this.dispatchTypedEvent("protocolEraChange", this.protocolEra);
6487
7104
  this.dispatchTypedEvent("discoverResultChange", this.discoverResult);
6488
7105
  this.dispatchTypedEvent("excludedToolsChange", this.excludedTools);
7106
+ this.dispatchTypedEvent("malformedListItemsChange", []);
6489
7107
  }
6490
7108
  /**
6491
7109
  * Returns a client proxy for use by AppRenderer / @mcp-ui. Delegates to the
@@ -6579,7 +7197,6 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6579
7197
  * `clientCapabilities` carrying the tasks extension). We reproduce it here.
6580
7198
  */
6581
7199
  withModernTaskEnvelope(params) {
6582
- const existingMeta = params._meta ?? {};
6583
7200
  const clientCapabilities = {
6584
7201
  ...this.clientCapabilities,
6585
7202
  // Force-stamp the tasks extension regardless of what the client
@@ -6591,6 +7208,26 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
6591
7208
  [TASKS_EXTENSION_KEY]: {}
6592
7209
  }
6593
7210
  };
7211
+ return this.withModernEnvelope(params, clientCapabilities);
7212
+ }
7213
+ /**
7214
+ * Stamp the `_meta` envelope every raw-wire request needs on the modern leg:
7215
+ * the negotiated protocol version, the client identity, and the client
7216
+ * capabilities.
7217
+ *
7218
+ * Split out of {@link withModernTaskEnvelope} so the list-salvage re-walk
7219
+ * (#1909) can reuse it WITHOUT that method's force-stamped tasks extension —
7220
+ * a `tools/list` has no business claiming an extension the user may have
7221
+ * deliberately turned off (#1738).
7222
+ *
7223
+ * The NEGOTIATED protocol version is used so the envelope agrees with the
7224
+ * `MCP-Protocol-Version` header the transport stamps from the same source — a
7225
+ * future modern-family revision would negotiate a different string, and the
7226
+ * two must not disagree. The raw channel only runs on a connected modern
7227
+ * session, so this is always set; the constant is a defensive fallback.
7228
+ */
7229
+ withModernEnvelope(params, clientCapabilities = this.clientCapabilities) {
7230
+ const existingMeta = params._meta ?? {};
6594
7231
  const protocolVersion = this.getProtocolVersion() ?? MODERN_PROTOCOL_VERSION2;
6595
7232
  return {
6596
7233
  ...params,
@@ -7187,7 +7824,11 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
7187
7824
  const effectiveMeta = this.mergeMeta(metadata);
7188
7825
  const params = {
7189
7826
  ...effectiveMeta ? { _meta: effectiveMeta } : {},
7190
- ...cursor ? { cursor } : {}
7827
+ // `!== undefined`, not truthiness: "" is a valid cursor. Dropping it asks
7828
+ // for page one again — and `listToolsForScan` pairs this call with a
7829
+ // fallback that already preserves it, so the two legs of one scan page
7830
+ // would otherwise disagree about which page they fetched.
7831
+ ...cursor !== void 0 && { cursor }
7191
7832
  };
7192
7833
  const response = await this.invokeMcpClient(
7193
7834
  () => this.client.request(
@@ -7215,19 +7856,29 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
7215
7856
  if (!this.client) {
7216
7857
  throw new Error("Client is not connected");
7217
7858
  }
7218
- const response = await this.invokeMcpClient(
7219
- () => this.client.listTools(
7220
- this.aggregateListParams(options?.metadata),
7221
- this.getCacheableRequestOptions(options?.cacheMode)
7222
- )
7223
- );
7859
+ const tools = await this.listAllSalvaging({
7860
+ method: "tools/list",
7861
+ itemsKey: "tools",
7862
+ resultSchema: ListToolsResultSchema,
7863
+ // Era-aware: the neutral `ToolSchema` is more permissive than the
7864
+ // negotiated era's wire schema — see `toolItemSchemaForEra`.
7865
+ itemSchema: toolItemSchemaForEra(this.isModernEra()),
7866
+ metadata: options?.metadata,
7867
+ finalize: (salvaged) => this.excludeInvalidXMcpHeaderTools(salvaged),
7868
+ aggregate: async () => [
7869
+ ...(await this.client.listTools(
7870
+ this.aggregateListParams(options?.metadata),
7871
+ this.getCacheableRequestOptions(options?.cacheMode)
7872
+ )).tools
7873
+ ]
7874
+ });
7224
7875
  await this.refreshExcludedTools(options?.metadata).catch((err) => {
7225
7876
  this.logger.warn(
7226
7877
  { err },
7227
7878
  "Excluded-tools walk failed; the SEP-2243 excluded list may be incomplete"
7228
7879
  );
7229
7880
  });
7230
- return { tools: [...response.tools] };
7881
+ return { tools };
7231
7882
  }
7232
7883
  /**
7233
7884
  * Whether this connection excludes tools with invalid `x-mcp-header`
@@ -7258,6 +7909,202 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
7258
7909
  if (id === void 0) return;
7259
7910
  this.dispatchTypedEvent("responseRejected", { id, reason });
7260
7911
  }
7912
+ /**
7913
+ * Put the method's response correlation back where it was before a salvage
7914
+ * re-walk, so a caller that goes on to mark the failure still marks the
7915
+ * ORIGINAL rejected response.
7916
+ *
7917
+ * The re-walk answers the same method, so on any rethrow path the map points
7918
+ * at a lenient page that succeeded. `ManagedListState.refresh()` catches the
7919
+ * rethrown error and calls `markResponseRejected(method, ...)`, which would
7920
+ * then stamp "Rejected by the Inspector" onto that page and leave the real
7921
+ * one rendering clean — the same misattribution the capture inside
7922
+ * `salvageList` exists to prevent, just one frame further out. Deleting when
7923
+ * nothing had answered before makes the outer mark a no-op rather than a lie.
7924
+ */
7925
+ restoreResponseCorrelation(method, id) {
7926
+ if (id === void 0) this.lastAnsweredRequestByMethod.delete(method);
7927
+ else this.lastAnsweredRequestByMethod.set(method, id);
7928
+ }
7929
+ /** Every entry dropped from a list result as malformed, across methods (#1909). */
7930
+ getMalformedListItems() {
7931
+ return [...this.malformedListItems.values()].flat();
7932
+ }
7933
+ /**
7934
+ * Record (or clear) the malformed entries for one list method and notify.
7935
+ *
7936
+ * A no-op when the method had none and still has none, so the common case —
7937
+ * every conforming refresh, of which there are many — costs no event and no
7938
+ * re-render.
7939
+ */
7940
+ setMalformedListItems(method, malformed) {
7941
+ const previous = this.malformedListItems.get(method) ?? [];
7942
+ if (previous.length === 0 && malformed.length === 0) return;
7943
+ if (malformed.length === 0) this.malformedListItems.delete(method);
7944
+ else this.malformedListItems.set(method, malformed);
7945
+ this.dispatchTypedEvent(
7946
+ "malformedListItemsChange",
7947
+ this.getMalformedListItems()
7948
+ );
7949
+ }
7950
+ /**
7951
+ * Run a list aggregate, falling back to a per-item salvage when the SDK
7952
+ * rejects the result it received (#1909).
7953
+ *
7954
+ * The strict aggregate runs first and unchanged, so a conforming server pays
7955
+ * nothing: no extra request, no extra parse, and the SDK's response cache
7956
+ * still serves it. Only an `InvalidResult` rejection — a response in hand
7957
+ * that failed validation — reaches {@link salvageList}; every other failure
7958
+ * (transport drop, timeout, server-sent error) rethrows untouched, because
7959
+ * re-listing would not produce anything to salvage.
7960
+ */
7961
+ async listAllSalvaging({
7962
+ method,
7963
+ itemsKey,
7964
+ itemSchema,
7965
+ resultSchema,
7966
+ aggregate,
7967
+ metadata,
7968
+ finalize
7969
+ }) {
7970
+ try {
7971
+ const items = await this.invokeMcpClient(aggregate, { method });
7972
+ this.setMalformedListItems(method, []);
7973
+ return items;
7974
+ } catch (err) {
7975
+ if (!isSalvageableRejection(err)) throw err;
7976
+ const salvaged = await this.salvageList({
7977
+ method,
7978
+ itemsKey,
7979
+ itemSchema,
7980
+ resultSchema,
7981
+ metadata,
7982
+ err
7983
+ });
7984
+ return finalize ? finalize(salvaged) : salvaged;
7985
+ }
7986
+ }
7987
+ /**
7988
+ * Drop the tools the SDK would have excluded from `tools/list` for invalid
7989
+ * `x-mcp-header` annotations (SEP-2243).
7990
+ *
7991
+ * The strict aggregate is filtered by the SDK before we see it, so the
7992
+ * salvage path has to reapply the same rule itself: otherwise one ordinary
7993
+ * malformed tool anywhere in the list would trip the fallback and quietly
7994
+ * readmit every invalid-header tool alongside it — turning a rendering fix
7995
+ * into a spec violation. The dropped tools are still reported through
7996
+ * `refreshExcludedTools`, which lists them with their reason.
7997
+ */
7998
+ excludeInvalidXMcpHeaderTools(tools) {
7999
+ if (!this.excludesInvalidXMcpHeaderTools()) return tools;
8000
+ return tools.filter(
8001
+ (tool) => scanXMcpHeaderDeclarations(tool.inputSchema).valid
8002
+ );
8003
+ }
8004
+ /**
8005
+ * Re-walk a list method with pagination validated but entries left raw, then
8006
+ * validate each entry on its own — keeping the good ones and reporting the
8007
+ * rest (#1909).
8008
+ *
8009
+ * Two deliberate properties:
8010
+ *
8011
+ * - **The original error wins when nothing is salvageable.** If every entry
8012
+ * validates here, the strict rejection was about something else (a
8013
+ * top-level field, an era codec decision), so there is no per-item story to
8014
+ * tell and swallowing it would hide a real failure. Rethrow the original.
8015
+ * - **A salvaged response is still a rejected response.** The Protocol entry
8016
+ * is marked (#1953) with what was dropped, so the wire truth survives even
8017
+ * though the list now renders.
8018
+ *
8019
+ * This walk is deliberately un-cached (it uses the raw per-page path), which
8020
+ * is fine: it only runs against a server that just returned a non-conforming
8021
+ * result.
8022
+ */
8023
+ async salvageList({
8024
+ method,
8025
+ itemsKey,
8026
+ itemSchema,
8027
+ resultSchema,
8028
+ metadata,
8029
+ err
8030
+ }) {
8031
+ const pageSchema = lenientListPageSchema(resultSchema, itemsKey);
8032
+ const rejectedResponseId = this.lastAnsweredRequestByMethod.get(method);
8033
+ const valid = [];
8034
+ const malformed = [];
8035
+ const seenCursors = /* @__PURE__ */ new Set();
8036
+ let cursor;
8037
+ let pages = 0;
8038
+ try {
8039
+ do {
8040
+ if (pages >= LIST_MAX_PAGES) throw listPaginationExceeded(method);
8041
+ pages += 1;
8042
+ const effectiveMeta = this.mergeMeta(metadata);
8043
+ const params = {
8044
+ ...effectiveMeta ? { _meta: effectiveMeta } : {},
8045
+ // `!== undefined`, not truthiness: "" is a valid cursor, and dropping it
8046
+ // would re-request page one and duplicate its entries until the
8047
+ // repeated-cursor guard below stopped the walk.
8048
+ ...cursor !== void 0 && { cursor }
8049
+ };
8050
+ const page = await this.invokeMcpClient(
8051
+ () => this.isModernEra() ? this.rawWireRequest(
8052
+ method,
8053
+ this.withModernEnvelope(params),
8054
+ pageSchema
8055
+ ) : this.client.request(
8056
+ { method, params },
8057
+ pageSchema,
8058
+ this.getRequestOptions(metadata?.progressToken)
8059
+ ),
8060
+ { method }
8061
+ );
8062
+ if (this.isModernEra() && !ModernResultEnvelopeSchema.safeParse(page).success) {
8063
+ throw err;
8064
+ }
8065
+ const items = rawItemsOf(page, itemsKey);
8066
+ if (items === void 0) throw err;
8067
+ const salvaged = salvageListItems({
8068
+ method,
8069
+ items,
8070
+ schema: itemSchema,
8071
+ startIndex: valid.length + malformed.length
8072
+ });
8073
+ valid.push(...salvaged.valid);
8074
+ malformed.push(...salvaged.malformed);
8075
+ cursor = nextCursorOf(page);
8076
+ if (cursor !== void 0) {
8077
+ if (seenCursors.has(cursor)) break;
8078
+ seenCursors.add(cursor);
8079
+ }
8080
+ } while (cursor !== void 0);
8081
+ } catch (walkErr) {
8082
+ if (walkErr !== err) {
8083
+ this.logger.warn(
8084
+ { err: walkErr, method },
8085
+ "Salvage re-walk failed; surfacing the original list error"
8086
+ );
8087
+ }
8088
+ this.restoreResponseCorrelation(method, rejectedResponseId);
8089
+ throw err;
8090
+ }
8091
+ if (malformed.length === 0) {
8092
+ this.restoreResponseCorrelation(method, rejectedResponseId);
8093
+ throw err;
8094
+ }
8095
+ if (rejectedResponseId !== void 0) {
8096
+ this.dispatchTypedEvent("responseRejected", {
8097
+ id: rejectedResponseId,
8098
+ reason: summarizeMalformed(malformed)
8099
+ });
8100
+ }
8101
+ this.setMalformedListItems(method, malformed);
8102
+ this.logger.warn(
8103
+ { method, malformed },
8104
+ "Dropped malformed entries from a list result; the rest of the list was kept"
8105
+ );
8106
+ return valid;
8107
+ }
7261
8108
  /** The current SEP-2243 excluded-tools set (empty on legacy/stdio). */
7262
8109
  getExcludedTools() {
7263
8110
  return this.excludedTools;
@@ -7276,8 +8123,11 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
7276
8123
  if (this.excludesInvalidXMcpHeaderTools()) {
7277
8124
  const seenCursors = /* @__PURE__ */ new Set();
7278
8125
  let cursor;
8126
+ let pages = 0;
7279
8127
  do {
7280
- const page = await this.listTools(cursor, metadata);
8128
+ if (pages >= LIST_MAX_PAGES) throw listPaginationExceeded("tools/list");
8129
+ pages += 1;
8130
+ const page = await this.listToolsForScan(cursor, metadata);
7281
8131
  for (const tool of page.tools) {
7282
8132
  const scan = scanXMcpHeaderDeclarations(tool.inputSchema);
7283
8133
  if (!scan.valid) excluded.push({ tool, reason: scan.reason });
@@ -7293,6 +8143,90 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
7293
8143
  this.dispatchTypedEvent("excludedToolsChange", excluded);
7294
8144
  return excluded;
7295
8145
  }
8146
+ /**
8147
+ * One page of the RAW `tools/list` for the SEP-2243 scan, tolerating a
8148
+ * malformed sibling entry (#1632 + #1909).
8149
+ *
8150
+ * The scan needs the unfiltered list, so it uses the strict single-page call
8151
+ * — but that call rejects the whole page when any entry is non-conforming,
8152
+ * which would blank the excluded set and leave a tool that vanished for an
8153
+ * invalid header with no explanation at all. That is the same failure #1909
8154
+ * is about, one level down. So on a decode rejection the page is re-fetched
8155
+ * leniently and scanned entry by entry.
8156
+ *
8157
+ * The malformed ones are not "excluded tools" and are not returned: they
8158
+ * describe THIS exchange, not the aggregate the Tools panel renders, so they
8159
+ * surface as the rejection reason on this response's own Protocol entry and
8160
+ * go no further (see `refreshExcludedTools`).
8161
+ */
8162
+ async listToolsForScan(cursor, metadata) {
8163
+ try {
8164
+ return await this.listTools(cursor, metadata);
8165
+ } catch (err) {
8166
+ if (!isSalvageableRejection(err)) throw err;
8167
+ const rejectedResponseId = this.lastAnsweredRequestByMethod.get("tools/list");
8168
+ try {
8169
+ const effectiveMeta = this.mergeMeta(metadata);
8170
+ const params = {
8171
+ ...effectiveMeta ? { _meta: effectiveMeta } : {},
8172
+ // See `salvageList`: "" is a valid cursor.
8173
+ ...cursor !== void 0 && { cursor }
8174
+ };
8175
+ const pageSchema = lenientListPageSchema(
8176
+ ListToolsResultSchema,
8177
+ "tools"
8178
+ );
8179
+ const page = await this.invokeMcpClient(
8180
+ () => this.isModernEra() ? this.rawWireRequest(
8181
+ "tools/list",
8182
+ this.withModernEnvelope(params),
8183
+ pageSchema
8184
+ ) : this.client.request(
8185
+ { method: "tools/list", params },
8186
+ pageSchema,
8187
+ this.getRequestOptions(metadata?.progressToken)
8188
+ ),
8189
+ { method: "tools/list" }
8190
+ );
8191
+ if (this.isModernEra() && !ModernResultEnvelopeSchema.safeParse(page).success) {
8192
+ throw err;
8193
+ }
8194
+ const items = rawItemsOf(page, "tools");
8195
+ if (items === void 0) throw err;
8196
+ const { valid, malformed } = salvageListItems({
8197
+ method: "tools/list",
8198
+ items,
8199
+ schema: toolItemSchemaForEra(this.isModernEra())
8200
+ });
8201
+ if (rejectedResponseId !== void 0) {
8202
+ this.dispatchTypedEvent("responseRejected", {
8203
+ id: rejectedResponseId,
8204
+ reason: malformed.length > 0 ? summarizeMalformed(malformed) : err instanceof Error ? err.message : String(err)
8205
+ });
8206
+ }
8207
+ const nextCursor = nextCursorOf(page);
8208
+ return {
8209
+ tools: valid,
8210
+ ...nextCursor !== void 0 && { nextCursor }
8211
+ };
8212
+ } catch (fallbackErr) {
8213
+ if (rejectedResponseId !== void 0) {
8214
+ this.dispatchTypedEvent("responseRejected", {
8215
+ id: rejectedResponseId,
8216
+ reason: err instanceof Error ? err.message : String(err)
8217
+ });
8218
+ }
8219
+ if (fallbackErr !== err) {
8220
+ this.logger.warn(
8221
+ { err: fallbackErr },
8222
+ "Excluded-tools salvage re-fetch failed; surfacing the original list error"
8223
+ );
8224
+ }
8225
+ this.restoreResponseCorrelation("tools/list", rejectedResponseId);
8226
+ throw err;
8227
+ }
8228
+ }
8229
+ }
7296
8230
  /**
7297
8231
  * Call a tool. Caller must provide the Tool (e.g. from a state manager).
7298
8232
  * @param tool The tool to call (use tool.name for the request)
@@ -8079,13 +9013,20 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
8079
9013
  if (!this.client) {
8080
9014
  throw new Error("Client is not connected");
8081
9015
  }
8082
- const response = await this.invokeMcpClient(
8083
- () => this.client.listResources(
8084
- this.aggregateListParams(options?.metadata),
8085
- this.getCacheableRequestOptions(options?.cacheMode)
8086
- )
8087
- );
8088
- return { resources: [...response.resources] };
9016
+ const resources = await this.listAllSalvaging({
9017
+ method: "resources/list",
9018
+ itemsKey: "resources",
9019
+ resultSchema: ListResourcesResultSchema,
9020
+ itemSchema: ResourceSchema,
9021
+ metadata: options?.metadata,
9022
+ aggregate: async () => [
9023
+ ...(await this.client.listResources(
9024
+ this.aggregateListParams(options?.metadata),
9025
+ this.getCacheableRequestOptions(options?.cacheMode)
9026
+ )).resources
9027
+ ]
9028
+ });
9029
+ return { resources };
8089
9030
  }
8090
9031
  /**
8091
9032
  * Read a resource by URI
@@ -8141,8 +9082,7 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
8141
9082
  const uriTemplateString = uriTemplate;
8142
9083
  let expandedUri;
8143
9084
  try {
8144
- const uriTemplate2 = new UriTemplate(uriTemplateString);
8145
- expandedUri = uriTemplate2.expand(params);
9085
+ expandedUri = expandUriTemplateStrict(uriTemplateString, params);
8146
9086
  } catch (error) {
8147
9087
  throw new Error(
8148
9088
  `Failed to expand URI template "${uriTemplate}": ${error instanceof Error ? error.message : String(error)}`,
@@ -8204,14 +9144,20 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
8204
9144
  if (!this.client) {
8205
9145
  throw new Error("Client is not connected");
8206
9146
  }
8207
- const response = await this.invokeMcpClient(
8208
- () => this.client.listResourceTemplates(
8209
- this.aggregateListParams(options?.metadata),
8210
- this.getCacheableRequestOptions(options?.cacheMode)
8211
- ),
8212
- { method: "resources/templates/list" }
8213
- );
8214
- return { resourceTemplates: [...response.resourceTemplates] };
9147
+ const resourceTemplates = await this.listAllSalvaging({
9148
+ method: "resources/templates/list",
9149
+ itemsKey: "resourceTemplates",
9150
+ resultSchema: ListResourceTemplatesResultSchema,
9151
+ itemSchema: ResourceTemplateSchema,
9152
+ metadata: options?.metadata,
9153
+ aggregate: async () => [
9154
+ ...(await this.client.listResourceTemplates(
9155
+ this.aggregateListParams(options?.metadata),
9156
+ this.getCacheableRequestOptions(options?.cacheMode)
9157
+ )).resourceTemplates
9158
+ ]
9159
+ });
9160
+ return { resourceTemplates };
8215
9161
  }
8216
9162
  /**
8217
9163
  * List available prompts with pagination support
@@ -8250,13 +9196,20 @@ var InspectorClient = class _InspectorClient extends InspectorClientEventTarget
8250
9196
  if (!this.client) {
8251
9197
  throw new Error("Client is not connected");
8252
9198
  }
8253
- const response = await this.invokeMcpClient(
8254
- () => this.client.listPrompts(
8255
- this.aggregateListParams(options?.metadata),
8256
- this.getCacheableRequestOptions(options?.cacheMode)
8257
- )
8258
- );
8259
- return { prompts: [...response.prompts] };
9199
+ const prompts = await this.listAllSalvaging({
9200
+ method: "prompts/list",
9201
+ itemsKey: "prompts",
9202
+ resultSchema: ListPromptsResultSchema,
9203
+ itemSchema: PromptSchema,
9204
+ metadata: options?.metadata,
9205
+ aggregate: async () => [
9206
+ ...(await this.client.listPrompts(
9207
+ this.aggregateListParams(options?.metadata),
9208
+ this.getCacheableRequestOptions(options?.cacheMode)
9209
+ )).prompts
9210
+ ]
9211
+ });
9212
+ return { prompts };
8260
9213
  }
8261
9214
  /**
8262
9215
  * Get a prompt by name
@@ -9411,11 +10364,7 @@ async function consumeMethodOutcome(outcome, args) {
9411
10364
  }
9412
10365
 
9413
10366
  // ../../core/mcp/state/managedListState.ts
9414
- import { SdkError, SdkErrorCode } from "@modelcontextprotocol/client";
9415
10367
  var DEFAULT_LIST_CHANGED_DEBOUNCE_MS = 250;
9416
- function isClientDecodeRejection(err) {
9417
- return SdkError.isInstance(err) && (err.code === SdkErrorCode.InvalidResult || err.code === SdkErrorCode.UnsupportedResultType);
9418
- }
9419
10368
  var ManagedListState = class extends TypedEventTarget {
9420
10369
  items = [];
9421
10370
  client = null;
@@ -10024,29 +10973,29 @@ var ManagedRequestorTasksState = class extends TypedEventTarget {
10024
10973
  };
10025
10974
 
10026
10975
  // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
10027
- import * as z3 from "zod/v4";
10976
+ import * as z4 from "zod/v4";
10028
10977
  var RELATED_TASK_META_KEY4 = "io.modelcontextprotocol/related-task";
10029
10978
  var JSONRPC_VERSION = "2.0";
10030
- var AssertObjectSchema = z3.custom((v2) => v2 !== null && (typeof v2 === "object" || typeof v2 === "function"));
10031
- var ProgressTokenSchema = z3.union([z3.string(), z3.number().int()]);
10032
- var CursorSchema = z3.string();
10033
- var TaskCreationParamsSchema = z3.looseObject({
10979
+ var AssertObjectSchema = z4.custom((v2) => v2 !== null && (typeof v2 === "object" || typeof v2 === "function"));
10980
+ var ProgressTokenSchema = z4.union([z4.string(), z4.number().int()]);
10981
+ var CursorSchema = z4.string();
10982
+ var TaskCreationParamsSchema = z4.looseObject({
10034
10983
  /**
10035
10984
  * Requested duration in milliseconds to retain task from creation.
10036
10985
  */
10037
- ttl: z3.number().optional(),
10986
+ ttl: z4.number().optional(),
10038
10987
  /**
10039
10988
  * Time in milliseconds to wait between task status requests.
10040
10989
  */
10041
- pollInterval: z3.number().optional()
10990
+ pollInterval: z4.number().optional()
10042
10991
  });
10043
- var TaskMetadataSchema = z3.object({
10044
- ttl: z3.number().optional()
10992
+ var TaskMetadataSchema = z4.object({
10993
+ ttl: z4.number().optional()
10045
10994
  });
10046
- var RelatedTaskMetadataSchema = z3.object({
10047
- taskId: z3.string()
10995
+ var RelatedTaskMetadataSchema = z4.object({
10996
+ taskId: z4.string()
10048
10997
  });
10049
- var RequestMetaSchema = z3.looseObject({
10998
+ var RequestMetaSchema = z4.looseObject({
10050
10999
  /**
10051
11000
  * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
10052
11001
  */
@@ -10056,7 +11005,7 @@ var RequestMetaSchema = z3.looseObject({
10056
11005
  */
10057
11006
  [RELATED_TASK_META_KEY4]: RelatedTaskMetadataSchema.optional()
10058
11007
  });
10059
- var BaseRequestParamsSchema = z3.object({
11008
+ var BaseRequestParamsSchema = z4.object({
10060
11009
  /**
10061
11010
  * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
10062
11011
  */
@@ -10073,40 +11022,40 @@ var TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
10073
11022
  */
10074
11023
  task: TaskMetadataSchema.optional()
10075
11024
  });
10076
- var RequestSchema = z3.object({
10077
- method: z3.string(),
11025
+ var RequestSchema = z4.object({
11026
+ method: z4.string(),
10078
11027
  params: BaseRequestParamsSchema.loose().optional()
10079
11028
  });
10080
- var NotificationsParamsSchema = z3.object({
11029
+ var NotificationsParamsSchema = z4.object({
10081
11030
  /**
10082
11031
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10083
11032
  * for notes on _meta usage.
10084
11033
  */
10085
11034
  _meta: RequestMetaSchema.optional()
10086
11035
  });
10087
- var NotificationSchema2 = z3.object({
10088
- method: z3.string(),
11036
+ var NotificationSchema2 = z4.object({
11037
+ method: z4.string(),
10089
11038
  params: NotificationsParamsSchema.loose().optional()
10090
11039
  });
10091
- var ResultSchema = z3.looseObject({
11040
+ var ResultSchema = z4.looseObject({
10092
11041
  /**
10093
11042
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10094
11043
  * for notes on _meta usage.
10095
11044
  */
10096
11045
  _meta: RequestMetaSchema.optional()
10097
11046
  });
10098
- var RequestIdSchema = z3.union([z3.string(), z3.number().int()]);
10099
- var JSONRPCRequestSchema = z3.object({
10100
- jsonrpc: z3.literal(JSONRPC_VERSION),
11047
+ var RequestIdSchema = z4.union([z4.string(), z4.number().int()]);
11048
+ var JSONRPCRequestSchema = z4.object({
11049
+ jsonrpc: z4.literal(JSONRPC_VERSION),
10101
11050
  id: RequestIdSchema,
10102
11051
  ...RequestSchema.shape
10103
11052
  }).strict();
10104
- var JSONRPCNotificationSchema = z3.object({
10105
- jsonrpc: z3.literal(JSONRPC_VERSION),
11053
+ var JSONRPCNotificationSchema = z4.object({
11054
+ jsonrpc: z4.literal(JSONRPC_VERSION),
10106
11055
  ...NotificationSchema2.shape
10107
11056
  }).strict();
10108
- var JSONRPCResultResponseSchema = z3.object({
10109
- jsonrpc: z3.literal(JSONRPC_VERSION),
11057
+ var JSONRPCResultResponseSchema = z4.object({
11058
+ jsonrpc: z4.literal(JSONRPC_VERSION),
10110
11059
  id: RequestIdSchema,
10111
11060
  result: ResultSchema
10112
11061
  }).strict();
@@ -10121,31 +11070,31 @@ var ErrorCode;
10121
11070
  ErrorCode2[ErrorCode2["InternalError"] = -32603] = "InternalError";
10122
11071
  ErrorCode2[ErrorCode2["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
10123
11072
  })(ErrorCode || (ErrorCode = {}));
10124
- var JSONRPCErrorResponseSchema = z3.object({
10125
- jsonrpc: z3.literal(JSONRPC_VERSION),
11073
+ var JSONRPCErrorResponseSchema = z4.object({
11074
+ jsonrpc: z4.literal(JSONRPC_VERSION),
10126
11075
  id: RequestIdSchema.optional(),
10127
- error: z3.object({
11076
+ error: z4.object({
10128
11077
  /**
10129
11078
  * The error type that occurred.
10130
11079
  */
10131
- code: z3.number().int(),
11080
+ code: z4.number().int(),
10132
11081
  /**
10133
11082
  * A short description of the error. The message SHOULD be limited to a concise single sentence.
10134
11083
  */
10135
- message: z3.string(),
11084
+ message: z4.string(),
10136
11085
  /**
10137
11086
  * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
10138
11087
  */
10139
- data: z3.unknown().optional()
11088
+ data: z4.unknown().optional()
10140
11089
  })
10141
11090
  }).strict();
10142
- var JSONRPCMessageSchema = z3.union([
11091
+ var JSONRPCMessageSchema = z4.union([
10143
11092
  JSONRPCRequestSchema,
10144
11093
  JSONRPCNotificationSchema,
10145
11094
  JSONRPCResultResponseSchema,
10146
11095
  JSONRPCErrorResponseSchema
10147
11096
  ]);
10148
- var JSONRPCResponseSchema = z3.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
11097
+ var JSONRPCResponseSchema = z4.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
10149
11098
  var EmptyResultSchema2 = ResultSchema.strict();
10150
11099
  var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
10151
11100
  /**
@@ -10157,28 +11106,28 @@ var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
10157
11106
  /**
10158
11107
  * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
10159
11108
  */
10160
- reason: z3.string().optional()
11109
+ reason: z4.string().optional()
10161
11110
  });
10162
11111
  var CancelledNotificationSchema = NotificationSchema2.extend({
10163
- method: z3.literal("notifications/cancelled"),
11112
+ method: z4.literal("notifications/cancelled"),
10164
11113
  params: CancelledNotificationParamsSchema
10165
11114
  });
10166
- var IconSchema = z3.object({
11115
+ var IconSchema = z4.object({
10167
11116
  /**
10168
11117
  * URL or data URI for the icon.
10169
11118
  */
10170
- src: z3.string(),
11119
+ src: z4.string(),
10171
11120
  /**
10172
11121
  * Optional MIME type for the icon.
10173
11122
  */
10174
- mimeType: z3.string().optional(),
11123
+ mimeType: z4.string().optional(),
10175
11124
  /**
10176
11125
  * Optional array of strings that specify sizes at which the icon can be used.
10177
11126
  * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
10178
11127
  *
10179
11128
  * If not provided, the client should assume that the icon can be used at any size.
10180
11129
  */
10181
- sizes: z3.array(z3.string()).optional(),
11130
+ sizes: z4.array(z4.string()).optional(),
10182
11131
  /**
10183
11132
  * Optional specifier for the theme this icon is designed for. `light` indicates
10184
11133
  * the icon is designed to be used with a light background, and `dark` indicates
@@ -10186,9 +11135,9 @@ var IconSchema = z3.object({
10186
11135
  *
10187
11136
  * If not provided, the client should assume the icon can be used with any theme.
10188
11137
  */
10189
- theme: z3.enum(["light", "dark"]).optional()
11138
+ theme: z4.enum(["light", "dark"]).optional()
10190
11139
  });
10191
- var IconsSchema = z3.object({
11140
+ var IconsSchema = z4.object({
10192
11141
  /**
10193
11142
  * Optional set of sized icons that the client can display in a user interface.
10194
11143
  *
@@ -10200,11 +11149,11 @@ var IconsSchema = z3.object({
10200
11149
  * - `image/svg+xml` - SVG images (scalable but requires security precautions)
10201
11150
  * - `image/webp` - WebP images (modern, efficient format)
10202
11151
  */
10203
- icons: z3.array(IconSchema).optional()
11152
+ icons: z4.array(IconSchema).optional()
10204
11153
  });
10205
- var BaseMetadataSchema = z3.object({
11154
+ var BaseMetadataSchema = z4.object({
10206
11155
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
10207
- name: z3.string(),
11156
+ name: z4.string(),
10208
11157
  /**
10209
11158
  * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
10210
11159
  * even by those unfamiliar with domain-specific terminology.
@@ -10213,16 +11162,16 @@ var BaseMetadataSchema = z3.object({
10213
11162
  * where `annotations.title` should be given precedence over using `name`,
10214
11163
  * if present).
10215
11164
  */
10216
- title: z3.string().optional()
11165
+ title: z4.string().optional()
10217
11166
  });
10218
11167
  var ImplementationSchema = BaseMetadataSchema.extend({
10219
11168
  ...BaseMetadataSchema.shape,
10220
11169
  ...IconsSchema.shape,
10221
- version: z3.string(),
11170
+ version: z4.string(),
10222
11171
  /**
10223
11172
  * An optional URL of the website for this implementation.
10224
11173
  */
10225
- websiteUrl: z3.string().optional(),
11174
+ websiteUrl: z4.string().optional(),
10226
11175
  /**
10227
11176
  * An optional human-readable description of what this implementation does.
10228
11177
  *
@@ -10230,23 +11179,23 @@ var ImplementationSchema = BaseMetadataSchema.extend({
10230
11179
  * and capabilities. For example, a server might describe the types of resources
10231
11180
  * or tools it provides, while a client might describe its intended use case.
10232
11181
  */
10233
- description: z3.string().optional()
11182
+ description: z4.string().optional()
10234
11183
  });
10235
- var FormElicitationCapabilitySchema = z3.intersection(z3.object({
10236
- applyDefaults: z3.boolean().optional()
10237
- }), z3.record(z3.string(), z3.unknown()));
10238
- var ElicitationCapabilitySchema = z3.preprocess((value) => {
11184
+ var FormElicitationCapabilitySchema = z4.intersection(z4.object({
11185
+ applyDefaults: z4.boolean().optional()
11186
+ }), z4.record(z4.string(), z4.unknown()));
11187
+ var ElicitationCapabilitySchema = z4.preprocess((value) => {
10239
11188
  if (value && typeof value === "object" && !Array.isArray(value)) {
10240
11189
  if (Object.keys(value).length === 0) {
10241
11190
  return { form: {} };
10242
11191
  }
10243
11192
  }
10244
11193
  return value;
10245
- }, z3.intersection(z3.object({
11194
+ }, z4.intersection(z4.object({
10246
11195
  form: FormElicitationCapabilitySchema.optional(),
10247
11196
  url: AssertObjectSchema.optional()
10248
- }), z3.record(z3.string(), z3.unknown()).optional()));
10249
- var ClientTasksCapabilitySchema = z3.looseObject({
11197
+ }), z4.record(z4.string(), z4.unknown()).optional()));
11198
+ var ClientTasksCapabilitySchema = z4.looseObject({
10250
11199
  /**
10251
11200
  * Present if the client supports listing tasks.
10252
11201
  */
@@ -10258,22 +11207,22 @@ var ClientTasksCapabilitySchema = z3.looseObject({
10258
11207
  /**
10259
11208
  * Capabilities for task creation on specific request types.
10260
11209
  */
10261
- requests: z3.looseObject({
11210
+ requests: z4.looseObject({
10262
11211
  /**
10263
11212
  * Task support for sampling requests.
10264
11213
  */
10265
- sampling: z3.looseObject({
11214
+ sampling: z4.looseObject({
10266
11215
  createMessage: AssertObjectSchema.optional()
10267
11216
  }).optional(),
10268
11217
  /**
10269
11218
  * Task support for elicitation requests.
10270
11219
  */
10271
- elicitation: z3.looseObject({
11220
+ elicitation: z4.looseObject({
10272
11221
  create: AssertObjectSchema.optional()
10273
11222
  }).optional()
10274
11223
  }).optional()
10275
11224
  });
10276
- var ServerTasksCapabilitySchema = z3.looseObject({
11225
+ var ServerTasksCapabilitySchema = z4.looseObject({
10277
11226
  /**
10278
11227
  * Present if the server supports listing tasks.
10279
11228
  */
@@ -10285,24 +11234,24 @@ var ServerTasksCapabilitySchema = z3.looseObject({
10285
11234
  /**
10286
11235
  * Capabilities for task creation on specific request types.
10287
11236
  */
10288
- requests: z3.looseObject({
11237
+ requests: z4.looseObject({
10289
11238
  /**
10290
11239
  * Task support for tool requests.
10291
11240
  */
10292
- tools: z3.looseObject({
11241
+ tools: z4.looseObject({
10293
11242
  call: AssertObjectSchema.optional()
10294
11243
  }).optional()
10295
11244
  }).optional()
10296
11245
  });
10297
- var ClientCapabilitiesSchema = z3.object({
11246
+ var ClientCapabilitiesSchema = z4.object({
10298
11247
  /**
10299
11248
  * Experimental, non-standard capabilities that the client supports.
10300
11249
  */
10301
- experimental: z3.record(z3.string(), AssertObjectSchema).optional(),
11250
+ experimental: z4.record(z4.string(), AssertObjectSchema).optional(),
10302
11251
  /**
10303
11252
  * Present if the client supports sampling from an LLM.
10304
11253
  */
10305
- sampling: z3.object({
11254
+ sampling: z4.object({
10306
11255
  /**
10307
11256
  * Present if the client supports context inclusion via includeContext parameter.
10308
11257
  * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
@@ -10320,11 +11269,11 @@ var ClientCapabilitiesSchema = z3.object({
10320
11269
  /**
10321
11270
  * Present if the client supports listing roots.
10322
11271
  */
10323
- roots: z3.object({
11272
+ roots: z4.object({
10324
11273
  /**
10325
11274
  * Whether the client supports issuing notifications for changes to the roots list.
10326
11275
  */
10327
- listChanged: z3.boolean().optional()
11276
+ listChanged: z4.boolean().optional()
10328
11277
  }).optional(),
10329
11278
  /**
10330
11279
  * Present if the client supports task creation.
@@ -10333,25 +11282,25 @@ var ClientCapabilitiesSchema = z3.object({
10333
11282
  /**
10334
11283
  * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
10335
11284
  */
10336
- extensions: z3.record(z3.string(), AssertObjectSchema).optional()
11285
+ extensions: z4.record(z4.string(), AssertObjectSchema).optional()
10337
11286
  });
10338
11287
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
10339
11288
  /**
10340
11289
  * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
10341
11290
  */
10342
- protocolVersion: z3.string(),
11291
+ protocolVersion: z4.string(),
10343
11292
  capabilities: ClientCapabilitiesSchema,
10344
11293
  clientInfo: ImplementationSchema
10345
11294
  });
10346
11295
  var InitializeRequestSchema = RequestSchema.extend({
10347
- method: z3.literal("initialize"),
11296
+ method: z4.literal("initialize"),
10348
11297
  params: InitializeRequestParamsSchema
10349
11298
  });
10350
- var ServerCapabilitiesSchema = z3.object({
11299
+ var ServerCapabilitiesSchema = z4.object({
10351
11300
  /**
10352
11301
  * Experimental, non-standard capabilities that the server supports.
10353
11302
  */
10354
- experimental: z3.record(z3.string(), AssertObjectSchema).optional(),
11303
+ experimental: z4.record(z4.string(), AssertObjectSchema).optional(),
10355
11304
  /**
10356
11305
  * Present if the server supports sending log messages to the client.
10357
11306
  */
@@ -10363,33 +11312,33 @@ var ServerCapabilitiesSchema = z3.object({
10363
11312
  /**
10364
11313
  * Present if the server offers any prompt templates.
10365
11314
  */
10366
- prompts: z3.object({
11315
+ prompts: z4.object({
10367
11316
  /**
10368
11317
  * Whether this server supports issuing notifications for changes to the prompt list.
10369
11318
  */
10370
- listChanged: z3.boolean().optional()
11319
+ listChanged: z4.boolean().optional()
10371
11320
  }).optional(),
10372
11321
  /**
10373
11322
  * Present if the server offers any resources to read.
10374
11323
  */
10375
- resources: z3.object({
11324
+ resources: z4.object({
10376
11325
  /**
10377
11326
  * Whether this server supports clients subscribing to resource updates.
10378
11327
  */
10379
- subscribe: z3.boolean().optional(),
11328
+ subscribe: z4.boolean().optional(),
10380
11329
  /**
10381
11330
  * Whether this server supports issuing notifications for changes to the resource list.
10382
11331
  */
10383
- listChanged: z3.boolean().optional()
11332
+ listChanged: z4.boolean().optional()
10384
11333
  }).optional(),
10385
11334
  /**
10386
11335
  * Present if the server offers any tools to call.
10387
11336
  */
10388
- tools: z3.object({
11337
+ tools: z4.object({
10389
11338
  /**
10390
11339
  * Whether this server supports issuing notifications for changes to the tool list.
10391
11340
  */
10392
- listChanged: z3.boolean().optional()
11341
+ listChanged: z4.boolean().optional()
10393
11342
  }).optional(),
10394
11343
  /**
10395
11344
  * Present if the server supports task creation.
@@ -10398,13 +11347,13 @@ var ServerCapabilitiesSchema = z3.object({
10398
11347
  /**
10399
11348
  * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
10400
11349
  */
10401
- extensions: z3.record(z3.string(), AssertObjectSchema).optional()
11350
+ extensions: z4.record(z4.string(), AssertObjectSchema).optional()
10402
11351
  });
10403
11352
  var InitializeResultSchema = ResultSchema.extend({
10404
11353
  /**
10405
11354
  * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
10406
11355
  */
10407
- protocolVersion: z3.string(),
11356
+ protocolVersion: z4.string(),
10408
11357
  capabilities: ServerCapabilitiesSchema,
10409
11358
  serverInfo: ImplementationSchema,
10410
11359
  /**
@@ -10412,31 +11361,31 @@ var InitializeResultSchema = ResultSchema.extend({
10412
11361
  *
10413
11362
  * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
10414
11363
  */
10415
- instructions: z3.string().optional()
11364
+ instructions: z4.string().optional()
10416
11365
  });
10417
11366
  var InitializedNotificationSchema = NotificationSchema2.extend({
10418
- method: z3.literal("notifications/initialized"),
11367
+ method: z4.literal("notifications/initialized"),
10419
11368
  params: NotificationsParamsSchema.optional()
10420
11369
  });
10421
11370
  var PingRequestSchema = RequestSchema.extend({
10422
- method: z3.literal("ping"),
11371
+ method: z4.literal("ping"),
10423
11372
  params: BaseRequestParamsSchema.optional()
10424
11373
  });
10425
- var ProgressSchema = z3.object({
11374
+ var ProgressSchema = z4.object({
10426
11375
  /**
10427
11376
  * The progress thus far. This should increase every time progress is made, even if the total is unknown.
10428
11377
  */
10429
- progress: z3.number(),
11378
+ progress: z4.number(),
10430
11379
  /**
10431
11380
  * Total number of items to process (or total progress required), if known.
10432
11381
  */
10433
- total: z3.optional(z3.number()),
11382
+ total: z4.optional(z4.number()),
10434
11383
  /**
10435
11384
  * An optional message describing the current progress.
10436
11385
  */
10437
- message: z3.optional(z3.string())
11386
+ message: z4.optional(z4.string())
10438
11387
  });
10439
- var ProgressNotificationParamsSchema = z3.object({
11388
+ var ProgressNotificationParamsSchema = z4.object({
10440
11389
  ...NotificationsParamsSchema.shape,
10441
11390
  ...ProgressSchema.shape,
10442
11391
  /**
@@ -10445,7 +11394,7 @@ var ProgressNotificationParamsSchema = z3.object({
10445
11394
  progressToken: ProgressTokenSchema
10446
11395
  });
10447
11396
  var ProgressNotificationSchema = NotificationSchema2.extend({
10448
- method: z3.literal("notifications/progress"),
11397
+ method: z4.literal("notifications/progress"),
10449
11398
  params: ProgressNotificationParamsSchema
10450
11399
  });
10451
11400
  var PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
@@ -10465,86 +11414,86 @@ var PaginatedResultSchema = ResultSchema.extend({
10465
11414
  */
10466
11415
  nextCursor: CursorSchema.optional()
10467
11416
  });
10468
- var TaskStatusSchema = z3.enum(["working", "input_required", "completed", "failed", "cancelled"]);
10469
- var TaskSchema = z3.object({
10470
- taskId: z3.string(),
11417
+ var TaskStatusSchema = z4.enum(["working", "input_required", "completed", "failed", "cancelled"]);
11418
+ var TaskSchema = z4.object({
11419
+ taskId: z4.string(),
10471
11420
  status: TaskStatusSchema,
10472
11421
  /**
10473
11422
  * Time in milliseconds to keep task results available after completion.
10474
11423
  * If null, the task has unlimited lifetime until manually cleaned up.
10475
11424
  */
10476
- ttl: z3.union([z3.number(), z3.null()]),
11425
+ ttl: z4.union([z4.number(), z4.null()]),
10477
11426
  /**
10478
11427
  * ISO 8601 timestamp when the task was created.
10479
11428
  */
10480
- createdAt: z3.string(),
11429
+ createdAt: z4.string(),
10481
11430
  /**
10482
11431
  * ISO 8601 timestamp when the task was last updated.
10483
11432
  */
10484
- lastUpdatedAt: z3.string(),
10485
- pollInterval: z3.optional(z3.number()),
11433
+ lastUpdatedAt: z4.string(),
11434
+ pollInterval: z4.optional(z4.number()),
10486
11435
  /**
10487
11436
  * Optional diagnostic message for failed tasks or other status information.
10488
11437
  */
10489
- statusMessage: z3.optional(z3.string())
11438
+ statusMessage: z4.optional(z4.string())
10490
11439
  });
10491
11440
  var CreateTaskResultSchema2 = ResultSchema.extend({
10492
11441
  task: TaskSchema
10493
11442
  });
10494
11443
  var TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);
10495
11444
  var TaskStatusNotificationSchema2 = NotificationSchema2.extend({
10496
- method: z3.literal("notifications/tasks/status"),
11445
+ method: z4.literal("notifications/tasks/status"),
10497
11446
  params: TaskStatusNotificationParamsSchema
10498
11447
  });
10499
11448
  var GetTaskRequestSchema2 = RequestSchema.extend({
10500
- method: z3.literal("tasks/get"),
11449
+ method: z4.literal("tasks/get"),
10501
11450
  params: BaseRequestParamsSchema.extend({
10502
- taskId: z3.string()
11451
+ taskId: z4.string()
10503
11452
  })
10504
11453
  });
10505
11454
  var GetTaskResultSchema2 = ResultSchema.merge(TaskSchema);
10506
11455
  var GetTaskPayloadRequestSchema2 = RequestSchema.extend({
10507
- method: z3.literal("tasks/result"),
11456
+ method: z4.literal("tasks/result"),
10508
11457
  params: BaseRequestParamsSchema.extend({
10509
- taskId: z3.string()
11458
+ taskId: z4.string()
10510
11459
  })
10511
11460
  });
10512
11461
  var GetTaskPayloadResultSchema = ResultSchema.loose();
10513
11462
  var ListTasksRequestSchema2 = PaginatedRequestSchema.extend({
10514
- method: z3.literal("tasks/list")
11463
+ method: z4.literal("tasks/list")
10515
11464
  });
10516
11465
  var ListTasksResultSchema2 = PaginatedResultSchema.extend({
10517
- tasks: z3.array(TaskSchema)
11466
+ tasks: z4.array(TaskSchema)
10518
11467
  });
10519
11468
  var CancelTaskRequestSchema2 = RequestSchema.extend({
10520
- method: z3.literal("tasks/cancel"),
11469
+ method: z4.literal("tasks/cancel"),
10521
11470
  params: BaseRequestParamsSchema.extend({
10522
- taskId: z3.string()
11471
+ taskId: z4.string()
10523
11472
  })
10524
11473
  });
10525
11474
  var CancelTaskResultSchema2 = ResultSchema.merge(TaskSchema);
10526
- var ResourceContentsSchema = z3.object({
11475
+ var ResourceContentsSchema = z4.object({
10527
11476
  /**
10528
11477
  * The URI of this resource.
10529
11478
  */
10530
- uri: z3.string(),
11479
+ uri: z4.string(),
10531
11480
  /**
10532
11481
  * The MIME type of this resource, if known.
10533
11482
  */
10534
- mimeType: z3.optional(z3.string()),
11483
+ mimeType: z4.optional(z4.string()),
10535
11484
  /**
10536
11485
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10537
11486
  * for notes on _meta usage.
10538
11487
  */
10539
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11488
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10540
11489
  });
10541
11490
  var TextResourceContentsSchema = ResourceContentsSchema.extend({
10542
11491
  /**
10543
11492
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
10544
11493
  */
10545
- text: z3.string()
11494
+ text: z4.string()
10546
11495
  });
10547
- var Base64Schema = z3.string().refine((val) => {
11496
+ var Base64Schema = z4.string().refine((val) => {
10548
11497
  try {
10549
11498
  atob(val);
10550
11499
  return true;
@@ -10558,44 +11507,44 @@ var BlobResourceContentsSchema = ResourceContentsSchema.extend({
10558
11507
  */
10559
11508
  blob: Base64Schema
10560
11509
  });
10561
- var RoleSchema = z3.enum(["user", "assistant"]);
10562
- var AnnotationsSchema = z3.object({
11510
+ var RoleSchema = z4.enum(["user", "assistant"]);
11511
+ var AnnotationsSchema = z4.object({
10563
11512
  /**
10564
11513
  * Intended audience(s) for the resource.
10565
11514
  */
10566
- audience: z3.array(RoleSchema).optional(),
11515
+ audience: z4.array(RoleSchema).optional(),
10567
11516
  /**
10568
11517
  * Importance hint for the resource, from 0 (least) to 1 (most).
10569
11518
  */
10570
- priority: z3.number().min(0).max(1).optional(),
11519
+ priority: z4.number().min(0).max(1).optional(),
10571
11520
  /**
10572
11521
  * ISO 8601 timestamp for the most recent modification.
10573
11522
  */
10574
- lastModified: z3.iso.datetime({ offset: true }).optional()
11523
+ lastModified: z4.iso.datetime({ offset: true }).optional()
10575
11524
  });
10576
- var ResourceSchema = z3.object({
11525
+ var ResourceSchema2 = z4.object({
10577
11526
  ...BaseMetadataSchema.shape,
10578
11527
  ...IconsSchema.shape,
10579
11528
  /**
10580
11529
  * The URI of this resource.
10581
11530
  */
10582
- uri: z3.string(),
11531
+ uri: z4.string(),
10583
11532
  /**
10584
11533
  * A description of what this resource represents.
10585
11534
  *
10586
11535
  * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
10587
11536
  */
10588
- description: z3.optional(z3.string()),
11537
+ description: z4.optional(z4.string()),
10589
11538
  /**
10590
11539
  * The MIME type of this resource, if known.
10591
11540
  */
10592
- mimeType: z3.optional(z3.string()),
11541
+ mimeType: z4.optional(z4.string()),
10593
11542
  /**
10594
11543
  * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
10595
11544
  *
10596
11545
  * This can be used by Hosts to display file sizes and estimate context window usage.
10597
11546
  */
10598
- size: z3.optional(z3.number()),
11547
+ size: z4.optional(z4.number()),
10599
11548
  /**
10600
11549
  * Optional annotations for the client.
10601
11550
  */
@@ -10604,25 +11553,25 @@ var ResourceSchema = z3.object({
10604
11553
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10605
11554
  * for notes on _meta usage.
10606
11555
  */
10607
- _meta: z3.optional(z3.looseObject({}))
11556
+ _meta: z4.optional(z4.looseObject({}))
10608
11557
  });
10609
- var ResourceTemplateSchema = z3.object({
11558
+ var ResourceTemplateSchema2 = z4.object({
10610
11559
  ...BaseMetadataSchema.shape,
10611
11560
  ...IconsSchema.shape,
10612
11561
  /**
10613
11562
  * A URI template (according to RFC 6570) that can be used to construct resource URIs.
10614
11563
  */
10615
- uriTemplate: z3.string(),
11564
+ uriTemplate: z4.string(),
10616
11565
  /**
10617
11566
  * A description of what this template is for.
10618
11567
  *
10619
11568
  * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
10620
11569
  */
10621
- description: z3.optional(z3.string()),
11570
+ description: z4.optional(z4.string()),
10622
11571
  /**
10623
11572
  * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
10624
11573
  */
10625
- mimeType: z3.optional(z3.string()),
11574
+ mimeType: z4.optional(z4.string()),
10626
11575
  /**
10627
11576
  * Optional annotations for the client.
10628
11577
  */
@@ -10631,19 +11580,19 @@ var ResourceTemplateSchema = z3.object({
10631
11580
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10632
11581
  * for notes on _meta usage.
10633
11582
  */
10634
- _meta: z3.optional(z3.looseObject({}))
11583
+ _meta: z4.optional(z4.looseObject({}))
10635
11584
  });
10636
11585
  var ListResourcesRequestSchema = PaginatedRequestSchema.extend({
10637
- method: z3.literal("resources/list")
11586
+ method: z4.literal("resources/list")
10638
11587
  });
10639
11588
  var ListResourcesResultSchema2 = PaginatedResultSchema.extend({
10640
- resources: z3.array(ResourceSchema)
11589
+ resources: z4.array(ResourceSchema2)
10641
11590
  });
10642
11591
  var ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({
10643
- method: z3.literal("resources/templates/list")
11592
+ method: z4.literal("resources/templates/list")
10644
11593
  });
10645
11594
  var ListResourceTemplatesResultSchema2 = PaginatedResultSchema.extend({
10646
- resourceTemplates: z3.array(ResourceTemplateSchema)
11595
+ resourceTemplates: z4.array(ResourceTemplateSchema2)
10647
11596
  });
10648
11597
  var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
10649
11598
  /**
@@ -10651,97 +11600,97 @@ var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
10651
11600
  *
10652
11601
  * @format uri
10653
11602
  */
10654
- uri: z3.string()
11603
+ uri: z4.string()
10655
11604
  });
10656
11605
  var ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
10657
11606
  var ReadResourceRequestSchema = RequestSchema.extend({
10658
- method: z3.literal("resources/read"),
11607
+ method: z4.literal("resources/read"),
10659
11608
  params: ReadResourceRequestParamsSchema
10660
11609
  });
10661
11610
  var ReadResourceResultSchema2 = ResultSchema.extend({
10662
- contents: z3.array(z3.union([TextResourceContentsSchema, BlobResourceContentsSchema]))
11611
+ contents: z4.array(z4.union([TextResourceContentsSchema, BlobResourceContentsSchema]))
10663
11612
  });
10664
11613
  var ResourceListChangedNotificationSchema = NotificationSchema2.extend({
10665
- method: z3.literal("notifications/resources/list_changed"),
11614
+ method: z4.literal("notifications/resources/list_changed"),
10666
11615
  params: NotificationsParamsSchema.optional()
10667
11616
  });
10668
11617
  var SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
10669
11618
  var SubscribeRequestSchema = RequestSchema.extend({
10670
- method: z3.literal("resources/subscribe"),
11619
+ method: z4.literal("resources/subscribe"),
10671
11620
  params: SubscribeRequestParamsSchema
10672
11621
  });
10673
11622
  var UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
10674
11623
  var UnsubscribeRequestSchema = RequestSchema.extend({
10675
- method: z3.literal("resources/unsubscribe"),
11624
+ method: z4.literal("resources/unsubscribe"),
10676
11625
  params: UnsubscribeRequestParamsSchema
10677
11626
  });
10678
11627
  var ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
10679
11628
  /**
10680
11629
  * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
10681
11630
  */
10682
- uri: z3.string()
11631
+ uri: z4.string()
10683
11632
  });
10684
11633
  var ResourceUpdatedNotificationSchema = NotificationSchema2.extend({
10685
- method: z3.literal("notifications/resources/updated"),
11634
+ method: z4.literal("notifications/resources/updated"),
10686
11635
  params: ResourceUpdatedNotificationParamsSchema
10687
11636
  });
10688
- var PromptArgumentSchema = z3.object({
11637
+ var PromptArgumentSchema = z4.object({
10689
11638
  /**
10690
11639
  * The name of the argument.
10691
11640
  */
10692
- name: z3.string(),
11641
+ name: z4.string(),
10693
11642
  /**
10694
11643
  * A human-readable description of the argument.
10695
11644
  */
10696
- description: z3.optional(z3.string()),
11645
+ description: z4.optional(z4.string()),
10697
11646
  /**
10698
11647
  * Whether this argument must be provided.
10699
11648
  */
10700
- required: z3.optional(z3.boolean())
11649
+ required: z4.optional(z4.boolean())
10701
11650
  });
10702
- var PromptSchema = z3.object({
11651
+ var PromptSchema2 = z4.object({
10703
11652
  ...BaseMetadataSchema.shape,
10704
11653
  ...IconsSchema.shape,
10705
11654
  /**
10706
11655
  * An optional description of what this prompt provides
10707
11656
  */
10708
- description: z3.optional(z3.string()),
11657
+ description: z4.optional(z4.string()),
10709
11658
  /**
10710
11659
  * A list of arguments to use for templating the prompt.
10711
11660
  */
10712
- arguments: z3.optional(z3.array(PromptArgumentSchema)),
11661
+ arguments: z4.optional(z4.array(PromptArgumentSchema)),
10713
11662
  /**
10714
11663
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10715
11664
  * for notes on _meta usage.
10716
11665
  */
10717
- _meta: z3.optional(z3.looseObject({}))
11666
+ _meta: z4.optional(z4.looseObject({}))
10718
11667
  });
10719
11668
  var ListPromptsRequestSchema = PaginatedRequestSchema.extend({
10720
- method: z3.literal("prompts/list")
11669
+ method: z4.literal("prompts/list")
10721
11670
  });
10722
11671
  var ListPromptsResultSchema2 = PaginatedResultSchema.extend({
10723
- prompts: z3.array(PromptSchema)
11672
+ prompts: z4.array(PromptSchema2)
10724
11673
  });
10725
11674
  var GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
10726
11675
  /**
10727
11676
  * The name of the prompt or prompt template.
10728
11677
  */
10729
- name: z3.string(),
11678
+ name: z4.string(),
10730
11679
  /**
10731
11680
  * Arguments to use for templating the prompt.
10732
11681
  */
10733
- arguments: z3.record(z3.string(), z3.string()).optional()
11682
+ arguments: z4.record(z4.string(), z4.string()).optional()
10734
11683
  });
10735
11684
  var GetPromptRequestSchema = RequestSchema.extend({
10736
- method: z3.literal("prompts/get"),
11685
+ method: z4.literal("prompts/get"),
10737
11686
  params: GetPromptRequestParamsSchema
10738
11687
  });
10739
- var TextContentSchema = z3.object({
10740
- type: z3.literal("text"),
11688
+ var TextContentSchema = z4.object({
11689
+ type: z4.literal("text"),
10741
11690
  /**
10742
11691
  * The text content of the message.
10743
11692
  */
10744
- text: z3.string(),
11693
+ text: z4.string(),
10745
11694
  /**
10746
11695
  * Optional annotations for the client.
10747
11696
  */
@@ -10750,10 +11699,10 @@ var TextContentSchema = z3.object({
10750
11699
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10751
11700
  * for notes on _meta usage.
10752
11701
  */
10753
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11702
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10754
11703
  });
10755
- var ImageContentSchema = z3.object({
10756
- type: z3.literal("image"),
11704
+ var ImageContentSchema = z4.object({
11705
+ type: z4.literal("image"),
10757
11706
  /**
10758
11707
  * The base64-encoded image data.
10759
11708
  */
@@ -10761,7 +11710,7 @@ var ImageContentSchema = z3.object({
10761
11710
  /**
10762
11711
  * The MIME type of the image. Different providers may support different image types.
10763
11712
  */
10764
- mimeType: z3.string(),
11713
+ mimeType: z4.string(),
10765
11714
  /**
10766
11715
  * Optional annotations for the client.
10767
11716
  */
@@ -10770,10 +11719,10 @@ var ImageContentSchema = z3.object({
10770
11719
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10771
11720
  * for notes on _meta usage.
10772
11721
  */
10773
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11722
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10774
11723
  });
10775
- var AudioContentSchema = z3.object({
10776
- type: z3.literal("audio"),
11724
+ var AudioContentSchema = z4.object({
11725
+ type: z4.literal("audio"),
10777
11726
  /**
10778
11727
  * The base64-encoded audio data.
10779
11728
  */
@@ -10781,7 +11730,7 @@ var AudioContentSchema = z3.object({
10781
11730
  /**
10782
11731
  * The MIME type of the audio. Different providers may support different audio types.
10783
11732
  */
10784
- mimeType: z3.string(),
11733
+ mimeType: z4.string(),
10785
11734
  /**
10786
11735
  * Optional annotations for the client.
10787
11736
  */
@@ -10790,34 +11739,34 @@ var AudioContentSchema = z3.object({
10790
11739
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10791
11740
  * for notes on _meta usage.
10792
11741
  */
10793
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11742
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10794
11743
  });
10795
- var ToolUseContentSchema = z3.object({
10796
- type: z3.literal("tool_use"),
11744
+ var ToolUseContentSchema = z4.object({
11745
+ type: z4.literal("tool_use"),
10797
11746
  /**
10798
11747
  * The name of the tool to invoke.
10799
11748
  * Must match a tool name from the request's tools array.
10800
11749
  */
10801
- name: z3.string(),
11750
+ name: z4.string(),
10802
11751
  /**
10803
11752
  * Unique identifier for this tool call.
10804
11753
  * Used to correlate with ToolResultContent in subsequent messages.
10805
11754
  */
10806
- id: z3.string(),
11755
+ id: z4.string(),
10807
11756
  /**
10808
11757
  * Arguments to pass to the tool.
10809
11758
  * Must conform to the tool's inputSchema.
10810
11759
  */
10811
- input: z3.record(z3.string(), z3.unknown()),
11760
+ input: z4.record(z4.string(), z4.unknown()),
10812
11761
  /**
10813
11762
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10814
11763
  * for notes on _meta usage.
10815
11764
  */
10816
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11765
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10817
11766
  });
10818
- var EmbeddedResourceSchema = z3.object({
10819
- type: z3.literal("resource"),
10820
- resource: z3.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
11767
+ var EmbeddedResourceSchema = z4.object({
11768
+ type: z4.literal("resource"),
11769
+ resource: z4.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
10821
11770
  /**
10822
11771
  * Optional annotations for the client.
10823
11772
  */
@@ -10826,19 +11775,19 @@ var EmbeddedResourceSchema = z3.object({
10826
11775
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10827
11776
  * for notes on _meta usage.
10828
11777
  */
10829
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11778
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10830
11779
  });
10831
- var ResourceLinkSchema = ResourceSchema.extend({
10832
- type: z3.literal("resource_link")
11780
+ var ResourceLinkSchema = ResourceSchema2.extend({
11781
+ type: z4.literal("resource_link")
10833
11782
  });
10834
- var ContentBlockSchema = z3.union([
11783
+ var ContentBlockSchema = z4.union([
10835
11784
  TextContentSchema,
10836
11785
  ImageContentSchema,
10837
11786
  AudioContentSchema,
10838
11787
  ResourceLinkSchema,
10839
11788
  EmbeddedResourceSchema
10840
11789
  ]);
10841
- var PromptMessageSchema = z3.object({
11790
+ var PromptMessageSchema = z4.object({
10842
11791
  role: RoleSchema,
10843
11792
  content: ContentBlockSchema
10844
11793
  });
@@ -10846,24 +11795,24 @@ var GetPromptResultSchema2 = ResultSchema.extend({
10846
11795
  /**
10847
11796
  * An optional description for the prompt.
10848
11797
  */
10849
- description: z3.string().optional(),
10850
- messages: z3.array(PromptMessageSchema)
11798
+ description: z4.string().optional(),
11799
+ messages: z4.array(PromptMessageSchema)
10851
11800
  });
10852
11801
  var PromptListChangedNotificationSchema = NotificationSchema2.extend({
10853
- method: z3.literal("notifications/prompts/list_changed"),
11802
+ method: z4.literal("notifications/prompts/list_changed"),
10854
11803
  params: NotificationsParamsSchema.optional()
10855
11804
  });
10856
- var ToolAnnotationsSchema = z3.object({
11805
+ var ToolAnnotationsSchema = z4.object({
10857
11806
  /**
10858
11807
  * A human-readable title for the tool.
10859
11808
  */
10860
- title: z3.string().optional(),
11809
+ title: z4.string().optional(),
10861
11810
  /**
10862
11811
  * If true, the tool does not modify its environment.
10863
11812
  *
10864
11813
  * Default: false
10865
11814
  */
10866
- readOnlyHint: z3.boolean().optional(),
11815
+ readOnlyHint: z4.boolean().optional(),
10867
11816
  /**
10868
11817
  * If true, the tool may perform destructive updates to its environment.
10869
11818
  * If false, the tool performs only additive updates.
@@ -10872,7 +11821,7 @@ var ToolAnnotationsSchema = z3.object({
10872
11821
  *
10873
11822
  * Default: true
10874
11823
  */
10875
- destructiveHint: z3.boolean().optional(),
11824
+ destructiveHint: z4.boolean().optional(),
10876
11825
  /**
10877
11826
  * If true, calling the tool repeatedly with the same arguments
10878
11827
  * will have no additional effect on the its environment.
@@ -10881,7 +11830,7 @@ var ToolAnnotationsSchema = z3.object({
10881
11830
  *
10882
11831
  * Default: false
10883
11832
  */
10884
- idempotentHint: z3.boolean().optional(),
11833
+ idempotentHint: z4.boolean().optional(),
10885
11834
  /**
10886
11835
  * If true, this tool may interact with an "open world" of external
10887
11836
  * entities. If false, the tool's domain of interaction is closed.
@@ -10890,9 +11839,9 @@ var ToolAnnotationsSchema = z3.object({
10890
11839
  *
10891
11840
  * Default: true
10892
11841
  */
10893
- openWorldHint: z3.boolean().optional()
11842
+ openWorldHint: z4.boolean().optional()
10894
11843
  });
10895
- var ToolExecutionSchema = z3.object({
11844
+ var ToolExecutionSchema = z4.object({
10896
11845
  /**
10897
11846
  * Indicates the tool's preference for task-augmented execution.
10898
11847
  * - "required": Clients MUST invoke the tool as a task
@@ -10901,34 +11850,34 @@ var ToolExecutionSchema = z3.object({
10901
11850
  *
10902
11851
  * If not present, defaults to "forbidden".
10903
11852
  */
10904
- taskSupport: z3.enum(["required", "optional", "forbidden"]).optional()
11853
+ taskSupport: z4.enum(["required", "optional", "forbidden"]).optional()
10905
11854
  });
10906
- var ToolSchema = z3.object({
11855
+ var ToolSchema2 = z4.object({
10907
11856
  ...BaseMetadataSchema.shape,
10908
11857
  ...IconsSchema.shape,
10909
11858
  /**
10910
11859
  * A human-readable description of the tool.
10911
11860
  */
10912
- description: z3.string().optional(),
11861
+ description: z4.string().optional(),
10913
11862
  /**
10914
11863
  * A JSON Schema 2020-12 object defining the expected parameters for the tool.
10915
11864
  * Must have type: 'object' at the root level per MCP spec.
10916
11865
  */
10917
- inputSchema: z3.object({
10918
- type: z3.literal("object"),
10919
- properties: z3.record(z3.string(), AssertObjectSchema).optional(),
10920
- required: z3.array(z3.string()).optional()
10921
- }).catchall(z3.unknown()),
11866
+ inputSchema: z4.object({
11867
+ type: z4.literal("object"),
11868
+ properties: z4.record(z4.string(), AssertObjectSchema).optional(),
11869
+ required: z4.array(z4.string()).optional()
11870
+ }).catchall(z4.unknown()),
10922
11871
  /**
10923
11872
  * An optional JSON Schema 2020-12 object defining the structure of the tool's output
10924
11873
  * returned in the structuredContent field of a CallToolResult.
10925
11874
  * Must have type: 'object' at the root level per MCP spec.
10926
11875
  */
10927
- outputSchema: z3.object({
10928
- type: z3.literal("object"),
10929
- properties: z3.record(z3.string(), AssertObjectSchema).optional(),
10930
- required: z3.array(z3.string()).optional()
10931
- }).catchall(z3.unknown()).optional(),
11876
+ outputSchema: z4.object({
11877
+ type: z4.literal("object"),
11878
+ properties: z4.record(z4.string(), AssertObjectSchema).optional(),
11879
+ required: z4.array(z4.string()).optional()
11880
+ }).catchall(z4.unknown()).optional(),
10932
11881
  /**
10933
11882
  * Optional additional tool information.
10934
11883
  */
@@ -10941,13 +11890,13 @@ var ToolSchema = z3.object({
10941
11890
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
10942
11891
  * for notes on _meta usage.
10943
11892
  */
10944
- _meta: z3.record(z3.string(), z3.unknown()).optional()
11893
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
10945
11894
  });
10946
11895
  var ListToolsRequestSchema = PaginatedRequestSchema.extend({
10947
- method: z3.literal("tools/list")
11896
+ method: z4.literal("tools/list")
10948
11897
  });
10949
11898
  var ListToolsResultSchema2 = PaginatedResultSchema.extend({
10950
- tools: z3.array(ToolSchema)
11899
+ tools: z4.array(ToolSchema2)
10951
11900
  });
10952
11901
  var CallToolResultSchema2 = ResultSchema.extend({
10953
11902
  /**
@@ -10956,13 +11905,13 @@ var CallToolResultSchema2 = ResultSchema.extend({
10956
11905
  * If the Tool does not define an outputSchema, this field MUST be present in the result.
10957
11906
  * For backwards compatibility, this field is always present, but it may be empty.
10958
11907
  */
10959
- content: z3.array(ContentBlockSchema).default([]),
11908
+ content: z4.array(ContentBlockSchema).default([]),
10960
11909
  /**
10961
11910
  * An object containing structured tool output.
10962
11911
  *
10963
11912
  * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
10964
11913
  */
10965
- structuredContent: z3.record(z3.string(), z3.unknown()).optional(),
11914
+ structuredContent: z4.record(z4.string(), z4.unknown()).optional(),
10966
11915
  /**
10967
11916
  * Whether the tool call ended in an error.
10968
11917
  *
@@ -10977,30 +11926,30 @@ var CallToolResultSchema2 = ResultSchema.extend({
10977
11926
  * server does not support tool calls, or any other exceptional conditions,
10978
11927
  * should be reported as an MCP error response.
10979
11928
  */
10980
- isError: z3.boolean().optional()
11929
+ isError: z4.boolean().optional()
10981
11930
  });
10982
11931
  var CompatibilityCallToolResultSchema = CallToolResultSchema2.or(ResultSchema.extend({
10983
- toolResult: z3.unknown()
11932
+ toolResult: z4.unknown()
10984
11933
  }));
10985
11934
  var CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
10986
11935
  /**
10987
11936
  * The name of the tool to call.
10988
11937
  */
10989
- name: z3.string(),
11938
+ name: z4.string(),
10990
11939
  /**
10991
11940
  * Arguments to pass to the tool.
10992
11941
  */
10993
- arguments: z3.record(z3.string(), z3.unknown()).optional()
11942
+ arguments: z4.record(z4.string(), z4.unknown()).optional()
10994
11943
  });
10995
11944
  var CallToolRequestSchema = RequestSchema.extend({
10996
- method: z3.literal("tools/call"),
11945
+ method: z4.literal("tools/call"),
10997
11946
  params: CallToolRequestParamsSchema
10998
11947
  });
10999
11948
  var ToolListChangedNotificationSchema = NotificationSchema2.extend({
11000
- method: z3.literal("notifications/tools/list_changed"),
11949
+ method: z4.literal("notifications/tools/list_changed"),
11001
11950
  params: NotificationsParamsSchema.optional()
11002
11951
  });
11003
- var ListChangedOptionsBaseSchema = z3.object({
11952
+ var ListChangedOptionsBaseSchema = z4.object({
11004
11953
  /**
11005
11954
  * If true, the list will be refreshed automatically when a list changed notification is received.
11006
11955
  * The callback will be called with the updated list.
@@ -11009,7 +11958,7 @@ var ListChangedOptionsBaseSchema = z3.object({
11009
11958
  *
11010
11959
  * @default true
11011
11960
  */
11012
- autoRefresh: z3.boolean().default(true),
11961
+ autoRefresh: z4.boolean().default(true),
11013
11962
  /**
11014
11963
  * Debounce time in milliseconds for list changed notification processing.
11015
11964
  *
@@ -11018,9 +11967,9 @@ var ListChangedOptionsBaseSchema = z3.object({
11018
11967
  *
11019
11968
  * @default 300
11020
11969
  */
11021
- debounceMs: z3.number().int().nonnegative().default(300)
11970
+ debounceMs: z4.number().int().nonnegative().default(300)
11022
11971
  });
11023
- var LoggingLevelSchema = z3.enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
11972
+ var LoggingLevelSchema = z4.enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
11024
11973
  var SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
11025
11974
  /**
11026
11975
  * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
@@ -11028,7 +11977,7 @@ var SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
11028
11977
  level: LoggingLevelSchema
11029
11978
  });
11030
11979
  var SetLevelRequestSchema = RequestSchema.extend({
11031
- method: z3.literal("logging/setLevel"),
11980
+ method: z4.literal("logging/setLevel"),
11032
11981
  params: SetLevelRequestParamsSchema
11033
11982
  });
11034
11983
  var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
@@ -11039,80 +11988,80 @@ var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
11039
11988
  /**
11040
11989
  * An optional name of the logger issuing this message.
11041
11990
  */
11042
- logger: z3.string().optional(),
11991
+ logger: z4.string().optional(),
11043
11992
  /**
11044
11993
  * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
11045
11994
  */
11046
- data: z3.unknown()
11995
+ data: z4.unknown()
11047
11996
  });
11048
11997
  var LoggingMessageNotificationSchema = NotificationSchema2.extend({
11049
- method: z3.literal("notifications/message"),
11998
+ method: z4.literal("notifications/message"),
11050
11999
  params: LoggingMessageNotificationParamsSchema
11051
12000
  });
11052
- var ModelHintSchema = z3.object({
12001
+ var ModelHintSchema = z4.object({
11053
12002
  /**
11054
12003
  * A hint for a model name.
11055
12004
  */
11056
- name: z3.string().optional()
12005
+ name: z4.string().optional()
11057
12006
  });
11058
- var ModelPreferencesSchema = z3.object({
12007
+ var ModelPreferencesSchema = z4.object({
11059
12008
  /**
11060
12009
  * Optional hints to use for model selection.
11061
12010
  */
11062
- hints: z3.array(ModelHintSchema).optional(),
12011
+ hints: z4.array(ModelHintSchema).optional(),
11063
12012
  /**
11064
12013
  * How much to prioritize cost when selecting a model.
11065
12014
  */
11066
- costPriority: z3.number().min(0).max(1).optional(),
12015
+ costPriority: z4.number().min(0).max(1).optional(),
11067
12016
  /**
11068
12017
  * How much to prioritize sampling speed (latency) when selecting a model.
11069
12018
  */
11070
- speedPriority: z3.number().min(0).max(1).optional(),
12019
+ speedPriority: z4.number().min(0).max(1).optional(),
11071
12020
  /**
11072
12021
  * How much to prioritize intelligence and capabilities when selecting a model.
11073
12022
  */
11074
- intelligencePriority: z3.number().min(0).max(1).optional()
12023
+ intelligencePriority: z4.number().min(0).max(1).optional()
11075
12024
  });
11076
- var ToolChoiceSchema = z3.object({
12025
+ var ToolChoiceSchema = z4.object({
11077
12026
  /**
11078
12027
  * Controls when tools are used:
11079
12028
  * - "auto": Model decides whether to use tools (default)
11080
12029
  * - "required": Model MUST use at least one tool before completing
11081
12030
  * - "none": Model MUST NOT use any tools
11082
12031
  */
11083
- mode: z3.enum(["auto", "required", "none"]).optional()
12032
+ mode: z4.enum(["auto", "required", "none"]).optional()
11084
12033
  });
11085
- var ToolResultContentSchema = z3.object({
11086
- type: z3.literal("tool_result"),
11087
- toolUseId: z3.string().describe("The unique identifier for the corresponding tool call."),
11088
- content: z3.array(ContentBlockSchema).default([]),
11089
- structuredContent: z3.object({}).loose().optional(),
11090
- isError: z3.boolean().optional(),
12034
+ var ToolResultContentSchema = z4.object({
12035
+ type: z4.literal("tool_result"),
12036
+ toolUseId: z4.string().describe("The unique identifier for the corresponding tool call."),
12037
+ content: z4.array(ContentBlockSchema).default([]),
12038
+ structuredContent: z4.object({}).loose().optional(),
12039
+ isError: z4.boolean().optional(),
11091
12040
  /**
11092
12041
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
11093
12042
  * for notes on _meta usage.
11094
12043
  */
11095
- _meta: z3.record(z3.string(), z3.unknown()).optional()
12044
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
11096
12045
  });
11097
- var SamplingContentSchema = z3.discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
11098
- var SamplingMessageContentBlockSchema = z3.discriminatedUnion("type", [
12046
+ var SamplingContentSchema = z4.discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
12047
+ var SamplingMessageContentBlockSchema = z4.discriminatedUnion("type", [
11099
12048
  TextContentSchema,
11100
12049
  ImageContentSchema,
11101
12050
  AudioContentSchema,
11102
12051
  ToolUseContentSchema,
11103
12052
  ToolResultContentSchema
11104
12053
  ]);
11105
- var SamplingMessageSchema = z3.object({
12054
+ var SamplingMessageSchema = z4.object({
11106
12055
  role: RoleSchema,
11107
- content: z3.union([SamplingMessageContentBlockSchema, z3.array(SamplingMessageContentBlockSchema)]),
12056
+ content: z4.union([SamplingMessageContentBlockSchema, z4.array(SamplingMessageContentBlockSchema)]),
11108
12057
  /**
11109
12058
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
11110
12059
  * for notes on _meta usage.
11111
12060
  */
11112
- _meta: z3.record(z3.string(), z3.unknown()).optional()
12061
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
11113
12062
  });
11114
12063
  var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11115
- messages: z3.array(SamplingMessageSchema),
12064
+ messages: z4.array(SamplingMessageSchema),
11116
12065
  /**
11117
12066
  * The server's preferences for which model to select. The client MAY modify or omit this request.
11118
12067
  */
@@ -11120,7 +12069,7 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11120
12069
  /**
11121
12070
  * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
11122
12071
  */
11123
- systemPrompt: z3.string().optional(),
12072
+ systemPrompt: z4.string().optional(),
11124
12073
  /**
11125
12074
  * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
11126
12075
  * The client MAY ignore this request.
@@ -11128,15 +12077,15 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11128
12077
  * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
11129
12078
  * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
11130
12079
  */
11131
- includeContext: z3.enum(["none", "thisServer", "allServers"]).optional(),
11132
- temperature: z3.number().optional(),
12080
+ includeContext: z4.enum(["none", "thisServer", "allServers"]).optional(),
12081
+ temperature: z4.number().optional(),
11133
12082
  /**
11134
12083
  * The requested maximum number of tokens to sample (to prevent runaway completions).
11135
12084
  *
11136
12085
  * The client MAY choose to sample fewer tokens than the requested maximum.
11137
12086
  */
11138
- maxTokens: z3.number().int(),
11139
- stopSequences: z3.array(z3.string()).optional(),
12087
+ maxTokens: z4.number().int(),
12088
+ stopSequences: z4.array(z4.string()).optional(),
11140
12089
  /**
11141
12090
  * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
11142
12091
  */
@@ -11145,7 +12094,7 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11145
12094
  * Tools that the model may use during generation.
11146
12095
  * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
11147
12096
  */
11148
- tools: z3.array(ToolSchema).optional(),
12097
+ tools: z4.array(ToolSchema2).optional(),
11149
12098
  /**
11150
12099
  * Controls how the model uses tools.
11151
12100
  * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
@@ -11154,14 +12103,14 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11154
12103
  toolChoice: ToolChoiceSchema.optional()
11155
12104
  });
11156
12105
  var CreateMessageRequestSchema = RequestSchema.extend({
11157
- method: z3.literal("sampling/createMessage"),
12106
+ method: z4.literal("sampling/createMessage"),
11158
12107
  params: CreateMessageRequestParamsSchema
11159
12108
  });
11160
12109
  var CreateMessageResultSchema = ResultSchema.extend({
11161
12110
  /**
11162
12111
  * The name of the model that generated the message.
11163
12112
  */
11164
- model: z3.string(),
12113
+ model: z4.string(),
11165
12114
  /**
11166
12115
  * The reason why sampling stopped, if known.
11167
12116
  *
@@ -11172,7 +12121,7 @@ var CreateMessageResultSchema = ResultSchema.extend({
11172
12121
  *
11173
12122
  * This field is an open string to allow for provider-specific stop reasons.
11174
12123
  */
11175
- stopReason: z3.optional(z3.enum(["endTurn", "stopSequence", "maxTokens"]).or(z3.string())),
12124
+ stopReason: z4.optional(z4.enum(["endTurn", "stopSequence", "maxTokens"]).or(z4.string())),
11176
12125
  role: RoleSchema,
11177
12126
  /**
11178
12127
  * Response content. Single content block (text, image, or audio).
@@ -11183,7 +12132,7 @@ var CreateMessageResultWithToolsSchema = ResultSchema.extend({
11183
12132
  /**
11184
12133
  * The name of the model that generated the message.
11185
12134
  */
11186
- model: z3.string(),
12135
+ model: z4.string(),
11187
12136
  /**
11188
12137
  * The reason why sampling stopped, if known.
11189
12138
  *
@@ -11195,144 +12144,144 @@ var CreateMessageResultWithToolsSchema = ResultSchema.extend({
11195
12144
  *
11196
12145
  * This field is an open string to allow for provider-specific stop reasons.
11197
12146
  */
11198
- stopReason: z3.optional(z3.enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(z3.string())),
12147
+ stopReason: z4.optional(z4.enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(z4.string())),
11199
12148
  role: RoleSchema,
11200
12149
  /**
11201
12150
  * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
11202
12151
  */
11203
- content: z3.union([SamplingMessageContentBlockSchema, z3.array(SamplingMessageContentBlockSchema)])
11204
- });
11205
- var BooleanSchemaSchema = z3.object({
11206
- type: z3.literal("boolean"),
11207
- title: z3.string().optional(),
11208
- description: z3.string().optional(),
11209
- default: z3.boolean().optional()
11210
- });
11211
- var StringSchemaSchema = z3.object({
11212
- type: z3.literal("string"),
11213
- title: z3.string().optional(),
11214
- description: z3.string().optional(),
11215
- minLength: z3.number().optional(),
11216
- maxLength: z3.number().optional(),
11217
- format: z3.enum(["email", "uri", "date", "date-time"]).optional(),
11218
- default: z3.string().optional()
11219
- });
11220
- var NumberSchemaSchema = z3.object({
11221
- type: z3.enum(["number", "integer"]),
11222
- title: z3.string().optional(),
11223
- description: z3.string().optional(),
11224
- minimum: z3.number().optional(),
11225
- maximum: z3.number().optional(),
11226
- default: z3.number().optional()
11227
- });
11228
- var UntitledSingleSelectEnumSchemaSchema = z3.object({
11229
- type: z3.literal("string"),
11230
- title: z3.string().optional(),
11231
- description: z3.string().optional(),
11232
- enum: z3.array(z3.string()),
11233
- default: z3.string().optional()
11234
- });
11235
- var TitledSingleSelectEnumSchemaSchema = z3.object({
11236
- type: z3.literal("string"),
11237
- title: z3.string().optional(),
11238
- description: z3.string().optional(),
11239
- oneOf: z3.array(z3.object({
11240
- const: z3.string(),
11241
- title: z3.string()
12152
+ content: z4.union([SamplingMessageContentBlockSchema, z4.array(SamplingMessageContentBlockSchema)])
12153
+ });
12154
+ var BooleanSchemaSchema = z4.object({
12155
+ type: z4.literal("boolean"),
12156
+ title: z4.string().optional(),
12157
+ description: z4.string().optional(),
12158
+ default: z4.boolean().optional()
12159
+ });
12160
+ var StringSchemaSchema = z4.object({
12161
+ type: z4.literal("string"),
12162
+ title: z4.string().optional(),
12163
+ description: z4.string().optional(),
12164
+ minLength: z4.number().optional(),
12165
+ maxLength: z4.number().optional(),
12166
+ format: z4.enum(["email", "uri", "date", "date-time"]).optional(),
12167
+ default: z4.string().optional()
12168
+ });
12169
+ var NumberSchemaSchema = z4.object({
12170
+ type: z4.enum(["number", "integer"]),
12171
+ title: z4.string().optional(),
12172
+ description: z4.string().optional(),
12173
+ minimum: z4.number().optional(),
12174
+ maximum: z4.number().optional(),
12175
+ default: z4.number().optional()
12176
+ });
12177
+ var UntitledSingleSelectEnumSchemaSchema = z4.object({
12178
+ type: z4.literal("string"),
12179
+ title: z4.string().optional(),
12180
+ description: z4.string().optional(),
12181
+ enum: z4.array(z4.string()),
12182
+ default: z4.string().optional()
12183
+ });
12184
+ var TitledSingleSelectEnumSchemaSchema = z4.object({
12185
+ type: z4.literal("string"),
12186
+ title: z4.string().optional(),
12187
+ description: z4.string().optional(),
12188
+ oneOf: z4.array(z4.object({
12189
+ const: z4.string(),
12190
+ title: z4.string()
11242
12191
  })),
11243
- default: z3.string().optional()
11244
- });
11245
- var LegacyTitledEnumSchemaSchema = z3.object({
11246
- type: z3.literal("string"),
11247
- title: z3.string().optional(),
11248
- description: z3.string().optional(),
11249
- enum: z3.array(z3.string()),
11250
- enumNames: z3.array(z3.string()).optional(),
11251
- default: z3.string().optional()
11252
- });
11253
- var SingleSelectEnumSchemaSchema = z3.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
11254
- var UntitledMultiSelectEnumSchemaSchema = z3.object({
11255
- type: z3.literal("array"),
11256
- title: z3.string().optional(),
11257
- description: z3.string().optional(),
11258
- minItems: z3.number().optional(),
11259
- maxItems: z3.number().optional(),
11260
- items: z3.object({
11261
- type: z3.literal("string"),
11262
- enum: z3.array(z3.string())
12192
+ default: z4.string().optional()
12193
+ });
12194
+ var LegacyTitledEnumSchemaSchema = z4.object({
12195
+ type: z4.literal("string"),
12196
+ title: z4.string().optional(),
12197
+ description: z4.string().optional(),
12198
+ enum: z4.array(z4.string()),
12199
+ enumNames: z4.array(z4.string()).optional(),
12200
+ default: z4.string().optional()
12201
+ });
12202
+ var SingleSelectEnumSchemaSchema = z4.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
12203
+ var UntitledMultiSelectEnumSchemaSchema = z4.object({
12204
+ type: z4.literal("array"),
12205
+ title: z4.string().optional(),
12206
+ description: z4.string().optional(),
12207
+ minItems: z4.number().optional(),
12208
+ maxItems: z4.number().optional(),
12209
+ items: z4.object({
12210
+ type: z4.literal("string"),
12211
+ enum: z4.array(z4.string())
11263
12212
  }),
11264
- default: z3.array(z3.string()).optional()
11265
- });
11266
- var TitledMultiSelectEnumSchemaSchema = z3.object({
11267
- type: z3.literal("array"),
11268
- title: z3.string().optional(),
11269
- description: z3.string().optional(),
11270
- minItems: z3.number().optional(),
11271
- maxItems: z3.number().optional(),
11272
- items: z3.object({
11273
- anyOf: z3.array(z3.object({
11274
- const: z3.string(),
11275
- title: z3.string()
12213
+ default: z4.array(z4.string()).optional()
12214
+ });
12215
+ var TitledMultiSelectEnumSchemaSchema = z4.object({
12216
+ type: z4.literal("array"),
12217
+ title: z4.string().optional(),
12218
+ description: z4.string().optional(),
12219
+ minItems: z4.number().optional(),
12220
+ maxItems: z4.number().optional(),
12221
+ items: z4.object({
12222
+ anyOf: z4.array(z4.object({
12223
+ const: z4.string(),
12224
+ title: z4.string()
11276
12225
  }))
11277
12226
  }),
11278
- default: z3.array(z3.string()).optional()
12227
+ default: z4.array(z4.string()).optional()
11279
12228
  });
11280
- var MultiSelectEnumSchemaSchema = z3.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
11281
- var EnumSchemaSchema = z3.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
11282
- var PrimitiveSchemaDefinitionSchema = z3.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
12229
+ var MultiSelectEnumSchemaSchema = z4.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
12230
+ var EnumSchemaSchema = z4.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
12231
+ var PrimitiveSchemaDefinitionSchema = z4.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
11283
12232
  var ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11284
12233
  /**
11285
12234
  * The elicitation mode.
11286
12235
  *
11287
12236
  * Optional for backward compatibility. Clients MUST treat missing mode as "form".
11288
12237
  */
11289
- mode: z3.literal("form").optional(),
12238
+ mode: z4.literal("form").optional(),
11290
12239
  /**
11291
12240
  * The message to present to the user describing what information is being requested.
11292
12241
  */
11293
- message: z3.string(),
12242
+ message: z4.string(),
11294
12243
  /**
11295
12244
  * A restricted subset of JSON Schema.
11296
12245
  * Only top-level properties are allowed, without nesting.
11297
12246
  */
11298
- requestedSchema: z3.object({
11299
- type: z3.literal("object"),
11300
- properties: z3.record(z3.string(), PrimitiveSchemaDefinitionSchema),
11301
- required: z3.array(z3.string()).optional()
12247
+ requestedSchema: z4.object({
12248
+ type: z4.literal("object"),
12249
+ properties: z4.record(z4.string(), PrimitiveSchemaDefinitionSchema),
12250
+ required: z4.array(z4.string()).optional()
11302
12251
  })
11303
12252
  });
11304
12253
  var ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
11305
12254
  /**
11306
12255
  * The elicitation mode.
11307
12256
  */
11308
- mode: z3.literal("url"),
12257
+ mode: z4.literal("url"),
11309
12258
  /**
11310
12259
  * The message to present to the user explaining why the interaction is needed.
11311
12260
  */
11312
- message: z3.string(),
12261
+ message: z4.string(),
11313
12262
  /**
11314
12263
  * The ID of the elicitation, which must be unique within the context of the server.
11315
12264
  * The client MUST treat this ID as an opaque value.
11316
12265
  */
11317
- elicitationId: z3.string(),
12266
+ elicitationId: z4.string(),
11318
12267
  /**
11319
12268
  * The URL that the user should navigate to.
11320
12269
  */
11321
- url: z3.string().url()
12270
+ url: z4.string().url()
11322
12271
  });
11323
- var ElicitRequestParamsSchema = z3.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
12272
+ var ElicitRequestParamsSchema = z4.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);
11324
12273
  var ElicitRequestSchema = RequestSchema.extend({
11325
- method: z3.literal("elicitation/create"),
12274
+ method: z4.literal("elicitation/create"),
11326
12275
  params: ElicitRequestParamsSchema
11327
12276
  });
11328
12277
  var ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
11329
12278
  /**
11330
12279
  * The ID of the elicitation that completed.
11331
12280
  */
11332
- elicitationId: z3.string()
12281
+ elicitationId: z4.string()
11333
12282
  });
11334
12283
  var ElicitationCompleteNotificationSchema = NotificationSchema2.extend({
11335
- method: z3.literal("notifications/elicitation/complete"),
12284
+ method: z4.literal("notifications/elicitation/complete"),
11336
12285
  params: ElicitationCompleteNotificationParamsSchema
11337
12286
  });
11338
12287
  var ElicitResultSchema = ResultSchema.extend({
@@ -11342,98 +12291,98 @@ var ElicitResultSchema = ResultSchema.extend({
11342
12291
  * - "decline": User explicitly decline the action
11343
12292
  * - "cancel": User dismissed without making an explicit choice
11344
12293
  */
11345
- action: z3.enum(["accept", "decline", "cancel"]),
12294
+ action: z4.enum(["accept", "decline", "cancel"]),
11346
12295
  /**
11347
12296
  * The submitted form data, only present when action is "accept".
11348
12297
  * Contains values matching the requested schema.
11349
12298
  * Per MCP spec, content is "typically omitted" for decline/cancel actions.
11350
12299
  * We normalize null to undefined for leniency while maintaining type compatibility.
11351
12300
  */
11352
- content: z3.preprocess((val) => val === null ? void 0 : val, z3.record(z3.string(), z3.union([z3.string(), z3.number(), z3.boolean(), z3.array(z3.string())])).optional())
12301
+ content: z4.preprocess((val) => val === null ? void 0 : val, z4.record(z4.string(), z4.union([z4.string(), z4.number(), z4.boolean(), z4.array(z4.string())])).optional())
11353
12302
  });
11354
- var ResourceTemplateReferenceSchema = z3.object({
11355
- type: z3.literal("ref/resource"),
12303
+ var ResourceTemplateReferenceSchema = z4.object({
12304
+ type: z4.literal("ref/resource"),
11356
12305
  /**
11357
12306
  * The URI or URI template of the resource.
11358
12307
  */
11359
- uri: z3.string()
12308
+ uri: z4.string()
11360
12309
  });
11361
- var PromptReferenceSchema = z3.object({
11362
- type: z3.literal("ref/prompt"),
12310
+ var PromptReferenceSchema = z4.object({
12311
+ type: z4.literal("ref/prompt"),
11363
12312
  /**
11364
12313
  * The name of the prompt or prompt template
11365
12314
  */
11366
- name: z3.string()
12315
+ name: z4.string()
11367
12316
  });
11368
12317
  var CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
11369
- ref: z3.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
12318
+ ref: z4.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
11370
12319
  /**
11371
12320
  * The argument's information
11372
12321
  */
11373
- argument: z3.object({
12322
+ argument: z4.object({
11374
12323
  /**
11375
12324
  * The name of the argument
11376
12325
  */
11377
- name: z3.string(),
12326
+ name: z4.string(),
11378
12327
  /**
11379
12328
  * The value of the argument to use for completion matching.
11380
12329
  */
11381
- value: z3.string()
12330
+ value: z4.string()
11382
12331
  }),
11383
- context: z3.object({
12332
+ context: z4.object({
11384
12333
  /**
11385
12334
  * Previously-resolved variables in a URI template or prompt.
11386
12335
  */
11387
- arguments: z3.record(z3.string(), z3.string()).optional()
12336
+ arguments: z4.record(z4.string(), z4.string()).optional()
11388
12337
  }).optional()
11389
12338
  });
11390
12339
  var CompleteRequestSchema = RequestSchema.extend({
11391
- method: z3.literal("completion/complete"),
12340
+ method: z4.literal("completion/complete"),
11392
12341
  params: CompleteRequestParamsSchema
11393
12342
  });
11394
12343
  var CompleteResultSchema = ResultSchema.extend({
11395
- completion: z3.looseObject({
12344
+ completion: z4.looseObject({
11396
12345
  /**
11397
12346
  * An array of completion values. Must not exceed 100 items.
11398
12347
  */
11399
- values: z3.array(z3.string()).max(100),
12348
+ values: z4.array(z4.string()).max(100),
11400
12349
  /**
11401
12350
  * The total number of completion options available. This can exceed the number of values actually sent in the response.
11402
12351
  */
11403
- total: z3.optional(z3.number().int()),
12352
+ total: z4.optional(z4.number().int()),
11404
12353
  /**
11405
12354
  * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
11406
12355
  */
11407
- hasMore: z3.optional(z3.boolean())
12356
+ hasMore: z4.optional(z4.boolean())
11408
12357
  })
11409
12358
  });
11410
- var RootSchema = z3.object({
12359
+ var RootSchema = z4.object({
11411
12360
  /**
11412
12361
  * The URI identifying the root. This *must* start with file:// for now.
11413
12362
  */
11414
- uri: z3.string().startsWith("file://"),
12363
+ uri: z4.string().startsWith("file://"),
11415
12364
  /**
11416
12365
  * An optional name for the root.
11417
12366
  */
11418
- name: z3.string().optional(),
12367
+ name: z4.string().optional(),
11419
12368
  /**
11420
12369
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
11421
12370
  * for notes on _meta usage.
11422
12371
  */
11423
- _meta: z3.record(z3.string(), z3.unknown()).optional()
12372
+ _meta: z4.record(z4.string(), z4.unknown()).optional()
11424
12373
  });
11425
12374
  var ListRootsRequestSchema = RequestSchema.extend({
11426
- method: z3.literal("roots/list"),
12375
+ method: z4.literal("roots/list"),
11427
12376
  params: BaseRequestParamsSchema.optional()
11428
12377
  });
11429
12378
  var ListRootsResultSchema = ResultSchema.extend({
11430
- roots: z3.array(RootSchema)
12379
+ roots: z4.array(RootSchema)
11431
12380
  });
11432
12381
  var RootsListChangedNotificationSchema = NotificationSchema2.extend({
11433
- method: z3.literal("notifications/roots/list_changed"),
12382
+ method: z4.literal("notifications/roots/list_changed"),
11434
12383
  params: NotificationsParamsSchema.optional()
11435
12384
  });
11436
- var ClientRequestSchema = z3.union([
12385
+ var ClientRequestSchema = z4.union([
11437
12386
  PingRequestSchema,
11438
12387
  InitializeRequestSchema,
11439
12388
  CompleteRequestSchema,
@@ -11452,14 +12401,14 @@ var ClientRequestSchema = z3.union([
11452
12401
  ListTasksRequestSchema2,
11453
12402
  CancelTaskRequestSchema2
11454
12403
  ]);
11455
- var ClientNotificationSchema = z3.union([
12404
+ var ClientNotificationSchema = z4.union([
11456
12405
  CancelledNotificationSchema,
11457
12406
  ProgressNotificationSchema,
11458
12407
  InitializedNotificationSchema,
11459
12408
  RootsListChangedNotificationSchema,
11460
12409
  TaskStatusNotificationSchema2
11461
12410
  ]);
11462
- var ClientResultSchema = z3.union([
12411
+ var ClientResultSchema = z4.union([
11463
12412
  EmptyResultSchema2,
11464
12413
  CreateMessageResultSchema,
11465
12414
  CreateMessageResultWithToolsSchema,
@@ -11469,7 +12418,7 @@ var ClientResultSchema = z3.union([
11469
12418
  ListTasksResultSchema2,
11470
12419
  CreateTaskResultSchema2
11471
12420
  ]);
11472
- var ServerRequestSchema = z3.union([
12421
+ var ServerRequestSchema = z4.union([
11473
12422
  PingRequestSchema,
11474
12423
  CreateMessageRequestSchema,
11475
12424
  ElicitRequestSchema,
@@ -11479,7 +12428,7 @@ var ServerRequestSchema = z3.union([
11479
12428
  ListTasksRequestSchema2,
11480
12429
  CancelTaskRequestSchema2
11481
12430
  ]);
11482
- var ServerNotificationSchema = z3.union([
12431
+ var ServerNotificationSchema = z4.union([
11483
12432
  CancelledNotificationSchema,
11484
12433
  ProgressNotificationSchema,
11485
12434
  LoggingMessageNotificationSchema,
@@ -11490,7 +12439,7 @@ var ServerNotificationSchema = z3.union([
11490
12439
  TaskStatusNotificationSchema2,
11491
12440
  ElicitationCompleteNotificationSchema
11492
12441
  ]);
11493
- var ServerResultSchema = z3.union([
12442
+ var ServerResultSchema = z4.union([
11494
12443
  EmptyResultSchema2,
11495
12444
  InitializeResultSchema,
11496
12445
  CompleteResultSchema,
@@ -11563,7 +12512,7 @@ var O = Q.object({ connectDomains: Q.array(Q.string()).optional().describe(`Orig
11563
12512
 
11564
12513
  - Maps to CSP \`connect-src\` directive
11565
12514
  - Empty or omitted \u2192 no network connections (secure default)`), resourceDomains: Q.array(Q.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 \u2192 no network resources (secure default)"), frameDomains: Q.array(Q.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"), baseUriDomains: Q.array(Q.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)") });
11566
- var z4 = Q.object({ camera: Q.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: Q.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: Q.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: Q.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
12515
+ var z5 = Q.object({ camera: Q.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: Q.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: Q.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: Q.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
11567
12516
  var H = Q.object({ method: Q.literal("ui/notifications/size-changed"), params: Q.object({ width: Q.number().optional().describe("New width in pixels."), height: Q.number().optional().describe("New height in pixels.") }) });
11568
12517
  var R = Q.object({ method: Q.literal("ui/notifications/tool-input"), params: Q.object({ arguments: Q.record(Q.string(), Q.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") }) });
11569
12518
  var T = Q.object({ method: Q.literal("ui/notifications/tool-input-partial"), params: Q.object({ arguments: Q.record(Q.string(), Q.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") }) });
@@ -11574,10 +12523,10 @@ var C = Q.object({ method: Q.literal("ui/resource-teardown"), params: Q.object({
11574
12523
  var S = Q.record(Q.string(), Q.unknown());
11575
12524
  var F = Q.object({ text: Q.object({}).optional().describe("Host supports text content blocks."), image: Q.object({}).optional().describe("Host supports image content blocks."), audio: Q.object({}).optional().describe("Host supports audio content blocks."), resource: Q.object({}).optional().describe("Host supports resource content blocks."), resourceLink: Q.object({}).optional().describe("Host supports resource link content blocks."), structuredContent: Q.object({}).optional().describe("Host supports structured content.") });
11576
12525
  var q = Q.object({ method: Q.literal("ui/notifications/request-teardown"), params: Q.object({}).optional() });
11577
- var t = Q.object({ experimental: Q.record(Q.string(), Q.record(Q.string(), Q.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."), openLinks: Q.object({}).optional().describe("Host supports opening external URLs."), downloadFile: Q.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: Q.object({ listChanged: Q.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: Q.object({ listChanged: Q.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: Q.object({}).optional().describe("Host accepts log messages."), sandbox: Q.object({ permissions: z4.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: O.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: F.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: F.optional().describe("Host supports receiving content messages (ui/message) from the view."), sampling: Q.object({ tools: Q.object({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.") }).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.") });
12526
+ var t = Q.object({ experimental: Q.record(Q.string(), Q.record(Q.string(), Q.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."), openLinks: Q.object({}).optional().describe("Host supports opening external URLs."), downloadFile: Q.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: Q.object({ listChanged: Q.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: Q.object({ listChanged: Q.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: Q.object({}).optional().describe("Host accepts log messages."), sandbox: Q.object({ permissions: z5.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: O.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: F.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: F.optional().describe("Host supports receiving content messages (ui/message) from the view."), sampling: Q.object({ tools: Q.object({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.") }).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.") });
11578
12527
  var a = Q.object({ experimental: Q.record(Q.string(), Q.record(Q.string(), Q.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."), tools: Q.object({ listChanged: Q.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: Q.array(B).optional().describe("Display modes the app supports.") });
11579
12528
  var y = Q.object({ method: Q.literal("ui/notifications/initialized"), params: Q.object({}).optional() });
11580
- var TQ = Q.object({ csp: O.optional().describe("Content Security Policy configuration for UI resources."), permissions: z4.optional().describe("Sandbox permissions requested by the UI resource."), domain: Q.string().optional().describe(`Dedicated origin for view sandbox.
12529
+ var TQ = Q.object({ csp: O.optional().describe("Content Security Policy configuration for UI resources."), permissions: z5.optional().describe("Sandbox permissions requested by the UI resource."), domain: Q.string().optional().describe(`Dedicated origin for view sandbox.
11581
12530
 
11582
12531
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
11583
12532
 
@@ -11601,9 +12550,9 @@ var MQ = Q.object({ resourceUri: Q.string().optional(), visibility: Q.array(e).o
11601
12550
  var OX = Q.object({ mimeTypes: Q.array(Q.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
11602
12551
  var f = Q.object({ method: Q.literal("ui/download-file"), params: Q.object({ contents: Q.array(Q.union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") }) });
11603
12552
  var k = Q.object({ method: Q.literal("ui/message"), params: Q.object({ role: Q.literal("user").describe('Message role, currently only "user" is supported.'), content: Q.array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).") }) });
11604
- var CQ = Q.object({ method: Q.literal("ui/notifications/sandbox-resource-ready"), params: Q.object({ html: Q.string().describe("HTML content to load into the inner iframe."), sandbox: Q.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: O.optional().describe("CSP configuration from resource metadata."), permissions: z4.optional().describe("Sandbox permissions from resource metadata.") }) });
12553
+ var CQ = Q.object({ method: Q.literal("ui/notifications/sandbox-resource-ready"), params: Q.object({ html: Q.string().describe("HTML content to load into the inner iframe."), sandbox: Q.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: O.optional().describe("CSP configuration from resource metadata."), permissions: z5.optional().describe("Sandbox permissions from resource metadata.") }) });
11605
12554
  var v = Q.object({ method: Q.literal("ui/notifications/tool-result"), params: CallToolResultSchema2.describe("Standard MCP tool execution result.") });
11606
- var x = Q.object({ toolInfo: Q.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: r.optional().describe("Current color theme preference."), styles: s.optional().describe("Style configuration for theming the app."), displayMode: B.optional().describe("How the UI is currently displayed."), availableDisplayModes: Q.array(B).optional().describe("Display modes the host supports."), containerDimensions: Q.union([Q.object({ height: Q.number().describe("Fixed container height in pixels.") }), Q.object({ maxHeight: Q.union([Q.number(), Q.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(Q.union([Q.object({ width: Q.number().describe("Fixed container width in pixels.") }), Q.object({ maxWidth: Q.union([Q.number(), Q.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
12555
+ var x = Q.object({ toolInfo: Q.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema2.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: r.optional().describe("Current color theme preference."), styles: s.optional().describe("Style configuration for theming the app."), displayMode: B.optional().describe("How the UI is currently displayed."), availableDisplayModes: Q.array(B).optional().describe("Display modes the host supports."), containerDimensions: Q.union([Q.object({ height: Q.number().describe("Fixed container height in pixels.") }), Q.object({ maxHeight: Q.union([Q.number(), Q.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(Q.union([Q.object({ width: Q.number().describe("Fixed container width in pixels.") }), Q.object({ maxWidth: Q.union([Q.number(), Q.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
11607
12556
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`), locale: Q.string().optional().describe("User's language and region preference in BCP 47 format."), timeZone: Q.string().optional().describe("User's timezone in IANA format."), userAgent: Q.string().optional().describe("Host application identifier."), platform: Q.union([Q.literal("web"), Q.literal("desktop"), Q.literal("mobile")]).optional().describe("Platform type for responsive design decisions."), deviceCapabilities: Q.object({ touch: Q.boolean().optional().describe("Whether the device supports touch input."), hover: Q.boolean().optional().describe("Whether the device supports hover interactions.") }).optional().describe("Device input capabilities."), safeAreaInsets: Q.object({ top: Q.number().describe("Top safe area inset in pixels."), right: Q.number().describe("Right safe area inset in pixels."), bottom: Q.number().describe("Bottom safe area inset in pixels."), left: Q.number().describe("Left safe area inset in pixels.") }).optional().describe("Mobile safe area boundaries in pixels.") }).passthrough();
11608
12557
  var b = Q.object({ method: Q.literal("ui/notifications/host-context-changed"), params: x.describe("Partial context update containing only changed fields.") });
11609
12558
  var d = Q.object({ method: Q.literal("ui/update-model-context"), params: Q.object({ content: Q.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: Q.record(Q.string(), Q.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
@@ -12409,7 +13358,7 @@ function createCliOAuthNavigation(options = {}) {
12409
13358
  }
12410
13359
 
12411
13360
  // ../../core/client/config-parse.ts
12412
- import { z as z5 } from "zod";
13361
+ import { z as z6 } from "zod";
12413
13362
  function isAbsoluteHttpUrl(value) {
12414
13363
  let url;
12415
13364
  try {
@@ -12426,11 +13375,11 @@ function isRealHost(hostname) {
12426
13375
  const labels = hostname.split(".");
12427
13376
  return labels.length >= 2 && labels.every((label) => label !== "");
12428
13377
  }
12429
- var HttpUrlStringSchema = z5.string().min(1).superRefine((val, ctx) => {
13378
+ var HttpUrlStringSchema = z6.string().min(1).superRefine((val, ctx) => {
12430
13379
  const trimmed = val.trim();
12431
13380
  if (!isAbsoluteHttpUrl(trimmed)) {
12432
13381
  ctx.addIssue({
12433
- code: z5.ZodIssueCode.custom,
13382
+ code: z6.ZodIssueCode.custom,
12434
13383
  message: `Invalid URL: "${trimmed}" \u2014 must be an http(s) URL (e.g. https://idp.example.com)`
12435
13384
  });
12436
13385
  }
@@ -12462,7 +13411,7 @@ function refineCimdMetadataUrl(val, ctx, required) {
12462
13411
  if (trimmed === "") {
12463
13412
  if (required) {
12464
13413
  ctx.addIssue({
12465
- code: z5.ZodIssueCode.custom,
13414
+ code: z6.ZodIssueCode.custom,
12466
13415
  message: "CIMD client metadata URL is required when CIMD is enabled"
12467
13416
  });
12468
13417
  }
@@ -12471,25 +13420,25 @@ function refineCimdMetadataUrl(val, ctx, required) {
12471
13420
  const error = getCimdClientMetadataUrlError(trimmed);
12472
13421
  if (error) {
12473
13422
  ctx.addIssue({
12474
- code: z5.ZodIssueCode.custom,
13423
+ code: z6.ZodIssueCode.custom,
12475
13424
  message: error
12476
13425
  });
12477
13426
  }
12478
13427
  }
12479
- var CimdConfigSchema = z5.object({
12480
- enabled: z5.boolean(),
12481
- clientMetadataUrl: z5.string()
13428
+ var CimdConfigSchema = z6.object({
13429
+ enabled: z6.boolean(),
13430
+ clientMetadataUrl: z6.string()
12482
13431
  }).superRefine((data, ctx) => {
12483
13432
  refineCimdMetadataUrl(data.clientMetadataUrl, ctx, data.enabled === true);
12484
13433
  });
12485
- var EnterpriseManagedAuthIdpConfigSchema = z5.object({
13434
+ var EnterpriseManagedAuthIdpConfigSchema = z6.object({
12486
13435
  issuer: HttpUrlStringSchema,
12487
- clientId: z5.string().min(1),
12488
- clientSecret: z5.string().optional()
13436
+ clientId: z6.string().min(1),
13437
+ clientSecret: z6.string().optional()
12489
13438
  });
12490
- var ClientConfigSchema = z5.object({
12491
- enterpriseManagedAuth: z5.object({
12492
- enabled: z5.boolean().optional(),
13439
+ var ClientConfigSchema = z6.object({
13440
+ enterpriseManagedAuth: z6.object({
13441
+ enabled: z6.boolean().optional(),
12493
13442
  idp: EnterpriseManagedAuthIdpConfigSchema
12494
13443
  }).optional(),
12495
13444
  cimd: CimdConfigSchema.optional()
@@ -12636,7 +13585,9 @@ function isOAuthCapableServerConfig(config) {
12636
13585
  function buildRunnerClientAuthOptions(clientConfig, savedSettings, cliOverrides) {
12637
13586
  const activeIdp = getActiveEnterpriseManagedAuthIdp(clientConfig);
12638
13587
  const activeCimdUrl = getActiveCimdClientMetadataUrl(clientConfig);
12639
- const oauthFromServer = savedSettings && (savedSettings.oauthClientId || savedSettings.oauthClientSecret || savedSettings.oauthScopes || savedSettings.enterpriseManaged) ? {
13588
+ const serverAuthorizationParams = savedSettings ? oauthAuthorizationParamsFromSettings(savedSettings) : void 0;
13589
+ const serverEndpointOverrides = savedSettings ? oauthEndpointOverridesFromSettings(savedSettings) : void 0;
13590
+ const oauthFromServer = savedSettings && (savedSettings.oauthClientId || savedSettings.oauthClientSecret || savedSettings.oauthScopes || serverAuthorizationParams || serverEndpointOverrides || savedSettings.enterpriseManaged) ? {
12640
13591
  ...savedSettings.oauthClientId && {
12641
13592
  clientId: savedSettings.oauthClientId
12642
13593
  },
@@ -12646,6 +13597,10 @@ function buildRunnerClientAuthOptions(clientConfig, savedSettings, cliOverrides)
12646
13597
  ...savedSettings.oauthScopes && {
12647
13598
  scope: savedSettings.oauthScopes
12648
13599
  },
13600
+ ...serverAuthorizationParams && {
13601
+ authorizationParams: serverAuthorizationParams
13602
+ },
13603
+ ...serverEndpointOverrides,
12649
13604
  ...savedSettings.enterpriseManaged && {
12650
13605
  enterpriseManaged: true
12651
13606
  }