@mastra/mcp 2.9.0-alpha.3 → 2.9.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1356,7 +1356,7 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin$1(((exports, mo
1356
1356
  return str.replace(/~/g, "~0").replace(/\//g, "~1");
1357
1357
  }
1358
1358
  }));
1359
- // ../schema-compat/dist/json-schema-BdCwqjfN.js
1359
+ // ../schema-compat/dist/json-schema-Ln9bxqtn.js
1360
1360
  var require_code$1 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1361
1361
  Object.defineProperty(exports, "__esModule", { value: true });
1362
1362
  exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
@@ -8196,8 +8196,303 @@ var require__2020 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
8196
8196
  }
8197
8197
  });
8198
8198
  }));
8199
+ var require_formats = /* @__PURE__ */ __commonJSMin$1(((exports) => {
8200
+ Object.defineProperty(exports, "__esModule", { value: true });
8201
+ exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
8202
+ function fmtDef(validate, compare) {
8203
+ return {
8204
+ validate,
8205
+ compare
8206
+ };
8207
+ }
8208
+ exports.fullFormats = {
8209
+ date: fmtDef(date, compareDate),
8210
+ time: fmtDef(getTime(true), compareTime),
8211
+ "date-time": fmtDef(getDateTime(true), compareDateTime),
8212
+ "iso-time": fmtDef(getTime(), compareIsoTime),
8213
+ "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
8214
+ duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
8215
+ uri,
8216
+ "uri-reference": /^(?:[a-z][a-z0-9+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:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
8217
+ "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
8218
+ url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
8219
+ email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
8220
+ hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
8221
+ ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
8222
+ ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
8223
+ regex,
8224
+ uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
8225
+ "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
8226
+ "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
8227
+ "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
8228
+ byte,
8229
+ int32: {
8230
+ type: "number",
8231
+ validate: validateInt32
8232
+ },
8233
+ int64: {
8234
+ type: "number",
8235
+ validate: validateInt64
8236
+ },
8237
+ float: {
8238
+ type: "number",
8239
+ validate: validateNumber
8240
+ },
8241
+ double: {
8242
+ type: "number",
8243
+ validate: validateNumber
8244
+ },
8245
+ password: true,
8246
+ binary: true
8247
+ };
8248
+ exports.fastFormats = {
8249
+ ...exports.fullFormats,
8250
+ date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
8251
+ time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
8252
+ "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
8253
+ "iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
8254
+ "iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
8255
+ uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
8256
+ "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
8257
+ email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
8258
+ };
8259
+ exports.formatNames = Object.keys(exports.fullFormats);
8260
+ function isLeapYear(year) {
8261
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
8262
+ }
8263
+ const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
8264
+ const DAYS = [
8265
+ 0,
8266
+ 31,
8267
+ 28,
8268
+ 31,
8269
+ 30,
8270
+ 31,
8271
+ 30,
8272
+ 31,
8273
+ 31,
8274
+ 30,
8275
+ 31,
8276
+ 30,
8277
+ 31
8278
+ ];
8279
+ function date(str) {
8280
+ const matches = DATE.exec(str);
8281
+ if (!matches) return false;
8282
+ const year = +matches[1];
8283
+ const month = +matches[2];
8284
+ const day = +matches[3];
8285
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
8286
+ }
8287
+ function compareDate(d1, d2) {
8288
+ if (!(d1 && d2)) return void 0;
8289
+ if (d1 > d2) return 1;
8290
+ if (d1 < d2) return -1;
8291
+ return 0;
8292
+ }
8293
+ const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
8294
+ function getTime(strictTimeZone) {
8295
+ return function time(str) {
8296
+ const matches = TIME.exec(str);
8297
+ if (!matches) return false;
8298
+ const hr = +matches[1];
8299
+ const min = +matches[2];
8300
+ const sec = +matches[3];
8301
+ const tz = matches[4];
8302
+ const tzSign = matches[5] === "-" ? -1 : 1;
8303
+ const tzH = +(matches[6] || 0);
8304
+ const tzM = +(matches[7] || 0);
8305
+ if (tzH > 23 || tzM > 59 || strictTimeZone && !tz) return false;
8306
+ if (hr <= 23 && min <= 59 && sec < 60) return true;
8307
+ const utcMin = min - tzM * tzSign;
8308
+ const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
8309
+ return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
8310
+ };
8311
+ }
8312
+ function compareTime(s1, s2) {
8313
+ if (!(s1 && s2)) return void 0;
8314
+ const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf();
8315
+ const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf();
8316
+ if (!(t1 && t2)) return void 0;
8317
+ return t1 - t2;
8318
+ }
8319
+ function compareIsoTime(t1, t2) {
8320
+ if (!(t1 && t2)) return void 0;
8321
+ const a1 = TIME.exec(t1);
8322
+ const a2 = TIME.exec(t2);
8323
+ if (!(a1 && a2)) return void 0;
8324
+ t1 = a1[1] + a1[2] + a1[3];
8325
+ t2 = a2[1] + a2[2] + a2[3];
8326
+ if (t1 > t2) return 1;
8327
+ if (t1 < t2) return -1;
8328
+ return 0;
8329
+ }
8330
+ const DATE_TIME_SEPARATOR = /t|\s/i;
8331
+ function getDateTime(strictTimeZone) {
8332
+ const time = getTime(strictTimeZone);
8333
+ return function date_time(str) {
8334
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
8335
+ return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
8336
+ };
8337
+ }
8338
+ function compareDateTime(dt1, dt2) {
8339
+ if (!(dt1 && dt2)) return void 0;
8340
+ const d1 = new Date(dt1).valueOf();
8341
+ const d2 = new Date(dt2).valueOf();
8342
+ if (!(d1 && d2)) return void 0;
8343
+ return d1 - d2;
8344
+ }
8345
+ function compareIsoDateTime(dt1, dt2) {
8346
+ if (!(dt1 && dt2)) return void 0;
8347
+ const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
8348
+ const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
8349
+ const res = compareDate(d1, d2);
8350
+ if (res === void 0) return void 0;
8351
+ return res || compareTime(t1, t2);
8352
+ }
8353
+ const NOT_URI_FRAGMENT = /\/|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/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
8355
+ function uri(str) {
8356
+ return NOT_URI_FRAGMENT.test(str) && URI.test(str);
8357
+ }
8358
+ const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
8359
+ function byte(str) {
8360
+ BYTE.lastIndex = 0;
8361
+ return BYTE.test(str);
8362
+ }
8363
+ const MIN_INT32 = -(2 ** 31);
8364
+ const MAX_INT32 = 2 ** 31 - 1;
8365
+ function validateInt32(value) {
8366
+ return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
8367
+ }
8368
+ function validateInt64(value) {
8369
+ return Number.isInteger(value);
8370
+ }
8371
+ function validateNumber() {
8372
+ return true;
8373
+ }
8374
+ const Z_ANCHOR = /[^\\]\\Z/;
8375
+ function regex(str) {
8376
+ if (Z_ANCHOR.test(str)) return false;
8377
+ try {
8378
+ new RegExp(str);
8379
+ return true;
8380
+ } catch (e) {
8381
+ return false;
8382
+ }
8383
+ }
8384
+ }));
8385
+ var require_limit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
8386
+ Object.defineProperty(exports, "__esModule", { value: true });
8387
+ exports.formatLimitDefinition = void 0;
8388
+ const ajv_1 = require_ajv();
8389
+ const codegen_1 = require_codegen();
8390
+ const ops = codegen_1.operators;
8391
+ const KWDs = {
8392
+ formatMaximum: {
8393
+ okStr: "<=",
8394
+ ok: ops.LTE,
8395
+ fail: ops.GT
8396
+ },
8397
+ formatMinimum: {
8398
+ okStr: ">=",
8399
+ ok: ops.GTE,
8400
+ fail: ops.LT
8401
+ },
8402
+ formatExclusiveMaximum: {
8403
+ okStr: "<",
8404
+ ok: ops.LT,
8405
+ fail: ops.GTE
8406
+ },
8407
+ formatExclusiveMinimum: {
8408
+ okStr: ">",
8409
+ ok: ops.GT,
8410
+ fail: ops.LTE
8411
+ }
8412
+ };
8413
+ exports.formatLimitDefinition = {
8414
+ keyword: Object.keys(KWDs),
8415
+ type: "string",
8416
+ schemaType: "string",
8417
+ $data: true,
8418
+ error: {
8419
+ message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
8420
+ params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
8421
+ },
8422
+ code(cxt) {
8423
+ const { gen, data, schemaCode, keyword, it } = cxt;
8424
+ const { opts, self } = it;
8425
+ if (!opts.validateFormats) return;
8426
+ const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
8427
+ if (fCxt.$data) validate$DataFormat();
8428
+ else validateFormat();
8429
+ function validate$DataFormat() {
8430
+ const fmts = gen.scopeValue("formats", {
8431
+ ref: self.formats,
8432
+ code: opts.code.formats
8433
+ });
8434
+ const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
8435
+ cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
8436
+ }
8437
+ function validateFormat() {
8438
+ const format = fCxt.schema;
8439
+ const fmtDef = self.formats[format];
8440
+ if (!fmtDef || fmtDef === true) return;
8441
+ if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
8442
+ const fmt = gen.scopeValue("formats", {
8443
+ key: format,
8444
+ ref: fmtDef,
8445
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
8446
+ });
8447
+ cxt.fail$data(compareCode(fmt));
8448
+ }
8449
+ function compareCode(fmt) {
8450
+ return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
8451
+ }
8452
+ },
8453
+ dependencies: ["format"]
8454
+ };
8455
+ const formatLimitPlugin = (ajv) => {
8456
+ ajv.addKeyword(exports.formatLimitDefinition);
8457
+ return ajv;
8458
+ };
8459
+ exports.default = formatLimitPlugin;
8460
+ }));
8461
+ var require_dist = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
8462
+ Object.defineProperty(exports, "__esModule", { value: true });
8463
+ const formats_1 = require_formats();
8464
+ const limit_1 = require_limit();
8465
+ const codegen_1 = require_codegen();
8466
+ const fullName = new codegen_1.Name("fullFormats");
8467
+ const fastName = new codegen_1.Name("fastFormats");
8468
+ const formatsPlugin = (ajv, opts = { keywords: true }) => {
8469
+ if (Array.isArray(opts)) {
8470
+ addFormats(ajv, opts, formats_1.fullFormats, fullName);
8471
+ return ajv;
8472
+ }
8473
+ const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
8474
+ addFormats(ajv, opts.formats || formats_1.formatNames, formats, exportName);
8475
+ if (opts.keywords) (0, limit_1.default)(ajv);
8476
+ return ajv;
8477
+ };
8478
+ formatsPlugin.get = (name, mode = "full") => {
8479
+ const f = (mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats)[name];
8480
+ if (!f) throw new Error(`Unknown format "${name}"`);
8481
+ return f;
8482
+ };
8483
+ function addFormats(ajv, list, fs, exportName) {
8484
+ var _a;
8485
+ var _b;
8486
+ (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
8487
+ for (const f of list) ajv.addFormat(f, fs[f]);
8488
+ }
8489
+ module.exports = exports = formatsPlugin;
8490
+ Object.defineProperty(exports, "__esModule", { value: true });
8491
+ exports.default = formatsPlugin;
8492
+ }));
8199
8493
  var import_ajv = require_ajv();
8200
8494
  var import__2020 = /* @__PURE__ */ __toESM$1(require__2020(), 1);
8495
+ var import_dist = /* @__PURE__ */ __toESM$1(require_dist(), 1);
8201
8496
  var import_json_schema_traverse$2 = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);
8202
8497
  /**
8203
8498
  * Vendor name for JSON Schema wrapped schemas.
@@ -8324,13 +8619,15 @@ var JsonSchemaWrapper = class {
8324
8619
  */
8325
8620
  #getAjvValidator() {
8326
8621
  if (!this.#ajvValidateCache) {
8327
- const AjvClass = typeof this.#schema.$schema === "string" && this.#schema.$schema.includes("2020-12") ? import__2020.default : import_ajv.Ajv;
8328
- this.#ajvInstance = new AjvClass({
8622
+ const ajv = new (typeof this.#schema.$schema === "string" && this.#schema.$schema.includes("2020-12") ? import__2020.default : import_ajv.Ajv)({
8329
8623
  allErrors: true,
8330
8624
  strict: false,
8331
8625
  ...this.#options.ajvOptions
8332
8626
  });
8333
- this.#ajvValidateCache = this.#ajvInstance.compile(this.#schema);
8627
+ (0, import_dist.default)(ajv);
8628
+ for (const [name, format] of Object.entries(this.#options.ajvOptions?.formats ?? {})) if (format !== void 0) ajv.addFormat(name, format);
8629
+ this.#ajvInstance = ajv;
8630
+ this.#ajvValidateCache = ajv.compile(this.#schema);
8334
8631
  }
8335
8632
  return this.#ajvValidateCache;
8336
8633
  }
@@ -8482,7 +8779,7 @@ function toStandardSchema$3(zodSchema) {
8482
8779
  });
8483
8780
  return wrapper;
8484
8781
  }
8485
- // ../schema-compat/dist/schema-Bf12g7KC.js
8782
+ // ../schema-compat/dist/schema-TQPB_dl2.js
8486
8783
  /**
8487
8784
  * Supported JSON Schema targets for z.toJSONSchema().
8488
8785
  * Works with both real Zod v4 and Zod 3.25's v4 compat layer.
@@ -8508,10 +8805,13 @@ const ZOD_V4_TARGET_MAP = {
8508
8805
  *
8509
8806
  * @internal
8510
8807
  */
8511
- function convertToJsonSchema(zodSchema, options, adapterOptions) {
8808
+ function convertToJsonSchema(zodSchema, options, adapterOptions, io) {
8512
8809
  patchRecordSchemas(zodSchema);
8513
8810
  const target = SUPPORTED_TARGETS.has(options.target) ? options.target : "draft-07";
8514
- const jsonSchemaOptions = { target: ZOD_V4_TARGET_MAP[target] ?? target };
8811
+ const jsonSchemaOptions = {
8812
+ target: ZOD_V4_TARGET_MAP[target] ?? target,
8813
+ io
8814
+ };
8515
8815
  if (adapterOptions.unrepresentable) jsonSchemaOptions.unrepresentable = adapterOptions.unrepresentable;
8516
8816
  if (adapterOptions.override) jsonSchemaOptions.override = adapterOptions.override;
8517
8817
  return (0, zod_v4.toJSONSchema)(zodSchema, jsonSchemaOptions);
@@ -8533,10 +8833,10 @@ function toStandardSchema$1$1(zodSchema, adapterOptions = {}) {
8533
8833
  const existingStandard = zodSchema["~standard"];
8534
8834
  const jsonSchemaConverter = {
8535
8835
  input: (options) => {
8536
- return convertToJsonSchema(zodSchema, options, adapterOptions);
8836
+ return convertToJsonSchema(zodSchema, options, adapterOptions, "input");
8537
8837
  },
8538
8838
  output: (options) => {
8539
- return convertToJsonSchema(zodSchema, options, adapterOptions);
8839
+ return convertToJsonSchema(zodSchema, options, adapterOptions, "output");
8540
8840
  }
8541
8841
  };
8542
8842
  Object.defineProperty(wrapper, "~standard", {
@@ -23617,7 +23917,7 @@ var MCPServer = class extends _mastra_core_mcp.MCPServerBase {
23617
23917
  eventsCapability() {
23618
23918
  return {};
23619
23919
  }
23620
- createServerInstance() {
23920
+ createServerInstance(era = "modern") {
23621
23921
  const server = new _modelcontextprotocol_server.Server({
23622
23922
  name: this.name,
23623
23923
  version: this.version,
@@ -23632,7 +23932,7 @@ var MCPServer = class extends _mastra_core_mcp.MCPServerBase {
23632
23932
  cacheHints: this.cacheHints,
23633
23933
  requestState: { verify: this.requestStateCodec.verify }
23634
23934
  });
23635
- server.removeRequestHandler("logging/setLevel");
23935
+ if (era === "modern") server.removeRequestHandler("logging/setLevel");
23636
23936
  this.registerToolHandlers(server);
23637
23937
  this.registerResourceHandlers(server);
23638
23938
  this.registerPromptHandlers(server);
@@ -24799,7 +25099,7 @@ var MCPServer = class extends _mastra_core_mcp.MCPServerBase {
24799
25099
  }
24800
25100
  getNodeHandler() {
24801
25101
  if (!this.nodeHandler) {
24802
- this.httpHandler = (0, _modelcontextprotocol_server.createMcpHandler)(() => this.createServerInstance(), {
25102
+ this.httpHandler = (0, _modelcontextprotocol_server.createMcpHandler)(({ era }) => this.createServerInstance(era), {
24803
25103
  legacy: this.legacy,
24804
25104
  onerror: (error) => this.logger.error("MCP handler error", { error: error.toString() })
24805
25105
  });