@kentico/management-api-mcp 30.12.2-preview → 30.12.3-preview

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.
Files changed (2) hide show
  1. package/dist/index.js +1626 -322
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -469,9 +469,9 @@ var require_codegen = __commonJS({
469
469
  }
470
470
  };
471
471
  var Throw = class extends Node {
472
- constructor(error) {
472
+ constructor(error2) {
473
473
  super();
474
- this.error = error;
474
+ this.error = error2;
475
475
  }
476
476
  render({ _n }) {
477
477
  return `throw ${this.error};` + _n;
@@ -708,9 +708,9 @@ var require_codegen = __commonJS({
708
708
  }
709
709
  };
710
710
  var Catch = class extends BlockNode {
711
- constructor(error) {
711
+ constructor(error2) {
712
712
  super();
713
- this.error = error;
713
+ this.error = error2;
714
714
  }
715
715
  render(opts) {
716
716
  return `catch(${this.error})` + super.render(opts);
@@ -901,9 +901,9 @@ var require_codegen = __commonJS({
901
901
  this._blockNode(node);
902
902
  this.code(tryBody);
903
903
  if (catchCode) {
904
- const error = this.name("e");
905
- this._currNode = node.catch = new Catch(error);
906
- catchCode(error);
904
+ const error2 = this.name("e");
905
+ this._currNode = node.catch = new Catch(error2);
906
+ catchCode(error2);
907
907
  }
908
908
  if (finallyCode) {
909
909
  this._currNode = node.finally = new Finally();
@@ -912,8 +912,8 @@ var require_codegen = __commonJS({
912
912
  return this._endBlockNode(Catch, Finally);
913
913
  }
914
914
  // `throw` statement
915
- throw(error) {
916
- return this._leafNode(new Throw(error));
915
+ throw(error2) {
916
+ return this._leafNode(new Throw(error2));
917
917
  }
918
918
  // start self-balancing block
919
919
  block(body, nodeCount) {
@@ -1269,10 +1269,10 @@ var require_errors = __commonJS({
1269
1269
  exports.keyword$DataError = {
1270
1270
  message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
1271
1271
  };
1272
- function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
1272
+ function reportError(cxt, error2 = exports.keywordError, errorPaths, overrideAllErrors) {
1273
1273
  const { it } = cxt;
1274
1274
  const { gen, compositeRule, allErrors } = it;
1275
- const errObj = errorObjectCode(cxt, error, errorPaths);
1275
+ const errObj = errorObjectCode(cxt, error2, errorPaths);
1276
1276
  if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
1277
1277
  addError(gen, errObj);
1278
1278
  } else {
@@ -1280,10 +1280,10 @@ var require_errors = __commonJS({
1280
1280
  }
1281
1281
  }
1282
1282
  exports.reportError = reportError;
1283
- function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
1283
+ function reportExtraError(cxt, error2 = exports.keywordError, errorPaths) {
1284
1284
  const { it } = cxt;
1285
1285
  const { gen, compositeRule, allErrors } = it;
1286
- const errObj = errorObjectCode(cxt, error, errorPaths);
1286
+ const errObj = errorObjectCode(cxt, error2, errorPaths);
1287
1287
  addError(gen, errObj);
1288
1288
  if (!(compositeRule || allErrors)) {
1289
1289
  returnErrors(it, names_1.default.vErrors);
@@ -1334,19 +1334,19 @@ var require_errors = __commonJS({
1334
1334
  schema: new codegen_1.Name("schema"),
1335
1335
  parentSchema: new codegen_1.Name("parentSchema")
1336
1336
  };
1337
- function errorObjectCode(cxt, error, errorPaths) {
1337
+ function errorObjectCode(cxt, error2, errorPaths) {
1338
1338
  const { createErrors } = cxt.it;
1339
1339
  if (createErrors === false)
1340
1340
  return (0, codegen_1._)`{}`;
1341
- return errorObject(cxt, error, errorPaths);
1341
+ return errorObject(cxt, error2, errorPaths);
1342
1342
  }
1343
- function errorObject(cxt, error, errorPaths = {}) {
1343
+ function errorObject(cxt, error2, errorPaths = {}) {
1344
1344
  const { gen, it } = cxt;
1345
1345
  const keyValues = [
1346
1346
  errorInstancePath(it, errorPaths),
1347
1347
  errorSchemaPath(cxt, errorPaths)
1348
1348
  ];
1349
- extraErrorProps(cxt, error, keyValues);
1349
+ extraErrorProps(cxt, error2, keyValues);
1350
1350
  return gen.object(...keyValues);
1351
1351
  }
1352
1352
  function errorInstancePath({ errorPath }, { instancePath }) {
@@ -4614,7 +4614,7 @@ var require_limitNumber = __commonJS({
4614
4614
  exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
4615
4615
  exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
4616
4616
  };
4617
- var error = {
4617
+ var error2 = {
4618
4618
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
4619
4619
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
4620
4620
  };
@@ -4623,7 +4623,7 @@ var require_limitNumber = __commonJS({
4623
4623
  type: "number",
4624
4624
  schemaType: "number",
4625
4625
  $data: true,
4626
- error,
4626
+ error: error2,
4627
4627
  code(cxt) {
4628
4628
  const { keyword, data, schemaCode } = cxt;
4629
4629
  cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
@@ -4639,7 +4639,7 @@ var require_multipleOf = __commonJS({
4639
4639
  "use strict";
4640
4640
  Object.defineProperty(exports, "__esModule", { value: true });
4641
4641
  var codegen_1 = require_codegen();
4642
- var error = {
4642
+ var error2 = {
4643
4643
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
4644
4644
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
4645
4645
  };
@@ -4648,7 +4648,7 @@ var require_multipleOf = __commonJS({
4648
4648
  type: "number",
4649
4649
  schemaType: "number",
4650
4650
  $data: true,
4651
- error,
4651
+ error: error2,
4652
4652
  code(cxt) {
4653
4653
  const { gen, data, schemaCode, it } = cxt;
4654
4654
  const prec = it.opts.multipleOfPrecision;
@@ -4695,7 +4695,7 @@ var require_limitLength = __commonJS({
4695
4695
  var codegen_1 = require_codegen();
4696
4696
  var util_1 = require_util();
4697
4697
  var ucs2length_1 = require_ucs2length();
4698
- var error = {
4698
+ var error2 = {
4699
4699
  message({ keyword, schemaCode }) {
4700
4700
  const comp = keyword === "maxLength" ? "more" : "fewer";
4701
4701
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
@@ -4707,7 +4707,7 @@ var require_limitLength = __commonJS({
4707
4707
  type: "string",
4708
4708
  schemaType: "number",
4709
4709
  $data: true,
4710
- error,
4710
+ error: error2,
4711
4711
  code(cxt) {
4712
4712
  const { keyword, data, schemaCode, it } = cxt;
4713
4713
  const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -4726,7 +4726,7 @@ var require_pattern = __commonJS({
4726
4726
  Object.defineProperty(exports, "__esModule", { value: true });
4727
4727
  var code_1 = require_code2();
4728
4728
  var codegen_1 = require_codegen();
4729
- var error = {
4729
+ var error2 = {
4730
4730
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
4731
4731
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
4732
4732
  };
@@ -4735,7 +4735,7 @@ var require_pattern = __commonJS({
4735
4735
  type: "string",
4736
4736
  schemaType: "string",
4737
4737
  $data: true,
4738
- error,
4738
+ error: error2,
4739
4739
  code(cxt) {
4740
4740
  const { data, $data, schema, schemaCode, it } = cxt;
4741
4741
  const u = it.opts.unicodeRegExp ? "u" : "";
@@ -4753,7 +4753,7 @@ var require_limitProperties = __commonJS({
4753
4753
  "use strict";
4754
4754
  Object.defineProperty(exports, "__esModule", { value: true });
4755
4755
  var codegen_1 = require_codegen();
4756
- var error = {
4756
+ var error2 = {
4757
4757
  message({ keyword, schemaCode }) {
4758
4758
  const comp = keyword === "maxProperties" ? "more" : "fewer";
4759
4759
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
@@ -4765,7 +4765,7 @@ var require_limitProperties = __commonJS({
4765
4765
  type: "object",
4766
4766
  schemaType: "number",
4767
4767
  $data: true,
4768
- error,
4768
+ error: error2,
4769
4769
  code(cxt) {
4770
4770
  const { keyword, data, schemaCode } = cxt;
4771
4771
  const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -4784,7 +4784,7 @@ var require_required = __commonJS({
4784
4784
  var code_1 = require_code2();
4785
4785
  var codegen_1 = require_codegen();
4786
4786
  var util_1 = require_util();
4787
- var error = {
4787
+ var error2 = {
4788
4788
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
4789
4789
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
4790
4790
  };
@@ -4793,7 +4793,7 @@ var require_required = __commonJS({
4793
4793
  type: "object",
4794
4794
  schemaType: "array",
4795
4795
  $data: true,
4796
- error,
4796
+ error: error2,
4797
4797
  code(cxt) {
4798
4798
  const { gen, schema, schemaCode, data, $data, it } = cxt;
4799
4799
  const { opts } = it;
@@ -4864,7 +4864,7 @@ var require_limitItems = __commonJS({
4864
4864
  "use strict";
4865
4865
  Object.defineProperty(exports, "__esModule", { value: true });
4866
4866
  var codegen_1 = require_codegen();
4867
- var error = {
4867
+ var error2 = {
4868
4868
  message({ keyword, schemaCode }) {
4869
4869
  const comp = keyword === "maxItems" ? "more" : "fewer";
4870
4870
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
@@ -4876,7 +4876,7 @@ var require_limitItems = __commonJS({
4876
4876
  type: "array",
4877
4877
  schemaType: "number",
4878
4878
  $data: true,
4879
- error,
4879
+ error: error2,
4880
4880
  code(cxt) {
4881
4881
  const { keyword, data, schemaCode } = cxt;
4882
4882
  const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -4907,7 +4907,7 @@ var require_uniqueItems = __commonJS({
4907
4907
  var codegen_1 = require_codegen();
4908
4908
  var util_1 = require_util();
4909
4909
  var equal_1 = require_equal();
4910
- var error = {
4910
+ var error2 = {
4911
4911
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
4912
4912
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
4913
4913
  };
@@ -4916,7 +4916,7 @@ var require_uniqueItems = __commonJS({
4916
4916
  type: "array",
4917
4917
  schemaType: "boolean",
4918
4918
  $data: true,
4919
- error,
4919
+ error: error2,
4920
4920
  code(cxt) {
4921
4921
  const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
4922
4922
  if (!$data && !schema)
@@ -4973,14 +4973,14 @@ var require_const = __commonJS({
4973
4973
  var codegen_1 = require_codegen();
4974
4974
  var util_1 = require_util();
4975
4975
  var equal_1 = require_equal();
4976
- var error = {
4976
+ var error2 = {
4977
4977
  message: "must be equal to constant",
4978
4978
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
4979
4979
  };
4980
4980
  var def = {
4981
4981
  keyword: "const",
4982
4982
  $data: true,
4983
- error,
4983
+ error: error2,
4984
4984
  code(cxt) {
4985
4985
  const { gen, data, $data, schemaCode, schema } = cxt;
4986
4986
  if ($data || schema && typeof schema == "object") {
@@ -5002,7 +5002,7 @@ var require_enum = __commonJS({
5002
5002
  var codegen_1 = require_codegen();
5003
5003
  var util_1 = require_util();
5004
5004
  var equal_1 = require_equal();
5005
- var error = {
5005
+ var error2 = {
5006
5006
  message: "must be equal to one of the allowed values",
5007
5007
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
5008
5008
  };
@@ -5010,7 +5010,7 @@ var require_enum = __commonJS({
5010
5010
  keyword: "enum",
5011
5011
  schemaType: "array",
5012
5012
  $data: true,
5013
- error,
5013
+ error: error2,
5014
5014
  code(cxt) {
5015
5015
  const { gen, data, $data, schema, schemaCode, it } = cxt;
5016
5016
  if (!$data && schema.length === 0)
@@ -5089,7 +5089,7 @@ var require_additionalItems = __commonJS({
5089
5089
  exports.validateAdditionalItems = void 0;
5090
5090
  var codegen_1 = require_codegen();
5091
5091
  var util_1 = require_util();
5092
- var error = {
5092
+ var error2 = {
5093
5093
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5094
5094
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5095
5095
  };
@@ -5098,7 +5098,7 @@ var require_additionalItems = __commonJS({
5098
5098
  type: "array",
5099
5099
  schemaType: ["boolean", "object"],
5100
5100
  before: "uniqueItems",
5101
- error,
5101
+ error: error2,
5102
5102
  code(cxt) {
5103
5103
  const { parentSchema, it } = cxt;
5104
5104
  const { items } = parentSchema;
@@ -5217,7 +5217,7 @@ var require_items2020 = __commonJS({
5217
5217
  var util_1 = require_util();
5218
5218
  var code_1 = require_code2();
5219
5219
  var additionalItems_1 = require_additionalItems();
5220
- var error = {
5220
+ var error2 = {
5221
5221
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5222
5222
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
5223
5223
  };
@@ -5226,7 +5226,7 @@ var require_items2020 = __commonJS({
5226
5226
  type: "array",
5227
5227
  schemaType: ["object", "boolean"],
5228
5228
  before: "uniqueItems",
5229
- error,
5229
+ error: error2,
5230
5230
  code(cxt) {
5231
5231
  const { schema, parentSchema, it } = cxt;
5232
5232
  const { prefixItems } = parentSchema;
@@ -5250,7 +5250,7 @@ var require_contains = __commonJS({
5250
5250
  Object.defineProperty(exports, "__esModule", { value: true });
5251
5251
  var codegen_1 = require_codegen();
5252
5252
  var util_1 = require_util();
5253
- var error = {
5253
+ var error2 = {
5254
5254
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5255
5255
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
5256
5256
  };
@@ -5260,7 +5260,7 @@ var require_contains = __commonJS({
5260
5260
  schemaType: ["object", "boolean"],
5261
5261
  before: "uniqueItems",
5262
5262
  trackErrors: true,
5263
- error,
5263
+ error: error2,
5264
5264
  code(cxt) {
5265
5265
  const { gen, schema, parentSchema, data, it } = cxt;
5266
5266
  let min;
@@ -5438,7 +5438,7 @@ var require_propertyNames = __commonJS({
5438
5438
  Object.defineProperty(exports, "__esModule", { value: true });
5439
5439
  var codegen_1 = require_codegen();
5440
5440
  var util_1 = require_util();
5441
- var error = {
5441
+ var error2 = {
5442
5442
  message: "property name must be valid",
5443
5443
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
5444
5444
  };
@@ -5446,7 +5446,7 @@ var require_propertyNames = __commonJS({
5446
5446
  keyword: "propertyNames",
5447
5447
  type: "object",
5448
5448
  schemaType: ["object", "boolean"],
5449
- error,
5449
+ error: error2,
5450
5450
  code(cxt) {
5451
5451
  const { gen, schema, data, it } = cxt;
5452
5452
  if ((0, util_1.alwaysValidSchema)(it, schema))
@@ -5483,7 +5483,7 @@ var require_additionalProperties = __commonJS({
5483
5483
  var codegen_1 = require_codegen();
5484
5484
  var names_1 = require_names();
5485
5485
  var util_1 = require_util();
5486
- var error = {
5486
+ var error2 = {
5487
5487
  message: "must NOT have additional properties",
5488
5488
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
5489
5489
  };
@@ -5493,7 +5493,7 @@ var require_additionalProperties = __commonJS({
5493
5493
  schemaType: ["boolean", "object"],
5494
5494
  allowUndefined: true,
5495
5495
  trackErrors: true,
5496
- error,
5496
+ error: error2,
5497
5497
  code(cxt) {
5498
5498
  const { gen, schema, parentSchema, data, errsCount, it } = cxt;
5499
5499
  if (!errsCount)
@@ -5767,7 +5767,7 @@ var require_oneOf = __commonJS({
5767
5767
  Object.defineProperty(exports, "__esModule", { value: true });
5768
5768
  var codegen_1 = require_codegen();
5769
5769
  var util_1 = require_util();
5770
- var error = {
5770
+ var error2 = {
5771
5771
  message: "must match exactly one schema in oneOf",
5772
5772
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
5773
5773
  };
@@ -5775,7 +5775,7 @@ var require_oneOf = __commonJS({
5775
5775
  keyword: "oneOf",
5776
5776
  schemaType: "array",
5777
5777
  trackErrors: true,
5778
- error,
5778
+ error: error2,
5779
5779
  code(cxt) {
5780
5780
  const { gen, schema, parentSchema, it } = cxt;
5781
5781
  if (!Array.isArray(schema))
@@ -5852,7 +5852,7 @@ var require_if = __commonJS({
5852
5852
  Object.defineProperty(exports, "__esModule", { value: true });
5853
5853
  var codegen_1 = require_codegen();
5854
5854
  var util_1 = require_util();
5855
- var error = {
5855
+ var error2 = {
5856
5856
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
5857
5857
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
5858
5858
  };
@@ -5860,7 +5860,7 @@ var require_if = __commonJS({
5860
5860
  keyword: "if",
5861
5861
  schemaType: ["object", "boolean"],
5862
5862
  trackErrors: true,
5863
- error,
5863
+ error: error2,
5864
5864
  code(cxt) {
5865
5865
  const { gen, parentSchema, it } = cxt;
5866
5866
  if (parentSchema.then === void 0 && parentSchema.else === void 0) {
@@ -5986,7 +5986,7 @@ var require_format = __commonJS({
5986
5986
  "use strict";
5987
5987
  Object.defineProperty(exports, "__esModule", { value: true });
5988
5988
  var codegen_1 = require_codegen();
5989
- var error = {
5989
+ var error2 = {
5990
5990
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
5991
5991
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
5992
5992
  };
@@ -5995,7 +5995,7 @@ var require_format = __commonJS({
5995
5995
  type: ["number", "string"],
5996
5996
  schemaType: "string",
5997
5997
  $data: true,
5998
- error,
5998
+ error: error2,
5999
5999
  code(cxt, ruleType) {
6000
6000
  const { gen, data, $data, schema, schemaCode, it } = cxt;
6001
6001
  const { opts, errSchemaPath, schemaEnv, self } = it;
@@ -6150,7 +6150,7 @@ var require_discriminator = __commonJS({
6150
6150
  var compile_1 = require_compile();
6151
6151
  var ref_error_1 = require_ref_error();
6152
6152
  var util_1 = require_util();
6153
- var error = {
6153
+ var error2 = {
6154
6154
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
6155
6155
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
6156
6156
  };
@@ -6158,7 +6158,7 @@ var require_discriminator = __commonJS({
6158
6158
  keyword: "discriminator",
6159
6159
  type: "object",
6160
6160
  schemaType: "object",
6161
- error,
6161
+ error: error2,
6162
6162
  code(cxt) {
6163
6163
  const { gen, data, schema, parentSchema, it } = cxt;
6164
6164
  const { oneOf } = parentSchema;
@@ -7115,9 +7115,9 @@ var require_codegen2 = __commonJS({
7115
7115
  }
7116
7116
  };
7117
7117
  var Throw = class extends Node {
7118
- constructor(error) {
7118
+ constructor(error2) {
7119
7119
  super();
7120
- this.error = error;
7120
+ this.error = error2;
7121
7121
  }
7122
7122
  render({ _n }) {
7123
7123
  return `throw ${this.error};` + _n;
@@ -7354,9 +7354,9 @@ var require_codegen2 = __commonJS({
7354
7354
  }
7355
7355
  };
7356
7356
  var Catch = class extends BlockNode {
7357
- constructor(error) {
7357
+ constructor(error2) {
7358
7358
  super();
7359
- this.error = error;
7359
+ this.error = error2;
7360
7360
  }
7361
7361
  render(opts) {
7362
7362
  return `catch(${this.error})` + super.render(opts);
@@ -7547,9 +7547,9 @@ var require_codegen2 = __commonJS({
7547
7547
  this._blockNode(node);
7548
7548
  this.code(tryBody);
7549
7549
  if (catchCode) {
7550
- const error = this.name("e");
7551
- this._currNode = node.catch = new Catch(error);
7552
- catchCode(error);
7550
+ const error2 = this.name("e");
7551
+ this._currNode = node.catch = new Catch(error2);
7552
+ catchCode(error2);
7553
7553
  }
7554
7554
  if (finallyCode) {
7555
7555
  this._currNode = node.finally = new Finally();
@@ -7558,8 +7558,8 @@ var require_codegen2 = __commonJS({
7558
7558
  return this._endBlockNode(Catch, Finally);
7559
7559
  }
7560
7560
  // `throw` statement
7561
- throw(error) {
7562
- return this._leafNode(new Throw(error));
7561
+ throw(error2) {
7562
+ return this._leafNode(new Throw(error2));
7563
7563
  }
7564
7564
  // start self-balancing block
7565
7565
  block(body, nodeCount) {
@@ -7915,10 +7915,10 @@ var require_errors2 = __commonJS({
7915
7915
  exports.keyword$DataError = {
7916
7916
  message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
7917
7917
  };
7918
- function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
7918
+ function reportError(cxt, error2 = exports.keywordError, errorPaths, overrideAllErrors) {
7919
7919
  const { it } = cxt;
7920
7920
  const { gen, compositeRule, allErrors } = it;
7921
- const errObj = errorObjectCode(cxt, error, errorPaths);
7921
+ const errObj = errorObjectCode(cxt, error2, errorPaths);
7922
7922
  if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
7923
7923
  addError(gen, errObj);
7924
7924
  } else {
@@ -7926,10 +7926,10 @@ var require_errors2 = __commonJS({
7926
7926
  }
7927
7927
  }
7928
7928
  exports.reportError = reportError;
7929
- function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
7929
+ function reportExtraError(cxt, error2 = exports.keywordError, errorPaths) {
7930
7930
  const { it } = cxt;
7931
7931
  const { gen, compositeRule, allErrors } = it;
7932
- const errObj = errorObjectCode(cxt, error, errorPaths);
7932
+ const errObj = errorObjectCode(cxt, error2, errorPaths);
7933
7933
  addError(gen, errObj);
7934
7934
  if (!(compositeRule || allErrors)) {
7935
7935
  returnErrors(it, names_1.default.vErrors);
@@ -7980,19 +7980,19 @@ var require_errors2 = __commonJS({
7980
7980
  schema: new codegen_1.Name("schema"),
7981
7981
  parentSchema: new codegen_1.Name("parentSchema")
7982
7982
  };
7983
- function errorObjectCode(cxt, error, errorPaths) {
7983
+ function errorObjectCode(cxt, error2, errorPaths) {
7984
7984
  const { createErrors } = cxt.it;
7985
7985
  if (createErrors === false)
7986
7986
  return (0, codegen_1._)`{}`;
7987
- return errorObject(cxt, error, errorPaths);
7987
+ return errorObject(cxt, error2, errorPaths);
7988
7988
  }
7989
- function errorObject(cxt, error, errorPaths = {}) {
7989
+ function errorObject(cxt, error2, errorPaths = {}) {
7990
7990
  const { gen, it } = cxt;
7991
7991
  const keyValues = [
7992
7992
  errorInstancePath(it, errorPaths),
7993
7993
  errorSchemaPath(cxt, errorPaths)
7994
7994
  ];
7995
- extraErrorProps(cxt, error, keyValues);
7995
+ extraErrorProps(cxt, error2, keyValues);
7996
7996
  return gen.object(...keyValues);
7997
7997
  }
7998
7998
  function errorInstancePath({ errorPath }, { instancePath }) {
@@ -10503,7 +10503,7 @@ var require_limitNumber2 = __commonJS({
10503
10503
  exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
10504
10504
  exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
10505
10505
  };
10506
- var error = {
10506
+ var error2 = {
10507
10507
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
10508
10508
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
10509
10509
  };
@@ -10512,7 +10512,7 @@ var require_limitNumber2 = __commonJS({
10512
10512
  type: "number",
10513
10513
  schemaType: "number",
10514
10514
  $data: true,
10515
- error,
10515
+ error: error2,
10516
10516
  code(cxt) {
10517
10517
  const { keyword, data, schemaCode } = cxt;
10518
10518
  cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
@@ -10528,7 +10528,7 @@ var require_multipleOf2 = __commonJS({
10528
10528
  "use strict";
10529
10529
  Object.defineProperty(exports, "__esModule", { value: true });
10530
10530
  var codegen_1 = require_codegen2();
10531
- var error = {
10531
+ var error2 = {
10532
10532
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
10533
10533
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
10534
10534
  };
@@ -10537,7 +10537,7 @@ var require_multipleOf2 = __commonJS({
10537
10537
  type: "number",
10538
10538
  schemaType: "number",
10539
10539
  $data: true,
10540
- error,
10540
+ error: error2,
10541
10541
  code(cxt) {
10542
10542
  const { gen, data, schemaCode, it } = cxt;
10543
10543
  const prec = it.opts.multipleOfPrecision;
@@ -10584,7 +10584,7 @@ var require_limitLength2 = __commonJS({
10584
10584
  var codegen_1 = require_codegen2();
10585
10585
  var util_1 = require_util2();
10586
10586
  var ucs2length_1 = require_ucs2length2();
10587
- var error = {
10587
+ var error2 = {
10588
10588
  message({ keyword, schemaCode }) {
10589
10589
  const comp = keyword === "maxLength" ? "more" : "fewer";
10590
10590
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
@@ -10596,7 +10596,7 @@ var require_limitLength2 = __commonJS({
10596
10596
  type: "string",
10597
10597
  schemaType: "number",
10598
10598
  $data: true,
10599
- error,
10599
+ error: error2,
10600
10600
  code(cxt) {
10601
10601
  const { keyword, data, schemaCode, it } = cxt;
10602
10602
  const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -10615,7 +10615,7 @@ var require_pattern2 = __commonJS({
10615
10615
  Object.defineProperty(exports, "__esModule", { value: true });
10616
10616
  var code_1 = require_code4();
10617
10617
  var codegen_1 = require_codegen2();
10618
- var error = {
10618
+ var error2 = {
10619
10619
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
10620
10620
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
10621
10621
  };
@@ -10624,7 +10624,7 @@ var require_pattern2 = __commonJS({
10624
10624
  type: "string",
10625
10625
  schemaType: "string",
10626
10626
  $data: true,
10627
- error,
10627
+ error: error2,
10628
10628
  code(cxt) {
10629
10629
  const { data, $data, schema, schemaCode, it } = cxt;
10630
10630
  const u = it.opts.unicodeRegExp ? "u" : "";
@@ -10642,7 +10642,7 @@ var require_limitProperties2 = __commonJS({
10642
10642
  "use strict";
10643
10643
  Object.defineProperty(exports, "__esModule", { value: true });
10644
10644
  var codegen_1 = require_codegen2();
10645
- var error = {
10645
+ var error2 = {
10646
10646
  message({ keyword, schemaCode }) {
10647
10647
  const comp = keyword === "maxProperties" ? "more" : "fewer";
10648
10648
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
@@ -10654,7 +10654,7 @@ var require_limitProperties2 = __commonJS({
10654
10654
  type: "object",
10655
10655
  schemaType: "number",
10656
10656
  $data: true,
10657
- error,
10657
+ error: error2,
10658
10658
  code(cxt) {
10659
10659
  const { keyword, data, schemaCode } = cxt;
10660
10660
  const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -10673,7 +10673,7 @@ var require_required2 = __commonJS({
10673
10673
  var code_1 = require_code4();
10674
10674
  var codegen_1 = require_codegen2();
10675
10675
  var util_1 = require_util2();
10676
- var error = {
10676
+ var error2 = {
10677
10677
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
10678
10678
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
10679
10679
  };
@@ -10682,7 +10682,7 @@ var require_required2 = __commonJS({
10682
10682
  type: "object",
10683
10683
  schemaType: "array",
10684
10684
  $data: true,
10685
- error,
10685
+ error: error2,
10686
10686
  code(cxt) {
10687
10687
  const { gen, schema, schemaCode, data, $data, it } = cxt;
10688
10688
  const { opts } = it;
@@ -10753,7 +10753,7 @@ var require_limitItems2 = __commonJS({
10753
10753
  "use strict";
10754
10754
  Object.defineProperty(exports, "__esModule", { value: true });
10755
10755
  var codegen_1 = require_codegen2();
10756
- var error = {
10756
+ var error2 = {
10757
10757
  message({ keyword, schemaCode }) {
10758
10758
  const comp = keyword === "maxItems" ? "more" : "fewer";
10759
10759
  return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
@@ -10765,7 +10765,7 @@ var require_limitItems2 = __commonJS({
10765
10765
  type: "array",
10766
10766
  schemaType: "number",
10767
10767
  $data: true,
10768
- error,
10768
+ error: error2,
10769
10769
  code(cxt) {
10770
10770
  const { keyword, data, schemaCode } = cxt;
10771
10771
  const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
@@ -10796,7 +10796,7 @@ var require_uniqueItems2 = __commonJS({
10796
10796
  var codegen_1 = require_codegen2();
10797
10797
  var util_1 = require_util2();
10798
10798
  var equal_1 = require_equal2();
10799
- var error = {
10799
+ var error2 = {
10800
10800
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
10801
10801
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
10802
10802
  };
@@ -10805,7 +10805,7 @@ var require_uniqueItems2 = __commonJS({
10805
10805
  type: "array",
10806
10806
  schemaType: "boolean",
10807
10807
  $data: true,
10808
- error,
10808
+ error: error2,
10809
10809
  code(cxt) {
10810
10810
  const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
10811
10811
  if (!$data && !schema)
@@ -10862,14 +10862,14 @@ var require_const2 = __commonJS({
10862
10862
  var codegen_1 = require_codegen2();
10863
10863
  var util_1 = require_util2();
10864
10864
  var equal_1 = require_equal2();
10865
- var error = {
10865
+ var error2 = {
10866
10866
  message: "must be equal to constant",
10867
10867
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
10868
10868
  };
10869
10869
  var def = {
10870
10870
  keyword: "const",
10871
10871
  $data: true,
10872
- error,
10872
+ error: error2,
10873
10873
  code(cxt) {
10874
10874
  const { gen, data, $data, schemaCode, schema } = cxt;
10875
10875
  if ($data || schema && typeof schema == "object") {
@@ -10891,7 +10891,7 @@ var require_enum2 = __commonJS({
10891
10891
  var codegen_1 = require_codegen2();
10892
10892
  var util_1 = require_util2();
10893
10893
  var equal_1 = require_equal2();
10894
- var error = {
10894
+ var error2 = {
10895
10895
  message: "must be equal to one of the allowed values",
10896
10896
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
10897
10897
  };
@@ -10899,7 +10899,7 @@ var require_enum2 = __commonJS({
10899
10899
  keyword: "enum",
10900
10900
  schemaType: "array",
10901
10901
  $data: true,
10902
- error,
10902
+ error: error2,
10903
10903
  code(cxt) {
10904
10904
  const { gen, data, $data, schema, schemaCode, it } = cxt;
10905
10905
  if (!$data && schema.length === 0)
@@ -10978,7 +10978,7 @@ var require_additionalItems2 = __commonJS({
10978
10978
  exports.validateAdditionalItems = void 0;
10979
10979
  var codegen_1 = require_codegen2();
10980
10980
  var util_1 = require_util2();
10981
- var error = {
10981
+ var error2 = {
10982
10982
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
10983
10983
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
10984
10984
  };
@@ -10987,7 +10987,7 @@ var require_additionalItems2 = __commonJS({
10987
10987
  type: "array",
10988
10988
  schemaType: ["boolean", "object"],
10989
10989
  before: "uniqueItems",
10990
- error,
10990
+ error: error2,
10991
10991
  code(cxt) {
10992
10992
  const { parentSchema, it } = cxt;
10993
10993
  const { items } = parentSchema;
@@ -11106,7 +11106,7 @@ var require_items20202 = __commonJS({
11106
11106
  var util_1 = require_util2();
11107
11107
  var code_1 = require_code4();
11108
11108
  var additionalItems_1 = require_additionalItems2();
11109
- var error = {
11109
+ var error2 = {
11110
11110
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
11111
11111
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
11112
11112
  };
@@ -11115,7 +11115,7 @@ var require_items20202 = __commonJS({
11115
11115
  type: "array",
11116
11116
  schemaType: ["object", "boolean"],
11117
11117
  before: "uniqueItems",
11118
- error,
11118
+ error: error2,
11119
11119
  code(cxt) {
11120
11120
  const { schema, parentSchema, it } = cxt;
11121
11121
  const { prefixItems } = parentSchema;
@@ -11139,7 +11139,7 @@ var require_contains2 = __commonJS({
11139
11139
  Object.defineProperty(exports, "__esModule", { value: true });
11140
11140
  var codegen_1 = require_codegen2();
11141
11141
  var util_1 = require_util2();
11142
- var error = {
11142
+ var error2 = {
11143
11143
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
11144
11144
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
11145
11145
  };
@@ -11149,7 +11149,7 @@ var require_contains2 = __commonJS({
11149
11149
  schemaType: ["object", "boolean"],
11150
11150
  before: "uniqueItems",
11151
11151
  trackErrors: true,
11152
- error,
11152
+ error: error2,
11153
11153
  code(cxt) {
11154
11154
  const { gen, schema, parentSchema, data, it } = cxt;
11155
11155
  let min;
@@ -11327,7 +11327,7 @@ var require_propertyNames2 = __commonJS({
11327
11327
  Object.defineProperty(exports, "__esModule", { value: true });
11328
11328
  var codegen_1 = require_codegen2();
11329
11329
  var util_1 = require_util2();
11330
- var error = {
11330
+ var error2 = {
11331
11331
  message: "property name must be valid",
11332
11332
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
11333
11333
  };
@@ -11335,7 +11335,7 @@ var require_propertyNames2 = __commonJS({
11335
11335
  keyword: "propertyNames",
11336
11336
  type: "object",
11337
11337
  schemaType: ["object", "boolean"],
11338
- error,
11338
+ error: error2,
11339
11339
  code(cxt) {
11340
11340
  const { gen, schema, data, it } = cxt;
11341
11341
  if ((0, util_1.alwaysValidSchema)(it, schema))
@@ -11372,7 +11372,7 @@ var require_additionalProperties2 = __commonJS({
11372
11372
  var codegen_1 = require_codegen2();
11373
11373
  var names_1 = require_names2();
11374
11374
  var util_1 = require_util2();
11375
- var error = {
11375
+ var error2 = {
11376
11376
  message: "must NOT have additional properties",
11377
11377
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
11378
11378
  };
@@ -11382,7 +11382,7 @@ var require_additionalProperties2 = __commonJS({
11382
11382
  schemaType: ["boolean", "object"],
11383
11383
  allowUndefined: true,
11384
11384
  trackErrors: true,
11385
- error,
11385
+ error: error2,
11386
11386
  code(cxt) {
11387
11387
  const { gen, schema, parentSchema, data, errsCount, it } = cxt;
11388
11388
  if (!errsCount)
@@ -11656,7 +11656,7 @@ var require_oneOf2 = __commonJS({
11656
11656
  Object.defineProperty(exports, "__esModule", { value: true });
11657
11657
  var codegen_1 = require_codegen2();
11658
11658
  var util_1 = require_util2();
11659
- var error = {
11659
+ var error2 = {
11660
11660
  message: "must match exactly one schema in oneOf",
11661
11661
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
11662
11662
  };
@@ -11664,7 +11664,7 @@ var require_oneOf2 = __commonJS({
11664
11664
  keyword: "oneOf",
11665
11665
  schemaType: "array",
11666
11666
  trackErrors: true,
11667
- error,
11667
+ error: error2,
11668
11668
  code(cxt) {
11669
11669
  const { gen, schema, parentSchema, it } = cxt;
11670
11670
  if (!Array.isArray(schema))
@@ -11741,7 +11741,7 @@ var require_if2 = __commonJS({
11741
11741
  Object.defineProperty(exports, "__esModule", { value: true });
11742
11742
  var codegen_1 = require_codegen2();
11743
11743
  var util_1 = require_util2();
11744
- var error = {
11744
+ var error2 = {
11745
11745
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
11746
11746
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
11747
11747
  };
@@ -11749,7 +11749,7 @@ var require_if2 = __commonJS({
11749
11749
  keyword: "if",
11750
11750
  schemaType: ["object", "boolean"],
11751
11751
  trackErrors: true,
11752
- error,
11752
+ error: error2,
11753
11753
  code(cxt) {
11754
11754
  const { gen, parentSchema, it } = cxt;
11755
11755
  if (parentSchema.then === void 0 && parentSchema.else === void 0) {
@@ -11875,7 +11875,7 @@ var require_format3 = __commonJS({
11875
11875
  "use strict";
11876
11876
  Object.defineProperty(exports, "__esModule", { value: true });
11877
11877
  var codegen_1 = require_codegen2();
11878
- var error = {
11878
+ var error2 = {
11879
11879
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
11880
11880
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
11881
11881
  };
@@ -11884,7 +11884,7 @@ var require_format3 = __commonJS({
11884
11884
  type: ["number", "string"],
11885
11885
  schemaType: "string",
11886
11886
  $data: true,
11887
- error,
11887
+ error: error2,
11888
11888
  code(cxt, ruleType) {
11889
11889
  const { gen, data, $data, schema, schemaCode, it } = cxt;
11890
11890
  const { opts, errSchemaPath, schemaEnv, self } = it;
@@ -12039,7 +12039,7 @@ var require_discriminator2 = __commonJS({
12039
12039
  var compile_1 = require_compile2();
12040
12040
  var ref_error_1 = require_ref_error2();
12041
12041
  var util_1 = require_util2();
12042
- var error = {
12042
+ var error2 = {
12043
12043
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
12044
12044
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
12045
12045
  };
@@ -12047,7 +12047,7 @@ var require_discriminator2 = __commonJS({
12047
12047
  keyword: "discriminator",
12048
12048
  type: "object",
12049
12049
  schemaType: "object",
12050
- error,
12050
+ error: error2,
12051
12051
  code(cxt) {
12052
12052
  const { gen, data, schema, parentSchema, it } = cxt;
12053
12053
  const { oneOf } = parentSchema;
@@ -12376,7 +12376,7 @@ var require_limit = __commonJS({
12376
12376
  formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
12377
12377
  formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
12378
12378
  };
12379
- var error = {
12379
+ var error2 = {
12380
12380
  message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
12381
12381
  params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
12382
12382
  };
@@ -12385,7 +12385,7 @@ var require_limit = __commonJS({
12385
12385
  type: "string",
12386
12386
  schemaType: "string",
12387
12387
  $data: true,
12388
- error,
12388
+ error: error2,
12389
12389
  code(cxt) {
12390
12390
  const { gen, data, schemaCode, keyword, it } = cxt;
12391
12391
  const { opts, self } = it;
@@ -13084,10 +13084,10 @@ var initializer = (inst, def) => {
13084
13084
  };
13085
13085
  var $ZodError = $constructor("$ZodError", initializer);
13086
13086
  var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
13087
- function flattenError(error, mapper = (issue2) => issue2.message) {
13087
+ function flattenError(error2, mapper = (issue2) => issue2.message) {
13088
13088
  const fieldErrors = {};
13089
13089
  const formErrors = [];
13090
- for (const sub of error.issues) {
13090
+ for (const sub of error2.issues) {
13091
13091
  if (sub.path.length > 0) {
13092
13092
  fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
13093
13093
  fieldErrors[sub.path[0]].push(mapper(sub));
@@ -13097,13 +13097,13 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
13097
13097
  }
13098
13098
  return { formErrors, fieldErrors };
13099
13099
  }
13100
- function formatError(error, _mapper) {
13100
+ function formatError(error2, _mapper) {
13101
13101
  const mapper = _mapper || function(issue2) {
13102
13102
  return issue2.message;
13103
13103
  };
13104
13104
  const fieldErrors = { _errors: [] };
13105
- const processError = (error2) => {
13106
- for (const issue2 of error2.issues) {
13105
+ const processError = (error3) => {
13106
+ for (const issue2 of error3.issues) {
13107
13107
  if (issue2.code === "invalid_union" && issue2.errors.length) {
13108
13108
  issue2.errors.map((issues) => processError({ issues }));
13109
13109
  } else if (issue2.code === "invalid_key") {
@@ -13130,7 +13130,7 @@ function formatError(error, _mapper) {
13130
13130
  }
13131
13131
  }
13132
13132
  };
13133
- processError(error);
13133
+ processError(error2);
13134
13134
  return fieldErrors;
13135
13135
  }
13136
13136
 
@@ -13240,6 +13240,7 @@ var string = (params) => {
13240
13240
  var integer = /^\d+$/;
13241
13241
  var number = /^-?\d+(?:\.\d+)?/i;
13242
13242
  var boolean = /true|false/i;
13243
+ var _null = /null/i;
13243
13244
  var lowercase = /^[^A-Z]*$/;
13244
13245
  var uppercase = /^[^a-z]*$/;
13245
13246
 
@@ -14104,6 +14105,23 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
14104
14105
  return payload;
14105
14106
  };
14106
14107
  });
14108
+ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
14109
+ $ZodType.init(inst, def);
14110
+ inst._zod.pattern = _null;
14111
+ inst._zod.values = /* @__PURE__ */ new Set([null]);
14112
+ inst._zod.parse = (payload, _ctx) => {
14113
+ const input = payload.value;
14114
+ if (input === null)
14115
+ return payload;
14116
+ payload.issues.push({
14117
+ expected: "null",
14118
+ code: "invalid_type",
14119
+ input,
14120
+ inst
14121
+ });
14122
+ return payload;
14123
+ };
14124
+ });
14107
14125
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
14108
14126
  $ZodType.init(inst, def);
14109
14127
  inst._zod.parse = (payload) => payload;
@@ -14892,6 +14910,124 @@ function handleRefineResult(result, payload, input, inst) {
14892
14910
  }
14893
14911
  }
14894
14912
 
14913
+ // node_modules/zod/v4/locales/en.js
14914
+ var parsedType = (data) => {
14915
+ const t = typeof data;
14916
+ switch (t) {
14917
+ case "number": {
14918
+ return Number.isNaN(data) ? "NaN" : "number";
14919
+ }
14920
+ case "object": {
14921
+ if (Array.isArray(data)) {
14922
+ return "array";
14923
+ }
14924
+ if (data === null) {
14925
+ return "null";
14926
+ }
14927
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
14928
+ return data.constructor.name;
14929
+ }
14930
+ }
14931
+ }
14932
+ return t;
14933
+ };
14934
+ var error = () => {
14935
+ const Sizable = {
14936
+ string: { unit: "characters", verb: "to have" },
14937
+ file: { unit: "bytes", verb: "to have" },
14938
+ array: { unit: "items", verb: "to have" },
14939
+ set: { unit: "items", verb: "to have" }
14940
+ };
14941
+ function getSizing(origin) {
14942
+ return Sizable[origin] ?? null;
14943
+ }
14944
+ const Nouns = {
14945
+ regex: "input",
14946
+ email: "email address",
14947
+ url: "URL",
14948
+ emoji: "emoji",
14949
+ uuid: "UUID",
14950
+ uuidv4: "UUIDv4",
14951
+ uuidv6: "UUIDv6",
14952
+ nanoid: "nanoid",
14953
+ guid: "GUID",
14954
+ cuid: "cuid",
14955
+ cuid2: "cuid2",
14956
+ ulid: "ULID",
14957
+ xid: "XID",
14958
+ ksuid: "KSUID",
14959
+ datetime: "ISO datetime",
14960
+ date: "ISO date",
14961
+ time: "ISO time",
14962
+ duration: "ISO duration",
14963
+ ipv4: "IPv4 address",
14964
+ ipv6: "IPv6 address",
14965
+ cidrv4: "IPv4 range",
14966
+ cidrv6: "IPv6 range",
14967
+ base64: "base64-encoded string",
14968
+ base64url: "base64url-encoded string",
14969
+ json_string: "JSON string",
14970
+ e164: "E.164 number",
14971
+ jwt: "JWT",
14972
+ template_literal: "input"
14973
+ };
14974
+ return (issue2) => {
14975
+ switch (issue2.code) {
14976
+ case "invalid_type":
14977
+ return `Invalid input: expected ${issue2.expected}, received ${parsedType(issue2.input)}`;
14978
+ case "invalid_value":
14979
+ if (issue2.values.length === 1)
14980
+ return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
14981
+ return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;
14982
+ case "too_big": {
14983
+ const adj = issue2.inclusive ? "<=" : "<";
14984
+ const sizing = getSizing(issue2.origin);
14985
+ if (sizing)
14986
+ return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
14987
+ return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
14988
+ }
14989
+ case "too_small": {
14990
+ const adj = issue2.inclusive ? ">=" : ">";
14991
+ const sizing = getSizing(issue2.origin);
14992
+ if (sizing) {
14993
+ return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
14994
+ }
14995
+ return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;
14996
+ }
14997
+ case "invalid_format": {
14998
+ const _issue = issue2;
14999
+ if (_issue.format === "starts_with") {
15000
+ return `Invalid string: must start with "${_issue.prefix}"`;
15001
+ }
15002
+ if (_issue.format === "ends_with")
15003
+ return `Invalid string: must end with "${_issue.suffix}"`;
15004
+ if (_issue.format === "includes")
15005
+ return `Invalid string: must include "${_issue.includes}"`;
15006
+ if (_issue.format === "regex")
15007
+ return `Invalid string: must match pattern ${_issue.pattern}`;
15008
+ return `Invalid ${Nouns[_issue.format] ?? issue2.format}`;
15009
+ }
15010
+ case "not_multiple_of":
15011
+ return `Invalid number: must be a multiple of ${issue2.divisor}`;
15012
+ case "unrecognized_keys":
15013
+ return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
15014
+ case "invalid_key":
15015
+ return `Invalid key in ${issue2.origin}`;
15016
+ case "invalid_union":
15017
+ return "Invalid input";
15018
+ case "invalid_element":
15019
+ return `Invalid value in ${issue2.origin}`;
15020
+ default:
15021
+ return `Invalid input`;
15022
+ }
15023
+ };
15024
+ };
15025
+ function en_default() {
15026
+ return {
15027
+ localeError: error()
15028
+ };
15029
+ }
15030
+
14895
15031
  // node_modules/zod/v4/core/registries.js
14896
15032
  var $output = Symbol("ZodOutput");
14897
15033
  var $input = Symbol("ZodInput");
@@ -15208,6 +15344,12 @@ function _boolean(Class2, params) {
15208
15344
  ...normalizeParams(params)
15209
15345
  });
15210
15346
  }
15347
+ function _null2(Class2, params) {
15348
+ return new Class2({
15349
+ type: "null",
15350
+ ...normalizeParams(params)
15351
+ });
15352
+ }
15211
15353
  function _unknown(Class2) {
15212
15354
  return new Class2({
15213
15355
  type: "unknown"
@@ -16143,6 +16285,17 @@ function isTransforming(_schema, _ctx) {
16143
16285
  }
16144
16286
 
16145
16287
  // node_modules/zod/v4/classic/iso.js
16288
+ var iso_exports = {};
16289
+ __export(iso_exports, {
16290
+ ZodISODate: () => ZodISODate,
16291
+ ZodISODateTime: () => ZodISODateTime,
16292
+ ZodISODuration: () => ZodISODuration,
16293
+ ZodISOTime: () => ZodISOTime,
16294
+ date: () => date2,
16295
+ datetime: () => datetime2,
16296
+ duration: () => duration2,
16297
+ time: () => time2
16298
+ });
16146
16299
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
16147
16300
  $ZodISODateTime.init(inst, def);
16148
16301
  ZodStringFormat.init(inst, def);
@@ -16457,6 +16610,13 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
16457
16610
  function boolean2(params) {
16458
16611
  return _boolean(ZodBoolean, params);
16459
16612
  }
16613
+ var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
16614
+ $ZodNull.init(inst, def);
16615
+ ZodType.init(inst, def);
16616
+ });
16617
+ function _null3(params) {
16618
+ return _null2(ZodNull, params);
16619
+ }
16460
16620
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
16461
16621
  $ZodUnknown.init(inst, def);
16462
16622
  ZodType.init(inst, def);
@@ -16816,20 +16976,47 @@ function preprocess(fn, schema) {
16816
16976
  return pipe(transform(fn), schema);
16817
16977
  }
16818
16978
 
16979
+ // node_modules/zod/v4/classic/external.js
16980
+ config(en_default());
16981
+
16819
16982
  // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
16820
- var LATEST_PROTOCOL_VERSION = "2025-06-18";
16821
- var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-03-26", "2024-11-05", "2024-10-07"];
16983
+ var LATEST_PROTOCOL_VERSION = "2025-11-25";
16984
+ var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
16985
+ var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
16822
16986
  var JSONRPC_VERSION = "2.0";
16823
16987
  var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
16824
16988
  var ProgressTokenSchema = union([string2(), number2().int()]);
16825
16989
  var CursorSchema = string2();
16990
+ var TaskCreationParamsSchema = looseObject({
16991
+ /**
16992
+ * Time in milliseconds to keep task results available after completion.
16993
+ * If null, the task has unlimited lifetime until manually cleaned up.
16994
+ */
16995
+ ttl: union([number2(), _null3()]).optional(),
16996
+ /**
16997
+ * Time in milliseconds to wait between task status requests.
16998
+ */
16999
+ pollInterval: number2().optional()
17000
+ });
17001
+ var RelatedTaskMetadataSchema = looseObject({
17002
+ taskId: string2()
17003
+ });
16826
17004
  var RequestMetaSchema = looseObject({
16827
17005
  /**
16828
17006
  * 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.
16829
17007
  */
16830
- progressToken: ProgressTokenSchema.optional()
17008
+ progressToken: ProgressTokenSchema.optional(),
17009
+ /**
17010
+ * If specified, this request is related to the provided task.
17011
+ */
17012
+ [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
16831
17013
  });
16832
17014
  var BaseRequestParamsSchema = looseObject({
17015
+ /**
17016
+ * If specified, the caller is requesting that the receiver create a task to represent the request.
17017
+ * Task creation parameters are now at the top level instead of in _meta.
17018
+ */
17019
+ task: TaskCreationParamsSchema.optional(),
16833
17020
  /**
16834
17021
  * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
16835
17022
  */
@@ -16844,7 +17031,12 @@ var NotificationsParamsSchema = looseObject({
16844
17031
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
16845
17032
  * for notes on _meta usage.
16846
17033
  */
16847
- _meta: record(string2(), unknown()).optional()
17034
+ _meta: object({
17035
+ /**
17036
+ * If specified, this notification is related to the provided task.
17037
+ */
17038
+ [RELATED_TASK_META_KEY]: optional(RelatedTaskMetadataSchema)
17039
+ }).passthrough().optional()
16848
17040
  });
16849
17041
  var NotificationSchema = object({
16850
17042
  method: string2(),
@@ -16855,7 +17047,12 @@ var ResultSchema = looseObject({
16855
17047
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
16856
17048
  * for notes on _meta usage.
16857
17049
  */
16858
- _meta: record(string2(), unknown()).optional()
17050
+ _meta: looseObject({
17051
+ /**
17052
+ * If specified, this result is related to the provided task.
17053
+ */
17054
+ [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
17055
+ }).optional()
16859
17056
  });
16860
17057
  var RequestIdSchema = union([string2(), number2().int()]);
16861
17058
  var JSONRPCRequestSchema = object({
@@ -16990,6 +17187,54 @@ var ElicitationCapabilitySchema = preprocess((value) => {
16990
17187
  form: FormElicitationCapabilitySchema.optional(),
16991
17188
  url: AssertObjectSchema.optional()
16992
17189
  }), record(string2(), unknown()).optional()));
17190
+ var ClientTasksCapabilitySchema = object({
17191
+ /**
17192
+ * Present if the client supports listing tasks.
17193
+ */
17194
+ list: optional(object({}).passthrough()),
17195
+ /**
17196
+ * Present if the client supports cancelling tasks.
17197
+ */
17198
+ cancel: optional(object({}).passthrough()),
17199
+ /**
17200
+ * Capabilities for task creation on specific request types.
17201
+ */
17202
+ requests: optional(object({
17203
+ /**
17204
+ * Task support for sampling requests.
17205
+ */
17206
+ sampling: optional(object({
17207
+ createMessage: optional(object({}).passthrough())
17208
+ }).passthrough()),
17209
+ /**
17210
+ * Task support for elicitation requests.
17211
+ */
17212
+ elicitation: optional(object({
17213
+ create: optional(object({}).passthrough())
17214
+ }).passthrough())
17215
+ }).passthrough())
17216
+ }).passthrough();
17217
+ var ServerTasksCapabilitySchema = object({
17218
+ /**
17219
+ * Present if the server supports listing tasks.
17220
+ */
17221
+ list: optional(object({}).passthrough()),
17222
+ /**
17223
+ * Present if the server supports cancelling tasks.
17224
+ */
17225
+ cancel: optional(object({}).passthrough()),
17226
+ /**
17227
+ * Capabilities for task creation on specific request types.
17228
+ */
17229
+ requests: optional(object({
17230
+ /**
17231
+ * Task support for tool requests.
17232
+ */
17233
+ tools: optional(object({
17234
+ call: optional(object({}).passthrough())
17235
+ }).passthrough())
17236
+ }).passthrough())
17237
+ }).passthrough();
16993
17238
  var ClientCapabilitiesSchema = object({
16994
17239
  /**
16995
17240
  * Experimental, non-standard capabilities that the client supports.
@@ -17021,7 +17266,11 @@ var ClientCapabilitiesSchema = object({
17021
17266
  * Whether the client supports issuing notifications for changes to the roots list.
17022
17267
  */
17023
17268
  listChanged: boolean2().optional()
17024
- }).optional()
17269
+ }).optional(),
17270
+ /**
17271
+ * Present if the client supports task creation.
17272
+ */
17273
+ tasks: optional(ClientTasksCapabilitySchema)
17025
17274
  });
17026
17275
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
17027
17276
  /**
@@ -17078,8 +17327,12 @@ var ServerCapabilitiesSchema = object({
17078
17327
  * Whether this server supports issuing notifications for changes to the tool list.
17079
17328
  */
17080
17329
  listChanged: boolean2().optional()
17081
- }).optional()
17082
- });
17330
+ }).optional(),
17331
+ /**
17332
+ * Present if the server supports task creation.
17333
+ */
17334
+ tasks: optional(ServerTasksCapabilitySchema)
17335
+ }).passthrough();
17083
17336
  var InitializeResultSchema = ResultSchema.extend({
17084
17337
  /**
17085
17338
  * 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.
@@ -17143,6 +17396,62 @@ var PaginatedResultSchema = ResultSchema.extend({
17143
17396
  */
17144
17397
  nextCursor: optional(CursorSchema)
17145
17398
  });
17399
+ var TaskSchema = object({
17400
+ taskId: string2(),
17401
+ status: _enum(["working", "input_required", "completed", "failed", "cancelled"]),
17402
+ /**
17403
+ * Time in milliseconds to keep task results available after completion.
17404
+ * If null, the task has unlimited lifetime until manually cleaned up.
17405
+ */
17406
+ ttl: union([number2(), _null3()]),
17407
+ /**
17408
+ * ISO 8601 timestamp when the task was created.
17409
+ */
17410
+ createdAt: string2(),
17411
+ /**
17412
+ * ISO 8601 timestamp when the task was last updated.
17413
+ */
17414
+ lastUpdatedAt: string2(),
17415
+ pollInterval: optional(number2()),
17416
+ /**
17417
+ * Optional diagnostic message for failed tasks or other status information.
17418
+ */
17419
+ statusMessage: optional(string2())
17420
+ });
17421
+ var CreateTaskResultSchema = ResultSchema.extend({
17422
+ task: TaskSchema
17423
+ });
17424
+ var TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);
17425
+ var TaskStatusNotificationSchema = NotificationSchema.extend({
17426
+ method: literal("notifications/tasks/status"),
17427
+ params: TaskStatusNotificationParamsSchema
17428
+ });
17429
+ var GetTaskRequestSchema = RequestSchema.extend({
17430
+ method: literal("tasks/get"),
17431
+ params: BaseRequestParamsSchema.extend({
17432
+ taskId: string2()
17433
+ })
17434
+ });
17435
+ var GetTaskResultSchema = ResultSchema.merge(TaskSchema);
17436
+ var GetTaskPayloadRequestSchema = RequestSchema.extend({
17437
+ method: literal("tasks/result"),
17438
+ params: BaseRequestParamsSchema.extend({
17439
+ taskId: string2()
17440
+ })
17441
+ });
17442
+ var ListTasksRequestSchema = PaginatedRequestSchema.extend({
17443
+ method: literal("tasks/list")
17444
+ });
17445
+ var ListTasksResultSchema = PaginatedResultSchema.extend({
17446
+ tasks: array(TaskSchema)
17447
+ });
17448
+ var CancelTaskRequestSchema = RequestSchema.extend({
17449
+ method: literal("tasks/cancel"),
17450
+ params: BaseRequestParamsSchema.extend({
17451
+ taskId: string2()
17452
+ })
17453
+ });
17454
+ var CancelTaskResultSchema = ResultSchema.merge(TaskSchema);
17146
17455
  var ResourceContentsSchema = object({
17147
17456
  /**
17148
17457
  * The URI of this resource.
@@ -17178,6 +17487,20 @@ var BlobResourceContentsSchema = ResourceContentsSchema.extend({
17178
17487
  */
17179
17488
  blob: Base64Schema
17180
17489
  });
17490
+ var AnnotationsSchema = object({
17491
+ /**
17492
+ * Intended audience(s) for the resource.
17493
+ */
17494
+ audience: array(_enum(["user", "assistant"])).optional(),
17495
+ /**
17496
+ * Importance hint for the resource, from 0 (least) to 1 (most).
17497
+ */
17498
+ priority: number2().min(0).max(1).optional(),
17499
+ /**
17500
+ * ISO 8601 timestamp for the most recent modification.
17501
+ */
17502
+ lastModified: iso_exports.datetime({ offset: true }).optional()
17503
+ });
17181
17504
  var ResourceSchema = object({
17182
17505
  ...BaseMetadataSchema.shape,
17183
17506
  ...IconsSchema.shape,
@@ -17195,6 +17518,10 @@ var ResourceSchema = object({
17195
17518
  * The MIME type of this resource, if known.
17196
17519
  */
17197
17520
  mimeType: optional(string2()),
17521
+ /**
17522
+ * Optional annotations for the client.
17523
+ */
17524
+ annotations: AnnotationsSchema.optional(),
17198
17525
  /**
17199
17526
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17200
17527
  * for notes on _meta usage.
@@ -17218,6 +17545,10 @@ var ResourceTemplateSchema = object({
17218
17545
  * 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.
17219
17546
  */
17220
17547
  mimeType: optional(string2()),
17548
+ /**
17549
+ * Optional annotations for the client.
17550
+ */
17551
+ annotations: AnnotationsSchema.optional(),
17221
17552
  /**
17222
17553
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17223
17554
  * for notes on _meta usage.
@@ -17332,6 +17663,10 @@ var TextContentSchema = object({
17332
17663
  * The text content of the message.
17333
17664
  */
17334
17665
  text: string2(),
17666
+ /**
17667
+ * Optional annotations for the client.
17668
+ */
17669
+ annotations: AnnotationsSchema.optional(),
17335
17670
  /**
17336
17671
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17337
17672
  * for notes on _meta usage.
@@ -17348,6 +17683,10 @@ var ImageContentSchema = object({
17348
17683
  * The MIME type of the image. Different providers may support different image types.
17349
17684
  */
17350
17685
  mimeType: string2(),
17686
+ /**
17687
+ * Optional annotations for the client.
17688
+ */
17689
+ annotations: AnnotationsSchema.optional(),
17351
17690
  /**
17352
17691
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17353
17692
  * for notes on _meta usage.
@@ -17364,6 +17703,10 @@ var AudioContentSchema = object({
17364
17703
  * The MIME type of the audio. Different providers may support different audio types.
17365
17704
  */
17366
17705
  mimeType: string2(),
17706
+ /**
17707
+ * Optional annotations for the client.
17708
+ */
17709
+ annotations: AnnotationsSchema.optional(),
17367
17710
  /**
17368
17711
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17369
17712
  * for notes on _meta usage.
@@ -17396,6 +17739,10 @@ var ToolUseContentSchema = object({
17396
17739
  var EmbeddedResourceSchema = object({
17397
17740
  type: literal("resource"),
17398
17741
  resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
17742
+ /**
17743
+ * Optional annotations for the client.
17744
+ */
17745
+ annotations: AnnotationsSchema.optional(),
17399
17746
  /**
17400
17747
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17401
17748
  * for notes on _meta usage.
@@ -17465,6 +17812,17 @@ var ToolAnnotationsSchema = object({
17465
17812
  */
17466
17813
  openWorldHint: boolean2().optional()
17467
17814
  });
17815
+ var ToolExecutionSchema = object({
17816
+ /**
17817
+ * Indicates the tool's preference for task-augmented execution.
17818
+ * - "required": Clients MUST invoke the tool as a task
17819
+ * - "optional": Clients MAY invoke the tool as a task or normal request
17820
+ * - "forbidden": Clients MUST NOT attempt to invoke the tool as a task
17821
+ *
17822
+ * If not present, defaults to "forbidden".
17823
+ */
17824
+ taskSupport: _enum(["required", "optional", "forbidden"]).optional()
17825
+ });
17468
17826
  var ToolSchema = object({
17469
17827
  ...BaseMetadataSchema.shape,
17470
17828
  ...IconsSchema.shape,
@@ -17495,6 +17853,10 @@ var ToolSchema = object({
17495
17853
  * Optional additional tool information.
17496
17854
  */
17497
17855
  annotations: optional(ToolAnnotationsSchema),
17856
+ /**
17857
+ * Execution-related properties for this tool.
17858
+ */
17859
+ execution: optional(ToolExecutionSchema),
17498
17860
  /**
17499
17861
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
17500
17862
  * for notes on _meta usage.
@@ -17631,6 +17993,7 @@ var ToolResultContentSchema = object({
17631
17993
  */
17632
17994
  _meta: optional(object({}).passthrough())
17633
17995
  }).passthrough();
17996
+ var SamplingContentSchema = discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]);
17634
17997
  var SamplingMessageContentBlockSchema = discriminatedUnion("type", [
17635
17998
  TextContentSchema,
17636
17999
  ImageContentSchema,
@@ -17694,6 +18057,28 @@ var CreateMessageRequestSchema = RequestSchema.extend({
17694
18057
  params: CreateMessageRequestParamsSchema
17695
18058
  });
17696
18059
  var CreateMessageResultSchema = ResultSchema.extend({
18060
+ /**
18061
+ * The name of the model that generated the message.
18062
+ */
18063
+ model: string2(),
18064
+ /**
18065
+ * The reason why sampling stopped, if known.
18066
+ *
18067
+ * Standard values:
18068
+ * - "endTurn": Natural end of the assistant's turn
18069
+ * - "stopSequence": A stop sequence was encountered
18070
+ * - "maxTokens": Maximum token limit was reached
18071
+ *
18072
+ * This field is an open string to allow for provider-specific stop reasons.
18073
+ */
18074
+ stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string2())),
18075
+ role: _enum(["user", "assistant"]),
18076
+ /**
18077
+ * Response content. Single content block (text, image, or audio).
18078
+ */
18079
+ content: SamplingContentSchema
18080
+ });
18081
+ var CreateMessageResultWithToolsSchema = ResultSchema.extend({
17697
18082
  /**
17698
18083
  * The name of the model that generated the message.
17699
18084
  */
@@ -17712,7 +18097,7 @@ var CreateMessageResultSchema = ResultSchema.extend({
17712
18097
  stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())),
17713
18098
  role: _enum(["user", "assistant"]),
17714
18099
  /**
17715
- * Response content. May be ToolUseContent if stopReason is "toolUse".
18100
+ * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
17716
18101
  */
17717
18102
  content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)])
17718
18103
  });
@@ -17860,8 +18245,10 @@ var ElicitResultSchema = ResultSchema.extend({
17860
18245
  /**
17861
18246
  * The submitted form data, only present when action is "accept".
17862
18247
  * Contains values matching the requested schema.
18248
+ * Per MCP spec, content is "typically omitted" for decline/cancel actions.
18249
+ * We normalize null to undefined for leniency while maintaining type compatibility.
17863
18250
  */
17864
- content: record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional()
18251
+ content: preprocess((val) => val === null ? void 0 : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional())
17865
18252
  });
17866
18253
  var ResourceTemplateReferenceSchema = object({
17867
18254
  type: literal("ref/resource"),
@@ -17966,16 +18353,37 @@ var ClientRequestSchema = union([
17966
18353
  SubscribeRequestSchema,
17967
18354
  UnsubscribeRequestSchema,
17968
18355
  CallToolRequestSchema,
17969
- ListToolsRequestSchema
18356
+ ListToolsRequestSchema,
18357
+ GetTaskRequestSchema,
18358
+ GetTaskPayloadRequestSchema,
18359
+ ListTasksRequestSchema
17970
18360
  ]);
17971
18361
  var ClientNotificationSchema = union([
17972
18362
  CancelledNotificationSchema,
17973
18363
  ProgressNotificationSchema,
17974
18364
  InitializedNotificationSchema,
17975
- RootsListChangedNotificationSchema
18365
+ RootsListChangedNotificationSchema,
18366
+ TaskStatusNotificationSchema
18367
+ ]);
18368
+ var ClientResultSchema = union([
18369
+ EmptyResultSchema,
18370
+ CreateMessageResultSchema,
18371
+ CreateMessageResultWithToolsSchema,
18372
+ ElicitResultSchema,
18373
+ ListRootsResultSchema,
18374
+ GetTaskResultSchema,
18375
+ ListTasksResultSchema,
18376
+ CreateTaskResultSchema
18377
+ ]);
18378
+ var ServerRequestSchema = union([
18379
+ PingRequestSchema,
18380
+ CreateMessageRequestSchema,
18381
+ ElicitRequestSchema,
18382
+ ListRootsRequestSchema,
18383
+ GetTaskRequestSchema,
18384
+ GetTaskPayloadRequestSchema,
18385
+ ListTasksRequestSchema
17976
18386
  ]);
17977
- var ClientResultSchema = union([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
17978
- var ServerRequestSchema = union([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
17979
18387
  var ServerNotificationSchema = union([
17980
18388
  CancelledNotificationSchema,
17981
18389
  ProgressNotificationSchema,
@@ -17984,6 +18392,7 @@ var ServerNotificationSchema = union([
17984
18392
  ResourceListChangedNotificationSchema,
17985
18393
  ToolListChangedNotificationSchema,
17986
18394
  PromptListChangedNotificationSchema,
18395
+ TaskStatusNotificationSchema,
17987
18396
  ElicitationCompleteNotificationSchema
17988
18397
  ]);
17989
18398
  var ServerResultSchema = union([
@@ -17996,7 +18405,10 @@ var ServerResultSchema = union([
17996
18405
  ListResourceTemplatesResultSchema,
17997
18406
  ReadResourceResultSchema,
17998
18407
  CallToolResultSchema,
17999
- ListToolsResultSchema
18408
+ ListToolsResultSchema,
18409
+ GetTaskResultSchema,
18410
+ ListTasksResultSchema,
18411
+ CreateTaskResultSchema
18000
18412
  ]);
18001
18413
  var McpError = class _McpError extends Error {
18002
18414
  constructor(code, message, data) {
@@ -18069,9 +18481,9 @@ var StdioServerTransport = class {
18069
18481
  this._readBuffer.append(chunk);
18070
18482
  this.processReadBuffer();
18071
18483
  };
18072
- this._onerror = (error) => {
18484
+ this._onerror = (error2) => {
18073
18485
  var _a;
18074
- (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
18486
+ (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error2);
18075
18487
  };
18076
18488
  }
18077
18489
  /**
@@ -18094,8 +18506,8 @@ var StdioServerTransport = class {
18094
18506
  break;
18095
18507
  }
18096
18508
  (_a = this.onmessage) === null || _a === void 0 ? void 0 : _a.call(this, message);
18097
- } catch (error) {
18098
- (_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error);
18509
+ } catch (error2) {
18510
+ (_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error2);
18099
18511
  }
18100
18512
  }
18101
18513
  }
@@ -18155,7 +18567,7 @@ __export(external_exports, {
18155
18567
  ZodNaN: () => ZodNaN,
18156
18568
  ZodNativeEnum: () => ZodNativeEnum,
18157
18569
  ZodNever: () => ZodNever2,
18158
- ZodNull: () => ZodNull,
18570
+ ZodNull: () => ZodNull2,
18159
18571
  ZodNullable: () => ZodNullable2,
18160
18572
  ZodNumber: () => ZodNumber2,
18161
18573
  ZodObject: () => ZodObject2,
@@ -18185,7 +18597,7 @@ __export(external_exports, {
18185
18597
  custom: () => custom2,
18186
18598
  date: () => dateType,
18187
18599
  datetimeRegex: () => datetimeRegex,
18188
- defaultErrorMap: () => en_default,
18600
+ defaultErrorMap: () => en_default2,
18189
18601
  discriminatedUnion: () => discriminatedUnionType,
18190
18602
  effect: () => effectsType,
18191
18603
  enum: () => enumType,
@@ -18418,8 +18830,8 @@ var ZodError2 = class _ZodError extends Error {
18418
18830
  return issue2.message;
18419
18831
  };
18420
18832
  const fieldErrors = { _errors: [] };
18421
- const processError = (error) => {
18422
- for (const issue2 of error.issues) {
18833
+ const processError = (error2) => {
18834
+ for (const issue2 of error2.issues) {
18423
18835
  if (issue2.code === "invalid_union") {
18424
18836
  issue2.unionErrors.map(processError);
18425
18837
  } else if (issue2.code === "invalid_return_type") {
@@ -18482,8 +18894,8 @@ var ZodError2 = class _ZodError extends Error {
18482
18894
  }
18483
18895
  };
18484
18896
  ZodError2.create = (issues) => {
18485
- const error = new ZodError2(issues);
18486
- return error;
18897
+ const error2 = new ZodError2(issues);
18898
+ return error2;
18487
18899
  };
18488
18900
 
18489
18901
  // node_modules/zod/v3/locales/en.js
@@ -18587,10 +18999,10 @@ var errorMap = (issue2, _ctx) => {
18587
18999
  }
18588
19000
  return { message };
18589
19001
  };
18590
- var en_default = errorMap;
19002
+ var en_default2 = errorMap;
18591
19003
 
18592
19004
  // node_modules/zod/v3/errors.js
18593
- var overrideErrorMap = en_default;
19005
+ var overrideErrorMap = en_default2;
18594
19006
  function setErrorMap(map) {
18595
19007
  overrideErrorMap = map;
18596
19008
  }
@@ -18638,7 +19050,7 @@ function addIssueToContext(ctx, issueData) {
18638
19050
  // then schema-bound map if available
18639
19051
  overrideMap,
18640
19052
  // then global override map
18641
- overrideMap === en_default ? void 0 : en_default
19053
+ overrideMap === en_default2 ? void 0 : en_default2
18642
19054
  // then global default map
18643
19055
  ].filter((x) => !!x)
18644
19056
  });
@@ -18747,8 +19159,8 @@ var handleResult = (ctx, result) => {
18747
19159
  get error() {
18748
19160
  if (this._error)
18749
19161
  return this._error;
18750
- const error = new ZodError2(ctx.common.issues);
18751
- this._error = error;
19162
+ const error2 = new ZodError2(ctx.common.issues);
19163
+ this._error = error2;
18752
19164
  return this._error;
18753
19165
  }
18754
19166
  };
@@ -19145,8 +19557,8 @@ var ZodString2 = class _ZodString2 extends ZodType2 {
19145
19557
  if (this._def.coerce) {
19146
19558
  input.data = String(input.data);
19147
19559
  }
19148
- const parsedType = this._getType(input);
19149
- if (parsedType !== ZodParsedType.string) {
19560
+ const parsedType2 = this._getType(input);
19561
+ if (parsedType2 !== ZodParsedType.string) {
19150
19562
  const ctx2 = this._getOrReturnCtx(input);
19151
19563
  addIssueToContext(ctx2, {
19152
19564
  code: ZodIssueCode.invalid_type,
@@ -19705,8 +20117,8 @@ var ZodNumber2 = class _ZodNumber extends ZodType2 {
19705
20117
  if (this._def.coerce) {
19706
20118
  input.data = Number(input.data);
19707
20119
  }
19708
- const parsedType = this._getType(input);
19709
- if (parsedType !== ZodParsedType.number) {
20120
+ const parsedType2 = this._getType(input);
20121
+ if (parsedType2 !== ZodParsedType.number) {
19710
20122
  const ctx2 = this._getOrReturnCtx(input);
19711
20123
  addIssueToContext(ctx2, {
19712
20124
  code: ZodIssueCode.invalid_type,
@@ -19940,8 +20352,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType2 {
19940
20352
  return this._getInvalidInput(input);
19941
20353
  }
19942
20354
  }
19943
- const parsedType = this._getType(input);
19944
- if (parsedType !== ZodParsedType.bigint) {
20355
+ const parsedType2 = this._getType(input);
20356
+ if (parsedType2 !== ZodParsedType.bigint) {
19945
20357
  return this._getInvalidInput(input);
19946
20358
  }
19947
20359
  let ctx = void 0;
@@ -20103,8 +20515,8 @@ var ZodBoolean2 = class extends ZodType2 {
20103
20515
  if (this._def.coerce) {
20104
20516
  input.data = Boolean(input.data);
20105
20517
  }
20106
- const parsedType = this._getType(input);
20107
- if (parsedType !== ZodParsedType.boolean) {
20518
+ const parsedType2 = this._getType(input);
20519
+ if (parsedType2 !== ZodParsedType.boolean) {
20108
20520
  const ctx = this._getOrReturnCtx(input);
20109
20521
  addIssueToContext(ctx, {
20110
20522
  code: ZodIssueCode.invalid_type,
@@ -20128,8 +20540,8 @@ var ZodDate = class _ZodDate extends ZodType2 {
20128
20540
  if (this._def.coerce) {
20129
20541
  input.data = new Date(input.data);
20130
20542
  }
20131
- const parsedType = this._getType(input);
20132
- if (parsedType !== ZodParsedType.date) {
20543
+ const parsedType2 = this._getType(input);
20544
+ if (parsedType2 !== ZodParsedType.date) {
20133
20545
  const ctx2 = this._getOrReturnCtx(input);
20134
20546
  addIssueToContext(ctx2, {
20135
20547
  code: ZodIssueCode.invalid_type,
@@ -20234,8 +20646,8 @@ ZodDate.create = (params) => {
20234
20646
  };
20235
20647
  var ZodSymbol = class extends ZodType2 {
20236
20648
  _parse(input) {
20237
- const parsedType = this._getType(input);
20238
- if (parsedType !== ZodParsedType.symbol) {
20649
+ const parsedType2 = this._getType(input);
20650
+ if (parsedType2 !== ZodParsedType.symbol) {
20239
20651
  const ctx = this._getOrReturnCtx(input);
20240
20652
  addIssueToContext(ctx, {
20241
20653
  code: ZodIssueCode.invalid_type,
@@ -20255,8 +20667,8 @@ ZodSymbol.create = (params) => {
20255
20667
  };
20256
20668
  var ZodUndefined = class extends ZodType2 {
20257
20669
  _parse(input) {
20258
- const parsedType = this._getType(input);
20259
- if (parsedType !== ZodParsedType.undefined) {
20670
+ const parsedType2 = this._getType(input);
20671
+ if (parsedType2 !== ZodParsedType.undefined) {
20260
20672
  const ctx = this._getOrReturnCtx(input);
20261
20673
  addIssueToContext(ctx, {
20262
20674
  code: ZodIssueCode.invalid_type,
@@ -20274,10 +20686,10 @@ ZodUndefined.create = (params) => {
20274
20686
  ...processCreateParams(params)
20275
20687
  });
20276
20688
  };
20277
- var ZodNull = class extends ZodType2 {
20689
+ var ZodNull2 = class extends ZodType2 {
20278
20690
  _parse(input) {
20279
- const parsedType = this._getType(input);
20280
- if (parsedType !== ZodParsedType.null) {
20691
+ const parsedType2 = this._getType(input);
20692
+ if (parsedType2 !== ZodParsedType.null) {
20281
20693
  const ctx = this._getOrReturnCtx(input);
20282
20694
  addIssueToContext(ctx, {
20283
20695
  code: ZodIssueCode.invalid_type,
@@ -20289,8 +20701,8 @@ var ZodNull = class extends ZodType2 {
20289
20701
  return OK(input.data);
20290
20702
  }
20291
20703
  };
20292
- ZodNull.create = (params) => {
20293
- return new ZodNull({
20704
+ ZodNull2.create = (params) => {
20705
+ return new ZodNull2({
20294
20706
  typeName: ZodFirstPartyTypeKind.ZodNull,
20295
20707
  ...processCreateParams(params)
20296
20708
  });
@@ -20344,8 +20756,8 @@ ZodNever2.create = (params) => {
20344
20756
  };
20345
20757
  var ZodVoid = class extends ZodType2 {
20346
20758
  _parse(input) {
20347
- const parsedType = this._getType(input);
20348
- if (parsedType !== ZodParsedType.undefined) {
20759
+ const parsedType2 = this._getType(input);
20760
+ if (parsedType2 !== ZodParsedType.undefined) {
20349
20761
  const ctx = this._getOrReturnCtx(input);
20350
20762
  addIssueToContext(ctx, {
20351
20763
  code: ZodIssueCode.invalid_type,
@@ -20506,8 +20918,8 @@ var ZodObject2 = class _ZodObject extends ZodType2 {
20506
20918
  return this._cached;
20507
20919
  }
20508
20920
  _parse(input) {
20509
- const parsedType = this._getType(input);
20510
- if (parsedType !== ZodParsedType.object) {
20921
+ const parsedType2 = this._getType(input);
20922
+ if (parsedType2 !== ZodParsedType.object) {
20511
20923
  const ctx2 = this._getOrReturnCtx(input);
20512
20924
  addIssueToContext(ctx2, {
20513
20925
  code: ZodIssueCode.invalid_type,
@@ -20934,7 +21346,7 @@ var getDiscriminator = (type) => {
20934
21346
  return getDiscriminator(type._def.innerType);
20935
21347
  } else if (type instanceof ZodUndefined) {
20936
21348
  return [void 0];
20937
- } else if (type instanceof ZodNull) {
21349
+ } else if (type instanceof ZodNull2) {
20938
21350
  return [null];
20939
21351
  } else if (type instanceof ZodOptional2) {
20940
21352
  return [void 0, ...getDiscriminator(type.unwrap())];
@@ -21403,25 +21815,25 @@ var ZodFunction = class _ZodFunction extends ZodType2 {
21403
21815
  });
21404
21816
  return INVALID;
21405
21817
  }
21406
- function makeArgsIssue(args, error) {
21818
+ function makeArgsIssue(args, error2) {
21407
21819
  return makeIssue({
21408
21820
  data: args,
21409
21821
  path: ctx.path,
21410
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
21822
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default2].filter((x) => !!x),
21411
21823
  issueData: {
21412
21824
  code: ZodIssueCode.invalid_arguments,
21413
- argumentsError: error
21825
+ argumentsError: error2
21414
21826
  }
21415
21827
  });
21416
21828
  }
21417
- function makeReturnsIssue(returns, error) {
21829
+ function makeReturnsIssue(returns, error2) {
21418
21830
  return makeIssue({
21419
21831
  data: returns,
21420
21832
  path: ctx.path,
21421
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
21833
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default2].filter((x) => !!x),
21422
21834
  issueData: {
21423
21835
  code: ZodIssueCode.invalid_return_type,
21424
- returnTypeError: error
21836
+ returnTypeError: error2
21425
21837
  }
21426
21838
  });
21427
21839
  }
@@ -21430,15 +21842,15 @@ var ZodFunction = class _ZodFunction extends ZodType2 {
21430
21842
  if (this._def.returns instanceof ZodPromise) {
21431
21843
  const me = this;
21432
21844
  return OK(async function(...args) {
21433
- const error = new ZodError2([]);
21845
+ const error2 = new ZodError2([]);
21434
21846
  const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
21435
- error.addIssue(makeArgsIssue(args, e));
21436
- throw error;
21847
+ error2.addIssue(makeArgsIssue(args, e));
21848
+ throw error2;
21437
21849
  });
21438
21850
  const result = await Reflect.apply(fn, this, parsedArgs);
21439
21851
  const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
21440
- error.addIssue(makeReturnsIssue(result, e));
21441
- throw error;
21852
+ error2.addIssue(makeReturnsIssue(result, e));
21853
+ throw error2;
21442
21854
  });
21443
21855
  return parsedReturns;
21444
21856
  });
@@ -21815,8 +22227,8 @@ ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
21815
22227
  };
21816
22228
  var ZodOptional2 = class extends ZodType2 {
21817
22229
  _parse(input) {
21818
- const parsedType = this._getType(input);
21819
- if (parsedType === ZodParsedType.undefined) {
22230
+ const parsedType2 = this._getType(input);
22231
+ if (parsedType2 === ZodParsedType.undefined) {
21820
22232
  return OK(void 0);
21821
22233
  }
21822
22234
  return this._def.innerType._parse(input);
@@ -21834,8 +22246,8 @@ ZodOptional2.create = (type, params) => {
21834
22246
  };
21835
22247
  var ZodNullable2 = class extends ZodType2 {
21836
22248
  _parse(input) {
21837
- const parsedType = this._getType(input);
21838
- if (parsedType === ZodParsedType.null) {
22249
+ const parsedType2 = this._getType(input);
22250
+ if (parsedType2 === ZodParsedType.null) {
21839
22251
  return OK(null);
21840
22252
  }
21841
22253
  return this._def.innerType._parse(input);
@@ -21931,8 +22343,8 @@ ZodCatch2.create = (type, params) => {
21931
22343
  };
21932
22344
  var ZodNaN = class extends ZodType2 {
21933
22345
  _parse(input) {
21934
- const parsedType = this._getType(input);
21935
- if (parsedType !== ZodParsedType.nan) {
22346
+ const parsedType2 = this._getType(input);
22347
+ if (parsedType2 !== ZodParsedType.nan) {
21936
22348
  const ctx = this._getOrReturnCtx(input);
21937
22349
  addIssueToContext(ctx, {
21938
22350
  code: ZodIssueCode.invalid_type,
@@ -22122,7 +22534,7 @@ var booleanType = ZodBoolean2.create;
22122
22534
  var dateType = ZodDate.create;
22123
22535
  var symbolType = ZodSymbol.create;
22124
22536
  var undefinedType = ZodUndefined.create;
22125
- var nullType = ZodNull.create;
22537
+ var nullType = ZodNull2.create;
22126
22538
  var anyType = ZodAny.create;
22127
22539
  var unknownType = ZodUnknown2.create;
22128
22540
  var neverType = ZodNever2.create;
@@ -22284,7 +22696,7 @@ function normalizeObjectSchema(schema) {
22284
22696
  if (isZ4Schema(schema)) {
22285
22697
  const v4Schema = schema;
22286
22698
  const def = (_a = v4Schema._zod) === null || _a === void 0 ? void 0 : _a.def;
22287
- if (def && (def.typeName === "object" || def.shape !== void 0)) {
22699
+ if (def && (def.type === "object" || def.shape !== void 0)) {
22288
22700
  return schema;
22289
22701
  }
22290
22702
  } else {
@@ -22295,24 +22707,24 @@ function normalizeObjectSchema(schema) {
22295
22707
  }
22296
22708
  return void 0;
22297
22709
  }
22298
- function getParseErrorMessage(error) {
22299
- if (error && typeof error === "object") {
22300
- if ("message" in error && typeof error.message === "string") {
22301
- return error.message;
22710
+ function getParseErrorMessage(error2) {
22711
+ if (error2 && typeof error2 === "object") {
22712
+ if ("message" in error2 && typeof error2.message === "string") {
22713
+ return error2.message;
22302
22714
  }
22303
- if ("issues" in error && Array.isArray(error.issues) && error.issues.length > 0) {
22304
- const firstIssue = error.issues[0];
22715
+ if ("issues" in error2 && Array.isArray(error2.issues) && error2.issues.length > 0) {
22716
+ const firstIssue = error2.issues[0];
22305
22717
  if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
22306
22718
  return String(firstIssue.message);
22307
22719
  }
22308
22720
  }
22309
22721
  try {
22310
- return JSON.stringify(error);
22722
+ return JSON.stringify(error2);
22311
22723
  } catch (_a) {
22312
- return String(error);
22724
+ return String(error2);
22313
22725
  }
22314
22726
  }
22315
- return String(error);
22727
+ return String(error2);
22316
22728
  }
22317
22729
  function getSchemaDescription(schema) {
22318
22730
  var _a, _b, _c, _d;
@@ -22327,7 +22739,7 @@ function isSchemaOptional(schema) {
22327
22739
  var _a, _b, _c;
22328
22740
  if (isZ4Schema(schema)) {
22329
22741
  const v4Schema = schema;
22330
- return ((_b = (_a = v4Schema._zod) === null || _a === void 0 ? void 0 : _a.def) === null || _b === void 0 ? void 0 : _b.typeName) === "ZodOptional";
22742
+ return ((_b = (_a = v4Schema._zod) === null || _a === void 0 ? void 0 : _a.def) === null || _b === void 0 ? void 0 : _b.type) === "optional";
22331
22743
  }
22332
22744
  const v3Schema = schema;
22333
22745
  if (typeof schema.isOptional === "function") {
@@ -22363,6 +22775,11 @@ function getLiteralValue(schema) {
22363
22775
  return void 0;
22364
22776
  }
22365
22777
 
22778
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
22779
+ function isTerminal(status) {
22780
+ return status === "completed" || status === "failed" || status === "cancelled";
22781
+ }
22782
+
22366
22783
  // node_modules/zod-to-json-schema/dist/esm/Options.js
22367
22784
  var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
22368
22785
  var defaultOptions = {
@@ -22671,20 +23088,20 @@ function parseIntersectionDef(def, refs) {
22671
23088
 
22672
23089
  // node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
22673
23090
  function parseLiteralDef(def, refs) {
22674
- const parsedType = typeof def.value;
22675
- if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
23091
+ const parsedType2 = typeof def.value;
23092
+ if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
22676
23093
  return {
22677
23094
  type: Array.isArray(def.value) ? "array" : "object"
22678
23095
  };
22679
23096
  }
22680
23097
  if (refs.target === "openApi3") {
22681
23098
  return {
22682
- type: parsedType === "bigint" ? "integer" : parsedType,
23099
+ type: parsedType2 === "bigint" ? "integer" : parsedType2,
22683
23100
  enum: [def.value]
22684
23101
  };
22685
23102
  }
22686
23103
  return {
22687
- type: parsedType === "bigint" ? "integer" : parsedType,
23104
+ type: parsedType2 === "bigint" ? "integer" : parsedType2,
22688
23105
  const: def.value
22689
23106
  };
22690
23107
  }
@@ -23703,9 +24120,10 @@ var Protocol = class {
23703
24120
  this._progressHandlers = /* @__PURE__ */ new Map();
23704
24121
  this._timeoutInfo = /* @__PURE__ */ new Map();
23705
24122
  this._pendingDebouncedNotifications = /* @__PURE__ */ new Set();
24123
+ this._taskProgressTokens = /* @__PURE__ */ new Map();
24124
+ this._requestResolvers = /* @__PURE__ */ new Map();
23706
24125
  this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
23707
- const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
23708
- controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
24126
+ this._oncancel(notification);
23709
24127
  });
23710
24128
  this.setNotificationHandler(ProgressNotificationSchema, (notification) => {
23711
24129
  this._onprogress(notification);
@@ -23715,6 +24133,116 @@ var Protocol = class {
23715
24133
  // Automatic pong by default.
23716
24134
  (_request) => ({})
23717
24135
  );
24136
+ this._taskStore = _options === null || _options === void 0 ? void 0 : _options.taskStore;
24137
+ this._taskMessageQueue = _options === null || _options === void 0 ? void 0 : _options.taskMessageQueue;
24138
+ if (this._taskStore) {
24139
+ this.setRequestHandler(GetTaskRequestSchema, async (request, extra) => {
24140
+ const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
24141
+ if (!task) {
24142
+ throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
24143
+ }
24144
+ return {
24145
+ ...task
24146
+ };
24147
+ });
24148
+ this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
24149
+ const handleTaskResult = async () => {
24150
+ var _a;
24151
+ const taskId = request.params.taskId;
24152
+ if (this._taskMessageQueue) {
24153
+ let queuedMessage;
24154
+ while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
24155
+ if (queuedMessage.type === "response" || queuedMessage.type === "error") {
24156
+ const message = queuedMessage.message;
24157
+ const requestId = message.id;
24158
+ const resolver = this._requestResolvers.get(requestId);
24159
+ if (resolver) {
24160
+ this._requestResolvers.delete(requestId);
24161
+ if (queuedMessage.type === "response") {
24162
+ resolver(message);
24163
+ } else {
24164
+ const errorMessage = message;
24165
+ const error2 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
24166
+ resolver(error2);
24167
+ }
24168
+ } else {
24169
+ const messageType = queuedMessage.type === "response" ? "Response" : "Error";
24170
+ this._onerror(new Error(`${messageType} handler missing for request ${requestId}`));
24171
+ }
24172
+ continue;
24173
+ }
24174
+ await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.send(queuedMessage.message, { relatedRequestId: extra.requestId }));
24175
+ }
24176
+ }
24177
+ const task = await this._taskStore.getTask(taskId, extra.sessionId);
24178
+ if (!task) {
24179
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
24180
+ }
24181
+ if (!isTerminal(task.status)) {
24182
+ await this._waitForTaskUpdate(taskId, extra.signal);
24183
+ return await handleTaskResult();
24184
+ }
24185
+ if (isTerminal(task.status)) {
24186
+ const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
24187
+ this._clearTaskQueue(taskId);
24188
+ return {
24189
+ ...result,
24190
+ _meta: {
24191
+ ...result._meta,
24192
+ [RELATED_TASK_META_KEY]: {
24193
+ taskId
24194
+ }
24195
+ }
24196
+ };
24197
+ }
24198
+ return await handleTaskResult();
24199
+ };
24200
+ return await handleTaskResult();
24201
+ });
24202
+ this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => {
24203
+ var _a;
24204
+ try {
24205
+ const { tasks, nextCursor } = await this._taskStore.listTasks((_a = request.params) === null || _a === void 0 ? void 0 : _a.cursor, extra.sessionId);
24206
+ return {
24207
+ tasks,
24208
+ nextCursor,
24209
+ _meta: {}
24210
+ };
24211
+ } catch (error2) {
24212
+ throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error2 instanceof Error ? error2.message : String(error2)}`);
24213
+ }
24214
+ });
24215
+ this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => {
24216
+ try {
24217
+ const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
24218
+ if (!task) {
24219
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`);
24220
+ }
24221
+ if (isTerminal(task.status)) {
24222
+ throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
24223
+ }
24224
+ await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
24225
+ this._clearTaskQueue(request.params.taskId);
24226
+ const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
24227
+ if (!cancelledTask) {
24228
+ throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
24229
+ }
24230
+ return {
24231
+ _meta: {},
24232
+ ...cancelledTask
24233
+ };
24234
+ } catch (error2) {
24235
+ if (error2 instanceof McpError) {
24236
+ throw error2;
24237
+ }
24238
+ throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error2 instanceof Error ? error2.message : String(error2)}`);
24239
+ }
24240
+ });
24241
+ }
24242
+ }
24243
+ async _oncancel(notification) {
24244
+ const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
24245
+ controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
23718
24246
  }
23719
24247
  _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
23720
24248
  this._timeoutInfo.set(messageId, {
@@ -23763,9 +24291,9 @@ var Protocol = class {
23763
24291
  this._onclose();
23764
24292
  };
23765
24293
  const _onerror = (_b = this.transport) === null || _b === void 0 ? void 0 : _b.onerror;
23766
- this._transport.onerror = (error) => {
23767
- _onerror === null || _onerror === void 0 ? void 0 : _onerror(error);
23768
- this._onerror(error);
24294
+ this._transport.onerror = (error2) => {
24295
+ _onerror === null || _onerror === void 0 ? void 0 : _onerror(error2);
24296
+ this._onerror(error2);
23769
24297
  };
23770
24298
  const _onmessage = (_c = this._transport) === null || _c === void 0 ? void 0 : _c.onmessage;
23771
24299
  this._transport.onmessage = (message, extra) => {
@@ -23787,17 +24315,18 @@ var Protocol = class {
23787
24315
  const responseHandlers = this._responseHandlers;
23788
24316
  this._responseHandlers = /* @__PURE__ */ new Map();
23789
24317
  this._progressHandlers.clear();
24318
+ this._taskProgressTokens.clear();
23790
24319
  this._pendingDebouncedNotifications.clear();
24320
+ const error2 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
23791
24321
  this._transport = void 0;
23792
24322
  (_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
23793
- const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
23794
24323
  for (const handler of responseHandlers.values()) {
23795
- handler(error);
24324
+ handler(error2);
23796
24325
  }
23797
24326
  }
23798
- _onerror(error) {
24327
+ _onerror(error2) {
23799
24328
  var _a;
23800
- (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
24329
+ (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error2);
23801
24330
  }
23802
24331
  _onnotification(notification) {
23803
24332
  var _a;
@@ -23805,59 +24334,115 @@ var Protocol = class {
23805
24334
  if (handler === void 0) {
23806
24335
  return;
23807
24336
  }
23808
- Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
24337
+ Promise.resolve().then(() => handler(notification)).catch((error2) => this._onerror(new Error(`Uncaught error in notification handler: ${error2}`)));
23809
24338
  }
23810
24339
  _onrequest(request, extra) {
23811
- var _a, _b;
24340
+ var _a, _b, _c, _d, _e, _f;
23812
24341
  const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
23813
24342
  const capturedTransport = this._transport;
24343
+ const relatedTaskId = (_d = (_c = (_b = request.params) === null || _b === void 0 ? void 0 : _b._meta) === null || _c === void 0 ? void 0 : _c[RELATED_TASK_META_KEY]) === null || _d === void 0 ? void 0 : _d.taskId;
23814
24344
  if (handler === void 0) {
23815
- capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
24345
+ const errorResponse = {
23816
24346
  jsonrpc: "2.0",
23817
24347
  id: request.id,
23818
24348
  error: {
23819
24349
  code: ErrorCode.MethodNotFound,
23820
24350
  message: "Method not found"
23821
24351
  }
23822
- }).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
24352
+ };
24353
+ if (relatedTaskId && this._taskMessageQueue) {
24354
+ this._enqueueTaskMessage(relatedTaskId, {
24355
+ type: "error",
24356
+ message: errorResponse,
24357
+ timestamp: Date.now()
24358
+ }, capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId).catch((error2) => this._onerror(new Error(`Failed to enqueue error response: ${error2}`)));
24359
+ } else {
24360
+ capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send(errorResponse).catch((error2) => this._onerror(new Error(`Failed to send an error response: ${error2}`)));
24361
+ }
23823
24362
  return;
23824
24363
  }
23825
24364
  const abortController = new AbortController();
23826
24365
  this._requestHandlerAbortControllers.set(request.id, abortController);
24366
+ const taskCreationParams = (_e = request.params) === null || _e === void 0 ? void 0 : _e.task;
24367
+ const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId) : void 0;
23827
24368
  const fullExtra = {
23828
24369
  signal: abortController.signal,
23829
24370
  sessionId: capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId,
23830
- _meta: (_b = request.params) === null || _b === void 0 ? void 0 : _b._meta,
23831
- sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
23832
- sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
24371
+ _meta: (_f = request.params) === null || _f === void 0 ? void 0 : _f._meta,
24372
+ sendNotification: async (notification) => {
24373
+ const notificationOptions = { relatedRequestId: request.id };
24374
+ if (relatedTaskId) {
24375
+ notificationOptions.relatedTask = { taskId: relatedTaskId };
24376
+ }
24377
+ await this.notification(notification, notificationOptions);
24378
+ },
24379
+ sendRequest: async (r, resultSchema, options) => {
24380
+ var _a2, _b2;
24381
+ const requestOptions = { ...options, relatedRequestId: request.id };
24382
+ if (relatedTaskId && !requestOptions.relatedTask) {
24383
+ requestOptions.relatedTask = { taskId: relatedTaskId };
24384
+ }
24385
+ const effectiveTaskId = (_b2 = (_a2 = requestOptions.relatedTask) === null || _a2 === void 0 ? void 0 : _a2.taskId) !== null && _b2 !== void 0 ? _b2 : relatedTaskId;
24386
+ if (effectiveTaskId && taskStore) {
24387
+ await taskStore.updateTaskStatus(effectiveTaskId, "input_required");
24388
+ }
24389
+ return await this.request(r, resultSchema, requestOptions);
24390
+ },
23833
24391
  authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,
23834
24392
  requestId: request.id,
23835
- requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo
23836
- };
23837
- Promise.resolve().then(() => handler(request, fullExtra)).then((result) => {
24393
+ requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo,
24394
+ taskId: relatedTaskId,
24395
+ taskStore,
24396
+ taskRequestedTtl: taskCreationParams === null || taskCreationParams === void 0 ? void 0 : taskCreationParams.ttl,
24397
+ closeSSEStream: extra === null || extra === void 0 ? void 0 : extra.closeSSEStream,
24398
+ closeStandaloneSSEStream: extra === null || extra === void 0 ? void 0 : extra.closeStandaloneSSEStream
24399
+ };
24400
+ Promise.resolve().then(() => {
24401
+ if (taskCreationParams) {
24402
+ this.assertTaskHandlerCapability(request.method);
24403
+ }
24404
+ }).then(() => handler(request, fullExtra)).then(async (result) => {
23838
24405
  if (abortController.signal.aborted) {
23839
24406
  return;
23840
24407
  }
23841
- return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
24408
+ const response = {
23842
24409
  result,
23843
24410
  jsonrpc: "2.0",
23844
24411
  id: request.id
23845
- });
23846
- }, (error) => {
24412
+ };
24413
+ if (relatedTaskId && this._taskMessageQueue) {
24414
+ await this._enqueueTaskMessage(relatedTaskId, {
24415
+ type: "response",
24416
+ message: response,
24417
+ timestamp: Date.now()
24418
+ }, capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId);
24419
+ } else {
24420
+ await (capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send(response));
24421
+ }
24422
+ }, async (error2) => {
23847
24423
  var _a2;
23848
24424
  if (abortController.signal.aborted) {
23849
24425
  return;
23850
24426
  }
23851
- return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
24427
+ const errorResponse = {
23852
24428
  jsonrpc: "2.0",
23853
24429
  id: request.id,
23854
24430
  error: {
23855
- code: Number.isSafeInteger(error["code"]) ? error["code"] : ErrorCode.InternalError,
23856
- message: (_a2 = error.message) !== null && _a2 !== void 0 ? _a2 : "Internal error",
23857
- ...error["data"] !== void 0 && { data: error["data"] }
24431
+ code: Number.isSafeInteger(error2["code"]) ? error2["code"] : ErrorCode.InternalError,
24432
+ message: (_a2 = error2.message) !== null && _a2 !== void 0 ? _a2 : "Internal error",
24433
+ ...error2["data"] !== void 0 && { data: error2["data"] }
23858
24434
  }
23859
- });
23860
- }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
24435
+ };
24436
+ if (relatedTaskId && this._taskMessageQueue) {
24437
+ await this._enqueueTaskMessage(relatedTaskId, {
24438
+ type: "error",
24439
+ message: errorResponse,
24440
+ timestamp: Date.now()
24441
+ }, capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId);
24442
+ } else {
24443
+ await (capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send(errorResponse));
24444
+ }
24445
+ }).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
23861
24446
  this._requestHandlerAbortControllers.delete(request.id);
23862
24447
  });
23863
24448
  }
@@ -23874,8 +24459,11 @@ var Protocol = class {
23874
24459
  if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
23875
24460
  try {
23876
24461
  this._resetTimeout(messageId);
23877
- } catch (error) {
23878
- responseHandler(error);
24462
+ } catch (error2) {
24463
+ this._responseHandlers.delete(messageId);
24464
+ this._progressHandlers.delete(messageId);
24465
+ this._cleanupTimeout(messageId);
24466
+ responseHandler(error2);
23879
24467
  return;
23880
24468
  }
23881
24469
  }
@@ -23883,19 +24471,43 @@ var Protocol = class {
23883
24471
  }
23884
24472
  _onresponse(response) {
23885
24473
  const messageId = Number(response.id);
24474
+ const resolver = this._requestResolvers.get(messageId);
24475
+ if (resolver) {
24476
+ this._requestResolvers.delete(messageId);
24477
+ if (isJSONRPCResponse(response)) {
24478
+ resolver(response);
24479
+ } else {
24480
+ const error2 = new McpError(response.error.code, response.error.message, response.error.data);
24481
+ resolver(error2);
24482
+ }
24483
+ return;
24484
+ }
23886
24485
  const handler = this._responseHandlers.get(messageId);
23887
24486
  if (handler === void 0) {
23888
24487
  this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
23889
24488
  return;
23890
24489
  }
23891
24490
  this._responseHandlers.delete(messageId);
23892
- this._progressHandlers.delete(messageId);
23893
24491
  this._cleanupTimeout(messageId);
24492
+ let isTaskResponse = false;
24493
+ if (isJSONRPCResponse(response) && response.result && typeof response.result === "object") {
24494
+ const result = response.result;
24495
+ if (result.task && typeof result.task === "object") {
24496
+ const task = result.task;
24497
+ if (typeof task.taskId === "string") {
24498
+ isTaskResponse = true;
24499
+ this._taskProgressTokens.set(task.taskId, messageId);
24500
+ }
24501
+ }
24502
+ }
24503
+ if (!isTaskResponse) {
24504
+ this._progressHandlers.delete(messageId);
24505
+ }
23894
24506
  if (isJSONRPCResponse(response)) {
23895
24507
  handler(response);
23896
24508
  } else {
23897
- const error = McpError.fromError(response.error.code, response.error.message, response.error.data);
23898
- handler(error);
24509
+ const error2 = McpError.fromError(response.error.code, response.error.message, response.error.data);
24510
+ handler(error2);
23899
24511
  }
23900
24512
  }
23901
24513
  get transport() {
@@ -23909,20 +24521,118 @@ var Protocol = class {
23909
24521
  await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());
23910
24522
  }
23911
24523
  /**
23912
- * Sends a request and wait for a response.
24524
+ * Sends a request and returns an AsyncGenerator that yields response messages.
24525
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
24526
+ *
24527
+ * @example
24528
+ * ```typescript
24529
+ * const stream = protocol.requestStream(request, resultSchema, options);
24530
+ * for await (const message of stream) {
24531
+ * switch (message.type) {
24532
+ * case 'taskCreated':
24533
+ * console.log('Task created:', message.task.taskId);
24534
+ * break;
24535
+ * case 'taskStatus':
24536
+ * console.log('Task status:', message.task.status);
24537
+ * break;
24538
+ * case 'result':
24539
+ * console.log('Final result:', message.result);
24540
+ * break;
24541
+ * case 'error':
24542
+ * console.error('Error:', message.error);
24543
+ * break;
24544
+ * }
24545
+ * }
24546
+ * ```
24547
+ *
24548
+ * @experimental Use `client.experimental.tasks.requestStream()` to access this method.
24549
+ */
24550
+ async *requestStream(request, resultSchema, options) {
24551
+ var _a, _b, _c, _d;
24552
+ const { task } = options !== null && options !== void 0 ? options : {};
24553
+ if (!task) {
24554
+ try {
24555
+ const result = await this.request(request, resultSchema, options);
24556
+ yield { type: "result", result };
24557
+ } catch (error2) {
24558
+ yield {
24559
+ type: "error",
24560
+ error: error2 instanceof McpError ? error2 : new McpError(ErrorCode.InternalError, String(error2))
24561
+ };
24562
+ }
24563
+ return;
24564
+ }
24565
+ let taskId;
24566
+ try {
24567
+ const createResult = await this.request(request, CreateTaskResultSchema, options);
24568
+ if (createResult.task) {
24569
+ taskId = createResult.task.taskId;
24570
+ yield { type: "taskCreated", task: createResult.task };
24571
+ } else {
24572
+ throw new McpError(ErrorCode.InternalError, "Task creation did not return a task");
24573
+ }
24574
+ while (true) {
24575
+ const task2 = await this.getTask({ taskId }, options);
24576
+ yield { type: "taskStatus", task: task2 };
24577
+ if (isTerminal(task2.status)) {
24578
+ if (task2.status === "completed") {
24579
+ const result = await this.getTaskResult({ taskId }, resultSchema, options);
24580
+ yield { type: "result", result };
24581
+ } else if (task2.status === "failed") {
24582
+ yield {
24583
+ type: "error",
24584
+ error: new McpError(ErrorCode.InternalError, `Task ${taskId} failed`)
24585
+ };
24586
+ } else if (task2.status === "cancelled") {
24587
+ yield {
24588
+ type: "error",
24589
+ error: new McpError(ErrorCode.InternalError, `Task ${taskId} was cancelled`)
24590
+ };
24591
+ }
24592
+ return;
24593
+ }
24594
+ if (task2.status === "input_required") {
24595
+ const result = await this.getTaskResult({ taskId }, resultSchema, options);
24596
+ yield { type: "result", result };
24597
+ return;
24598
+ }
24599
+ const pollInterval = (_c = (_a = task2.pollInterval) !== null && _a !== void 0 ? _a : (_b = this._options) === null || _b === void 0 ? void 0 : _b.defaultTaskPollInterval) !== null && _c !== void 0 ? _c : 1e3;
24600
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
24601
+ (_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.throwIfAborted();
24602
+ }
24603
+ } catch (error2) {
24604
+ yield {
24605
+ type: "error",
24606
+ error: error2 instanceof McpError ? error2 : new McpError(ErrorCode.InternalError, String(error2))
24607
+ };
24608
+ }
24609
+ }
24610
+ /**
24611
+ * Sends a request and waits for a response.
23913
24612
  *
23914
24613
  * Do not use this method to emit notifications! Use notification() instead.
23915
24614
  */
23916
24615
  request(request, resultSchema, options) {
23917
- const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};
24616
+ const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options !== null && options !== void 0 ? options : {};
23918
24617
  return new Promise((resolve, reject) => {
23919
- var _a, _b, _c, _d, _e, _f;
24618
+ var _a, _b, _c, _d, _e, _f, _g;
24619
+ const earlyReject = (error2) => {
24620
+ reject(error2);
24621
+ };
23920
24622
  if (!this._transport) {
23921
- reject(new Error("Not connected"));
24623
+ earlyReject(new Error("Not connected"));
23922
24624
  return;
23923
24625
  }
23924
24626
  if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {
23925
- this.assertCapabilityForMethod(request.method);
24627
+ try {
24628
+ this.assertCapabilityForMethod(request.method);
24629
+ if (task) {
24630
+ this.assertTaskCapability(request.method);
24631
+ }
24632
+ } catch (e) {
24633
+ earlyReject(e);
24634
+ return;
24635
+ }
23926
24636
  }
23927
24637
  (_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
23928
24638
  const messageId = this._requestMessageId++;
@@ -23941,6 +24651,21 @@ var Protocol = class {
23941
24651
  }
23942
24652
  };
23943
24653
  }
24654
+ if (task) {
24655
+ jsonrpcRequest.params = {
24656
+ ...jsonrpcRequest.params,
24657
+ task
24658
+ };
24659
+ }
24660
+ if (relatedTask) {
24661
+ jsonrpcRequest.params = {
24662
+ ...jsonrpcRequest.params,
24663
+ _meta: {
24664
+ ...((_d = jsonrpcRequest.params) === null || _d === void 0 ? void 0 : _d._meta) || {},
24665
+ [RELATED_TASK_META_KEY]: relatedTask
24666
+ }
24667
+ };
24668
+ }
23944
24669
  const cancel = (reason) => {
23945
24670
  var _a2;
23946
24671
  this._responseHandlers.delete(messageId);
@@ -23953,8 +24678,9 @@ var Protocol = class {
23953
24678
  requestId: messageId,
23954
24679
  reason: String(reason)
23955
24680
  }
23956
- }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
23957
- reject(reason);
24681
+ }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error3) => this._onerror(new Error(`Failed to send cancellation: ${error3}`)));
24682
+ const error2 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason));
24683
+ reject(error2);
23958
24684
  };
23959
24685
  this._responseHandlers.set(messageId, (response) => {
23960
24686
  var _a2;
@@ -23971,57 +24697,154 @@ var Protocol = class {
23971
24697
  } else {
23972
24698
  resolve(parseResult.data);
23973
24699
  }
23974
- } catch (error) {
23975
- reject(error);
24700
+ } catch (error2) {
24701
+ reject(error2);
23976
24702
  }
23977
24703
  });
23978
- (_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener("abort", () => {
24704
+ (_e = options === null || options === void 0 ? void 0 : options.signal) === null || _e === void 0 ? void 0 : _e.addEventListener("abort", () => {
23979
24705
  var _a2;
23980
24706
  cancel((_a2 = options === null || options === void 0 ? void 0 : options.signal) === null || _a2 === void 0 ? void 0 : _a2.reason);
23981
24707
  });
23982
- const timeout = (_e = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e !== void 0 ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;
24708
+ const timeout = (_f = options === null || options === void 0 ? void 0 : options.timeout) !== null && _f !== void 0 ? _f : DEFAULT_REQUEST_TIMEOUT_MSEC;
23983
24709
  const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
23984
- this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);
23985
- this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {
23986
- this._cleanupTimeout(messageId);
23987
- reject(error);
23988
- });
24710
+ this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_g = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _g !== void 0 ? _g : false);
24711
+ const relatedTaskId = relatedTask === null || relatedTask === void 0 ? void 0 : relatedTask.taskId;
24712
+ if (relatedTaskId) {
24713
+ const responseResolver = (response) => {
24714
+ const handler = this._responseHandlers.get(messageId);
24715
+ if (handler) {
24716
+ handler(response);
24717
+ } else {
24718
+ this._onerror(new Error(`Response handler missing for side-channeled request ${messageId}`));
24719
+ }
24720
+ };
24721
+ this._requestResolvers.set(messageId, responseResolver);
24722
+ this._enqueueTaskMessage(relatedTaskId, {
24723
+ type: "request",
24724
+ message: jsonrpcRequest,
24725
+ timestamp: Date.now()
24726
+ }).catch((error2) => {
24727
+ this._cleanupTimeout(messageId);
24728
+ reject(error2);
24729
+ });
24730
+ } else {
24731
+ this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error2) => {
24732
+ this._cleanupTimeout(messageId);
24733
+ reject(error2);
24734
+ });
24735
+ }
23989
24736
  });
23990
24737
  }
24738
+ /**
24739
+ * Gets the current status of a task.
24740
+ *
24741
+ * @experimental Use `client.experimental.tasks.getTask()` to access this method.
24742
+ */
24743
+ async getTask(params, options) {
24744
+ return this.request({ method: "tasks/get", params }, GetTaskResultSchema, options);
24745
+ }
24746
+ /**
24747
+ * Retrieves the result of a completed task.
24748
+ *
24749
+ * @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.
24750
+ */
24751
+ async getTaskResult(params, resultSchema, options) {
24752
+ return this.request({ method: "tasks/result", params }, resultSchema, options);
24753
+ }
24754
+ /**
24755
+ * Lists tasks, optionally starting from a pagination cursor.
24756
+ *
24757
+ * @experimental Use `client.experimental.tasks.listTasks()` to access this method.
24758
+ */
24759
+ async listTasks(params, options) {
24760
+ return this.request({ method: "tasks/list", params }, ListTasksResultSchema, options);
24761
+ }
24762
+ /**
24763
+ * Cancels a specific task.
24764
+ *
24765
+ * @experimental Use `client.experimental.tasks.cancelTask()` to access this method.
24766
+ */
24767
+ async cancelTask(params, options) {
24768
+ return this.request({ method: "tasks/cancel", params }, CancelTaskResultSchema, options);
24769
+ }
23991
24770
  /**
23992
24771
  * Emits a notification, which is a one-way message that does not expect a response.
23993
24772
  */
23994
24773
  async notification(notification, options) {
23995
- var _a, _b;
24774
+ var _a, _b, _c, _d, _e;
23996
24775
  if (!this._transport) {
23997
24776
  throw new Error("Not connected");
23998
24777
  }
23999
24778
  this.assertNotificationCapability(notification.method);
24000
- const debouncedMethods = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.debouncedNotificationMethods) !== null && _b !== void 0 ? _b : [];
24001
- const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !(options === null || options === void 0 ? void 0 : options.relatedRequestId);
24779
+ const relatedTaskId = (_a = options === null || options === void 0 ? void 0 : options.relatedTask) === null || _a === void 0 ? void 0 : _a.taskId;
24780
+ if (relatedTaskId) {
24781
+ const jsonrpcNotification2 = {
24782
+ ...notification,
24783
+ jsonrpc: "2.0",
24784
+ params: {
24785
+ ...notification.params,
24786
+ _meta: {
24787
+ ...((_b = notification.params) === null || _b === void 0 ? void 0 : _b._meta) || {},
24788
+ [RELATED_TASK_META_KEY]: options.relatedTask
24789
+ }
24790
+ }
24791
+ };
24792
+ await this._enqueueTaskMessage(relatedTaskId, {
24793
+ type: "notification",
24794
+ message: jsonrpcNotification2,
24795
+ timestamp: Date.now()
24796
+ });
24797
+ return;
24798
+ }
24799
+ const debouncedMethods = (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.debouncedNotificationMethods) !== null && _d !== void 0 ? _d : [];
24800
+ const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !(options === null || options === void 0 ? void 0 : options.relatedRequestId) && !(options === null || options === void 0 ? void 0 : options.relatedTask);
24002
24801
  if (canDebounce) {
24003
24802
  if (this._pendingDebouncedNotifications.has(notification.method)) {
24004
24803
  return;
24005
24804
  }
24006
24805
  this._pendingDebouncedNotifications.add(notification.method);
24007
24806
  Promise.resolve().then(() => {
24008
- var _a2;
24807
+ var _a2, _b2;
24009
24808
  this._pendingDebouncedNotifications.delete(notification.method);
24010
24809
  if (!this._transport) {
24011
24810
  return;
24012
24811
  }
24013
- const jsonrpcNotification2 = {
24812
+ let jsonrpcNotification2 = {
24014
24813
  ...notification,
24015
24814
  jsonrpc: "2.0"
24016
24815
  };
24017
- (_a2 = this._transport) === null || _a2 === void 0 ? void 0 : _a2.send(jsonrpcNotification2, options).catch((error) => this._onerror(error));
24816
+ if (options === null || options === void 0 ? void 0 : options.relatedTask) {
24817
+ jsonrpcNotification2 = {
24818
+ ...jsonrpcNotification2,
24819
+ params: {
24820
+ ...jsonrpcNotification2.params,
24821
+ _meta: {
24822
+ ...((_a2 = jsonrpcNotification2.params) === null || _a2 === void 0 ? void 0 : _a2._meta) || {},
24823
+ [RELATED_TASK_META_KEY]: options.relatedTask
24824
+ }
24825
+ }
24826
+ };
24827
+ }
24828
+ (_b2 = this._transport) === null || _b2 === void 0 ? void 0 : _b2.send(jsonrpcNotification2, options).catch((error2) => this._onerror(error2));
24018
24829
  });
24019
24830
  return;
24020
24831
  }
24021
- const jsonrpcNotification = {
24832
+ let jsonrpcNotification = {
24022
24833
  ...notification,
24023
24834
  jsonrpc: "2.0"
24024
24835
  };
24836
+ if (options === null || options === void 0 ? void 0 : options.relatedTask) {
24837
+ jsonrpcNotification = {
24838
+ ...jsonrpcNotification,
24839
+ params: {
24840
+ ...jsonrpcNotification.params,
24841
+ _meta: {
24842
+ ...((_e = jsonrpcNotification.params) === null || _e === void 0 ? void 0 : _e._meta) || {},
24843
+ [RELATED_TASK_META_KEY]: options.relatedTask
24844
+ }
24845
+ }
24846
+ };
24847
+ }
24025
24848
  await this._transport.send(jsonrpcNotification, options);
24026
24849
  }
24027
24850
  /**
@@ -24069,6 +24892,152 @@ var Protocol = class {
24069
24892
  removeNotificationHandler(method) {
24070
24893
  this._notificationHandlers.delete(method);
24071
24894
  }
24895
+ /**
24896
+ * Cleans up the progress handler associated with a task.
24897
+ * This should be called when a task reaches a terminal status.
24898
+ */
24899
+ _cleanupTaskProgressHandler(taskId) {
24900
+ const progressToken = this._taskProgressTokens.get(taskId);
24901
+ if (progressToken !== void 0) {
24902
+ this._progressHandlers.delete(progressToken);
24903
+ this._taskProgressTokens.delete(taskId);
24904
+ }
24905
+ }
24906
+ /**
24907
+ * Enqueues a task-related message for side-channel delivery via tasks/result.
24908
+ * @param taskId The task ID to associate the message with
24909
+ * @param message The message to enqueue
24910
+ * @param sessionId Optional session ID for binding the operation to a specific session
24911
+ * @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow)
24912
+ *
24913
+ * Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle
24914
+ * the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
24915
+ * simply propagates the error.
24916
+ */
24917
+ async _enqueueTaskMessage(taskId, message, sessionId) {
24918
+ var _a;
24919
+ if (!this._taskStore || !this._taskMessageQueue) {
24920
+ throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
24921
+ }
24922
+ const maxQueueSize = (_a = this._options) === null || _a === void 0 ? void 0 : _a.maxTaskQueueSize;
24923
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
24924
+ }
24925
+ /**
24926
+ * Clears the message queue for a task and rejects any pending request resolvers.
24927
+ * @param taskId The task ID whose queue should be cleared
24928
+ * @param sessionId Optional session ID for binding the operation to a specific session
24929
+ */
24930
+ async _clearTaskQueue(taskId, sessionId) {
24931
+ if (this._taskMessageQueue) {
24932
+ const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId);
24933
+ for (const message of messages) {
24934
+ if (message.type === "request" && isJSONRPCRequest(message.message)) {
24935
+ const requestId = message.message.id;
24936
+ const resolver = this._requestResolvers.get(requestId);
24937
+ if (resolver) {
24938
+ resolver(new McpError(ErrorCode.InternalError, "Task cancelled or completed"));
24939
+ this._requestResolvers.delete(requestId);
24940
+ } else {
24941
+ this._onerror(new Error(`Resolver missing for request ${requestId} during task ${taskId} cleanup`));
24942
+ }
24943
+ }
24944
+ }
24945
+ }
24946
+ }
24947
+ /**
24948
+ * Waits for a task update (new messages or status change) with abort signal support.
24949
+ * Uses polling to check for updates at the task's configured poll interval.
24950
+ * @param taskId The task ID to wait for
24951
+ * @param signal Abort signal to cancel the wait
24952
+ * @returns Promise that resolves when an update occurs or rejects if aborted
24953
+ */
24954
+ async _waitForTaskUpdate(taskId, signal) {
24955
+ var _a, _b, _c;
24956
+ let interval = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.defaultTaskPollInterval) !== null && _b !== void 0 ? _b : 1e3;
24957
+ try {
24958
+ const task = await ((_c = this._taskStore) === null || _c === void 0 ? void 0 : _c.getTask(taskId));
24959
+ if (task === null || task === void 0 ? void 0 : task.pollInterval) {
24960
+ interval = task.pollInterval;
24961
+ }
24962
+ } catch (_d) {
24963
+ }
24964
+ return new Promise((resolve, reject) => {
24965
+ if (signal.aborted) {
24966
+ reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
24967
+ return;
24968
+ }
24969
+ const timeoutId = setTimeout(resolve, interval);
24970
+ signal.addEventListener("abort", () => {
24971
+ clearTimeout(timeoutId);
24972
+ reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
24973
+ }, { once: true });
24974
+ });
24975
+ }
24976
+ requestTaskStore(request, sessionId) {
24977
+ const taskStore = this._taskStore;
24978
+ if (!taskStore) {
24979
+ throw new Error("No task store configured");
24980
+ }
24981
+ return {
24982
+ createTask: async (taskParams) => {
24983
+ if (!request) {
24984
+ throw new Error("No request provided");
24985
+ }
24986
+ return await taskStore.createTask(taskParams, request.id, {
24987
+ method: request.method,
24988
+ params: request.params
24989
+ }, sessionId);
24990
+ },
24991
+ getTask: async (taskId) => {
24992
+ const task = await taskStore.getTask(taskId, sessionId);
24993
+ if (!task) {
24994
+ throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
24995
+ }
24996
+ return task;
24997
+ },
24998
+ storeTaskResult: async (taskId, status, result) => {
24999
+ await taskStore.storeTaskResult(taskId, status, result, sessionId);
25000
+ const task = await taskStore.getTask(taskId, sessionId);
25001
+ if (task) {
25002
+ const notification = TaskStatusNotificationSchema.parse({
25003
+ method: "notifications/tasks/status",
25004
+ params: task
25005
+ });
25006
+ await this.notification(notification);
25007
+ if (isTerminal(task.status)) {
25008
+ this._cleanupTaskProgressHandler(taskId);
25009
+ }
25010
+ }
25011
+ },
25012
+ getTaskResult: (taskId) => {
25013
+ return taskStore.getTaskResult(taskId, sessionId);
25014
+ },
25015
+ updateTaskStatus: async (taskId, status, statusMessage) => {
25016
+ const task = await taskStore.getTask(taskId, sessionId);
25017
+ if (!task) {
25018
+ throw new McpError(ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`);
25019
+ }
25020
+ if (isTerminal(task.status)) {
25021
+ throw new McpError(ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
25022
+ }
25023
+ await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId);
25024
+ const updatedTask = await taskStore.getTask(taskId, sessionId);
25025
+ if (updatedTask) {
25026
+ const notification = TaskStatusNotificationSchema.parse({
25027
+ method: "notifications/tasks/status",
25028
+ params: updatedTask
25029
+ });
25030
+ await this.notification(notification);
25031
+ if (isTerminal(updatedTask.status)) {
25032
+ this._cleanupTaskProgressHandler(taskId);
25033
+ }
25034
+ }
25035
+ },
25036
+ listTasks: (cursor) => {
25037
+ return taskStore.listTasks(cursor, sessionId);
25038
+ }
25039
+ };
25040
+ }
24072
25041
  };
24073
25042
  function isPlainObject2(value) {
24074
25043
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -24159,6 +25128,115 @@ var AjvJsonSchemaValidator = class {
24159
25128
  }
24160
25129
  };
24161
25130
 
25131
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
25132
+ var ExperimentalServerTasks = class {
25133
+ constructor(_server) {
25134
+ this._server = _server;
25135
+ }
25136
+ /**
25137
+ * Sends a request and returns an AsyncGenerator that yields response messages.
25138
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
25139
+ *
25140
+ * This method provides streaming access to request processing, allowing you to
25141
+ * observe intermediate task status updates for task-augmented requests.
25142
+ *
25143
+ * @param request - The request to send
25144
+ * @param resultSchema - Zod schema for validating the result
25145
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
25146
+ * @returns AsyncGenerator that yields ResponseMessage objects
25147
+ *
25148
+ * @experimental
25149
+ */
25150
+ requestStream(request, resultSchema, options) {
25151
+ return this._server.requestStream(request, resultSchema, options);
25152
+ }
25153
+ /**
25154
+ * Gets the current status of a task.
25155
+ *
25156
+ * @param taskId - The task identifier
25157
+ * @param options - Optional request options
25158
+ * @returns The task status
25159
+ *
25160
+ * @experimental
25161
+ */
25162
+ async getTask(taskId, options) {
25163
+ return this._server.getTask({ taskId }, options);
25164
+ }
25165
+ /**
25166
+ * Retrieves the result of a completed task.
25167
+ *
25168
+ * @param taskId - The task identifier
25169
+ * @param resultSchema - Zod schema for validating the result
25170
+ * @param options - Optional request options
25171
+ * @returns The task result
25172
+ *
25173
+ * @experimental
25174
+ */
25175
+ async getTaskResult(taskId, resultSchema, options) {
25176
+ return this._server.getTaskResult({ taskId }, resultSchema, options);
25177
+ }
25178
+ /**
25179
+ * Lists tasks with optional pagination.
25180
+ *
25181
+ * @param cursor - Optional pagination cursor
25182
+ * @param options - Optional request options
25183
+ * @returns List of tasks with optional next cursor
25184
+ *
25185
+ * @experimental
25186
+ */
25187
+ async listTasks(cursor, options) {
25188
+ return this._server.listTasks(cursor ? { cursor } : void 0, options);
25189
+ }
25190
+ /**
25191
+ * Cancels a running task.
25192
+ *
25193
+ * @param taskId - The task identifier
25194
+ * @param options - Optional request options
25195
+ *
25196
+ * @experimental
25197
+ */
25198
+ async cancelTask(taskId, options) {
25199
+ return this._server.cancelTask({ taskId }, options);
25200
+ }
25201
+ };
25202
+
25203
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
25204
+ function assertToolsCallTaskCapability(requests, method, entityName) {
25205
+ var _a;
25206
+ if (!requests) {
25207
+ throw new Error(`${entityName} does not support task creation (required for ${method})`);
25208
+ }
25209
+ switch (method) {
25210
+ case "tools/call":
25211
+ if (!((_a = requests.tools) === null || _a === void 0 ? void 0 : _a.call)) {
25212
+ throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
25213
+ }
25214
+ break;
25215
+ default:
25216
+ break;
25217
+ }
25218
+ }
25219
+ function assertClientRequestTaskCapability(requests, method, entityName) {
25220
+ var _a, _b;
25221
+ if (!requests) {
25222
+ throw new Error(`${entityName} does not support task creation (required for ${method})`);
25223
+ }
25224
+ switch (method) {
25225
+ case "sampling/createMessage":
25226
+ if (!((_a = requests.sampling) === null || _a === void 0 ? void 0 : _a.createMessage)) {
25227
+ throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
25228
+ }
25229
+ break;
25230
+ case "elicitation/create":
25231
+ if (!((_b = requests.elicitation) === null || _b === void 0 ? void 0 : _b.create)) {
25232
+ throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
25233
+ }
25234
+ break;
25235
+ default:
25236
+ break;
25237
+ }
25238
+ }
25239
+
24162
25240
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
24163
25241
  var Server = class extends Protocol {
24164
25242
  /**
@@ -24195,6 +25273,21 @@ var Server = class extends Protocol {
24195
25273
  });
24196
25274
  }
24197
25275
  }
25276
+ /**
25277
+ * Access experimental features.
25278
+ *
25279
+ * WARNING: These APIs are experimental and may change without notice.
25280
+ *
25281
+ * @experimental
25282
+ */
25283
+ get experimental() {
25284
+ if (!this._experimental) {
25285
+ this._experimental = {
25286
+ tasks: new ExperimentalServerTasks(this)
25287
+ };
25288
+ }
25289
+ return this._experimental;
25290
+ }
24198
25291
  /**
24199
25292
  * Registers new capabilities. This can only be called before connecting to a transport.
24200
25293
  *
@@ -24206,6 +25299,58 @@ var Server = class extends Protocol {
24206
25299
  }
24207
25300
  this._capabilities = mergeCapabilities(this._capabilities, capabilities);
24208
25301
  }
25302
+ /**
25303
+ * Override request handler registration to enforce server-side validation for tools/call.
25304
+ */
25305
+ setRequestHandler(requestSchema, handler) {
25306
+ var _a, _b, _c;
25307
+ const shape = getObjectShape(requestSchema);
25308
+ const methodSchema = shape === null || shape === void 0 ? void 0 : shape.method;
25309
+ if (!methodSchema) {
25310
+ throw new Error("Schema is missing a method literal");
25311
+ }
25312
+ let methodValue;
25313
+ if (isZ4Schema(methodSchema)) {
25314
+ const v4Schema = methodSchema;
25315
+ const v4Def = (_a = v4Schema._zod) === null || _a === void 0 ? void 0 : _a.def;
25316
+ methodValue = (_b = v4Def === null || v4Def === void 0 ? void 0 : v4Def.value) !== null && _b !== void 0 ? _b : v4Schema.value;
25317
+ } else {
25318
+ const v3Schema = methodSchema;
25319
+ const legacyDef = v3Schema._def;
25320
+ methodValue = (_c = legacyDef === null || legacyDef === void 0 ? void 0 : legacyDef.value) !== null && _c !== void 0 ? _c : v3Schema.value;
25321
+ }
25322
+ if (typeof methodValue !== "string") {
25323
+ throw new Error("Schema method literal must be a string");
25324
+ }
25325
+ const method = methodValue;
25326
+ if (method === "tools/call") {
25327
+ const wrappedHandler = async (request, extra) => {
25328
+ const validatedRequest = safeParse3(CallToolRequestSchema, request);
25329
+ if (!validatedRequest.success) {
25330
+ const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
25331
+ throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
25332
+ }
25333
+ const { params } = validatedRequest.data;
25334
+ const result = await Promise.resolve(handler(request, extra));
25335
+ if (params.task) {
25336
+ const taskValidationResult = safeParse3(CreateTaskResultSchema, result);
25337
+ if (!taskValidationResult.success) {
25338
+ const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
25339
+ throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
25340
+ }
25341
+ return taskValidationResult.data;
25342
+ }
25343
+ const validationResult = safeParse3(CallToolResultSchema, result);
25344
+ if (!validationResult.success) {
25345
+ const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
25346
+ throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
25347
+ }
25348
+ return validationResult.data;
25349
+ };
25350
+ return super.setRequestHandler(requestSchema, wrappedHandler);
25351
+ }
25352
+ return super.setRequestHandler(requestSchema, handler);
25353
+ }
24209
25354
  assertCapabilityForMethod(method) {
24210
25355
  var _a, _b, _c;
24211
25356
  switch (method) {
@@ -24264,6 +25409,9 @@ var Server = class extends Protocol {
24264
25409
  }
24265
25410
  }
24266
25411
  assertRequestHandlerCapability(method) {
25412
+ if (!this._capabilities) {
25413
+ return;
25414
+ }
24267
25415
  switch (method) {
24268
25416
  case "completion/complete":
24269
25417
  if (!this._capabilities.completions) {
@@ -24294,11 +25442,30 @@ var Server = class extends Protocol {
24294
25442
  throw new Error(`Server does not support tools (required for ${method})`);
24295
25443
  }
24296
25444
  break;
25445
+ case "tasks/get":
25446
+ case "tasks/list":
25447
+ case "tasks/result":
25448
+ case "tasks/cancel":
25449
+ if (!this._capabilities.tasks) {
25450
+ throw new Error(`Server does not support tasks capability (required for ${method})`);
25451
+ }
25452
+ break;
24297
25453
  case "ping":
24298
25454
  case "initialize":
24299
25455
  break;
24300
25456
  }
24301
25457
  }
25458
+ assertTaskCapability(method) {
25459
+ var _a, _b;
25460
+ assertClientRequestTaskCapability((_b = (_a = this._clientCapabilities) === null || _a === void 0 ? void 0 : _a.tasks) === null || _b === void 0 ? void 0 : _b.requests, method, "Client");
25461
+ }
25462
+ assertTaskHandlerCapability(method) {
25463
+ var _a;
25464
+ if (!this._capabilities) {
25465
+ return;
25466
+ }
25467
+ assertToolsCallTaskCapability((_a = this._capabilities.tasks) === null || _a === void 0 ? void 0 : _a.requests, method, "Server");
25468
+ }
24302
25469
  async _oninitialize(request) {
24303
25470
  const requestedVersion = request.params.protocolVersion;
24304
25471
  this._clientCapabilities = request.params.capabilities;
@@ -24329,6 +25496,7 @@ var Server = class extends Protocol {
24329
25496
  async ping() {
24330
25497
  return this.request({ method: "ping" }, EmptyResultSchema);
24331
25498
  }
25499
+ // Implementation
24332
25500
  async createMessage(params, options) {
24333
25501
  var _a, _b;
24334
25502
  if (params.tools || params.toolChoice) {
@@ -24359,6 +25527,9 @@ var Server = class extends Protocol {
24359
25527
  }
24360
25528
  }
24361
25529
  }
25530
+ if (params.tools) {
25531
+ return this.request({ method: "sampling/createMessage", params }, CreateMessageResultWithToolsSchema, options);
25532
+ }
24362
25533
  return this.request({ method: "sampling/createMessage", params }, CreateMessageResultSchema, options);
24363
25534
  }
24364
25535
  /**
@@ -24392,11 +25563,11 @@ var Server = class extends Protocol {
24392
25563
  if (!validationResult.valid) {
24393
25564
  throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);
24394
25565
  }
24395
- } catch (error) {
24396
- if (error instanceof McpError) {
24397
- throw error;
25566
+ } catch (error2) {
25567
+ if (error2 instanceof McpError) {
25568
+ throw error2;
24398
25569
  }
24399
- throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`);
25570
+ throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error2 instanceof Error ? error2.message : String(error2)}`);
24400
25571
  }
24401
25572
  }
24402
25573
  return result;
@@ -24531,6 +25702,21 @@ function validateAndWarnToolName(name) {
24531
25702
  return result.isValid;
24532
25703
  }
24533
25704
 
25705
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
25706
+ var ExperimentalMcpServerTasks = class {
25707
+ constructor(_mcpServer) {
25708
+ this._mcpServer = _mcpServer;
25709
+ }
25710
+ registerToolTask(name, config2, handler) {
25711
+ const execution = { taskSupport: "required", ...config2.execution };
25712
+ if (execution.taskSupport === "forbidden") {
25713
+ throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);
25714
+ }
25715
+ const mcpServerInternal = this._mcpServer;
25716
+ return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
25717
+ }
25718
+ };
25719
+
24534
25720
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
24535
25721
  var McpServer = class {
24536
25722
  constructor(serverInfo, options) {
@@ -24544,6 +25730,21 @@ var McpServer = class {
24544
25730
  this._promptHandlersInitialized = false;
24545
25731
  this.server = new Server(serverInfo, options);
24546
25732
  }
25733
+ /**
25734
+ * Access experimental features.
25735
+ *
25736
+ * WARNING: These APIs are experimental and may change without notice.
25737
+ *
25738
+ * @experimental
25739
+ */
25740
+ get experimental() {
25741
+ if (!this._experimental) {
25742
+ this._experimental = {
25743
+ tasks: new ExperimentalMcpServerTasks(this)
25744
+ };
25745
+ }
25746
+ return this._experimental;
25747
+ }
24547
25748
  /**
24548
25749
  * Attaches to the given transport, starts it, and starts listening for messages.
24549
25750
  *
@@ -24583,6 +25784,7 @@ var McpServer = class {
24583
25784
  }) : EMPTY_OBJECT_JSON_SCHEMA;
24584
25785
  })(),
24585
25786
  annotations: tool.annotations,
25787
+ execution: tool.execution,
24586
25788
  _meta: tool._meta
24587
25789
  };
24588
25790
  if (tool.outputSchema) {
@@ -24598,48 +25800,42 @@ var McpServer = class {
24598
25800
  })
24599
25801
  }));
24600
25802
  this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
24601
- const tool = this._registeredTools[request.params.name];
24602
- let result;
25803
+ var _a;
24603
25804
  try {
25805
+ const tool = this._registeredTools[request.params.name];
24604
25806
  if (!tool) {
24605
25807
  throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);
24606
25808
  }
24607
25809
  if (!tool.enabled) {
24608
25810
  throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);
24609
25811
  }
24610
- if (tool.inputSchema) {
24611
- const cb = tool.callback;
24612
- const inputObj = normalizeObjectSchema(tool.inputSchema);
24613
- const schemaToParse = inputObj !== null && inputObj !== void 0 ? inputObj : tool.inputSchema;
24614
- const parseResult = await safeParseAsync3(schemaToParse, request.params.arguments);
24615
- if (!parseResult.success) {
24616
- throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${request.params.name}: ${getParseErrorMessage(parseResult.error)}`);
24617
- }
24618
- const args = parseResult.data;
24619
- result = await Promise.resolve(cb(args, extra));
24620
- } else {
24621
- const cb = tool.callback;
24622
- result = await Promise.resolve(cb(extra));
25812
+ const isTaskRequest = !!request.params.task;
25813
+ const taskSupport = (_a = tool.execution) === null || _a === void 0 ? void 0 : _a.taskSupport;
25814
+ const isTaskHandler = "createTask" in tool.handler;
25815
+ if ((taskSupport === "required" || taskSupport === "optional") && !isTaskHandler) {
25816
+ throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`);
24623
25817
  }
24624
- if (tool.outputSchema && !result.isError) {
24625
- if (!result.structuredContent) {
24626
- throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${request.params.name} has an output schema but no structured content was provided`);
24627
- }
24628
- const outputObj = normalizeObjectSchema(tool.outputSchema);
24629
- const parseResult = await safeParseAsync3(outputObj, result.structuredContent);
24630
- if (!parseResult.success) {
24631
- throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${request.params.name}: ${getParseErrorMessage(parseResult.error)}`);
24632
- }
25818
+ if (taskSupport === "required" && !isTaskRequest) {
25819
+ throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`);
25820
+ }
25821
+ if (taskSupport === "optional" && !isTaskRequest && isTaskHandler) {
25822
+ return await this.handleAutomaticTaskPolling(tool, request, extra);
24633
25823
  }
24634
- } catch (error) {
24635
- if (error instanceof McpError) {
24636
- if (error.code === ErrorCode.UrlElicitationRequired) {
24637
- throw error;
25824
+ const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);
25825
+ const result = await this.executeToolHandler(tool, args, extra);
25826
+ if (isTaskRequest) {
25827
+ return result;
25828
+ }
25829
+ await this.validateToolOutput(tool, result, request.params.name);
25830
+ return result;
25831
+ } catch (error2) {
25832
+ if (error2 instanceof McpError) {
25833
+ if (error2.code === ErrorCode.UrlElicitationRequired) {
25834
+ throw error2;
24638
25835
  }
24639
25836
  }
24640
- return this.createToolError(error instanceof Error ? error.message : String(error));
25837
+ return this.createToolError(error2 instanceof Error ? error2.message : String(error2));
24641
25838
  }
24642
- return result;
24643
25839
  });
24644
25840
  this._toolHandlersInitialized = true;
24645
25841
  }
@@ -24660,6 +25856,102 @@ var McpServer = class {
24660
25856
  isError: true
24661
25857
  };
24662
25858
  }
25859
+ /**
25860
+ * Validates tool input arguments against the tool's input schema.
25861
+ */
25862
+ async validateToolInput(tool, args, toolName) {
25863
+ if (!tool.inputSchema) {
25864
+ return void 0;
25865
+ }
25866
+ const inputObj = normalizeObjectSchema(tool.inputSchema);
25867
+ const schemaToParse = inputObj !== null && inputObj !== void 0 ? inputObj : tool.inputSchema;
25868
+ const parseResult = await safeParseAsync3(schemaToParse, args);
25869
+ if (!parseResult.success) {
25870
+ const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
25871
+ const errorMessage = getParseErrorMessage(error2);
25872
+ throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);
25873
+ }
25874
+ return parseResult.data;
25875
+ }
25876
+ /**
25877
+ * Validates tool output against the tool's output schema.
25878
+ */
25879
+ async validateToolOutput(tool, result, toolName) {
25880
+ if (!tool.outputSchema) {
25881
+ return;
25882
+ }
25883
+ if (!("content" in result)) {
25884
+ return;
25885
+ }
25886
+ if (result.isError) {
25887
+ return;
25888
+ }
25889
+ if (!result.structuredContent) {
25890
+ throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`);
25891
+ }
25892
+ const outputObj = normalizeObjectSchema(tool.outputSchema);
25893
+ const parseResult = await safeParseAsync3(outputObj, result.structuredContent);
25894
+ if (!parseResult.success) {
25895
+ const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
25896
+ const errorMessage = getParseErrorMessage(error2);
25897
+ throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);
25898
+ }
25899
+ }
25900
+ /**
25901
+ * Executes a tool handler (either regular or task-based).
25902
+ */
25903
+ async executeToolHandler(tool, args, extra) {
25904
+ const handler = tool.handler;
25905
+ const isTaskHandler = "createTask" in handler;
25906
+ if (isTaskHandler) {
25907
+ if (!extra.taskStore) {
25908
+ throw new Error("No task store provided.");
25909
+ }
25910
+ const taskExtra = { ...extra, taskStore: extra.taskStore };
25911
+ if (tool.inputSchema) {
25912
+ const typedHandler = handler;
25913
+ return await Promise.resolve(typedHandler.createTask(args, taskExtra));
25914
+ } else {
25915
+ const typedHandler = handler;
25916
+ return await Promise.resolve(typedHandler.createTask(taskExtra));
25917
+ }
25918
+ }
25919
+ if (tool.inputSchema) {
25920
+ const typedHandler = handler;
25921
+ return await Promise.resolve(typedHandler(args, extra));
25922
+ } else {
25923
+ const typedHandler = handler;
25924
+ return await Promise.resolve(typedHandler(extra));
25925
+ }
25926
+ }
25927
+ /**
25928
+ * Handles automatic task polling for tools with taskSupport 'optional'.
25929
+ */
25930
+ async handleAutomaticTaskPolling(tool, request, extra) {
25931
+ var _a;
25932
+ if (!extra.taskStore) {
25933
+ throw new Error("No task store provided for task-capable tool.");
25934
+ }
25935
+ const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);
25936
+ const handler = tool.handler;
25937
+ const taskExtra = { ...extra, taskStore: extra.taskStore };
25938
+ const createTaskResult = args ? await Promise.resolve(handler.createTask(args, taskExtra)) : (
25939
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25940
+ await Promise.resolve(handler.createTask(taskExtra))
25941
+ );
25942
+ const taskId = createTaskResult.task.taskId;
25943
+ let task = createTaskResult.task;
25944
+ const pollInterval = (_a = task.pollInterval) !== null && _a !== void 0 ? _a : 5e3;
25945
+ while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
25946
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
25947
+ const updatedTask = await extra.taskStore.getTask(taskId);
25948
+ if (!updatedTask) {
25949
+ throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
25950
+ }
25951
+ task = updatedTask;
25952
+ }
25953
+ return await extra.taskStore.getTaskResult(taskId);
25954
+ }
24663
25955
  setCompletionRequestHandler() {
24664
25956
  if (this._completionHandlerInitialized) {
24665
25957
  return;
@@ -24815,7 +26107,9 @@ var McpServer = class {
24815
26107
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
24816
26108
  const parseResult = await safeParseAsync3(argsObj, request.params.arguments);
24817
26109
  if (!parseResult.success) {
24818
- throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${getParseErrorMessage(parseResult.error)}`);
26110
+ const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
26111
+ const errorMessage = getParseErrorMessage(error2);
26112
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);
24819
26113
  }
24820
26114
  const args = parseResult.data;
24821
26115
  const cb = prompt.callback;
@@ -24967,7 +26261,7 @@ var McpServer = class {
24967
26261
  this._registeredPrompts[name] = registeredPrompt;
24968
26262
  return registeredPrompt;
24969
26263
  }
24970
- _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, _meta, callback) {
26264
+ _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {
24971
26265
  validateAndWarnToolName(name);
24972
26266
  const registeredTool = {
24973
26267
  title,
@@ -24975,8 +26269,9 @@ var McpServer = class {
24975
26269
  inputSchema: getZodSchemaObject(inputSchema),
24976
26270
  outputSchema: getZodSchemaObject(outputSchema),
24977
26271
  annotations,
26272
+ execution,
24978
26273
  _meta,
24979
- callback,
26274
+ handler,
24980
26275
  enabled: true,
24981
26276
  disable: () => registeredTool.update({ enabled: false }),
24982
26277
  enable: () => registeredTool.update({ enabled: true }),
@@ -24997,7 +26292,7 @@ var McpServer = class {
24997
26292
  if (typeof updates.paramsSchema !== "undefined")
24998
26293
  registeredTool.inputSchema = objectFromShape(updates.paramsSchema);
24999
26294
  if (typeof updates.callback !== "undefined")
25000
- registeredTool.callback = updates.callback;
26295
+ registeredTool.handler = updates.callback;
25001
26296
  if (typeof updates.annotations !== "undefined")
25002
26297
  registeredTool.annotations = updates.annotations;
25003
26298
  if (typeof updates._meta !== "undefined")
@@ -25028,9 +26323,9 @@ var McpServer = class {
25028
26323
  }
25029
26324
  if (rest.length > 1) {
25030
26325
  const firstArg = rest[0];
25031
- if (isZodRawShape(firstArg)) {
26326
+ if (isZodRawShapeCompat(firstArg)) {
25032
26327
  inputSchema = rest.shift();
25033
- if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShape(rest[0])) {
26328
+ if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShapeCompat(rest[0])) {
25034
26329
  annotations = rest.shift();
25035
26330
  }
25036
26331
  } else if (typeof firstArg === "object" && firstArg !== null) {
@@ -25038,7 +26333,7 @@ var McpServer = class {
25038
26333
  }
25039
26334
  }
25040
26335
  const callback = rest[0];
25041
- return this._createRegisteredTool(name, void 0, description, inputSchema, outputSchema, annotations, void 0, callback);
26336
+ return this._createRegisteredTool(name, void 0, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
25042
26337
  }
25043
26338
  /**
25044
26339
  * Registers a tool with a config object and callback.
@@ -25048,7 +26343,7 @@ var McpServer = class {
25048
26343
  throw new Error(`Tool ${name} is already registered`);
25049
26344
  }
25050
26345
  const { title, description, inputSchema, outputSchema, annotations, _meta } = config2;
25051
- return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, _meta, cb);
26346
+ return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb);
25052
26347
  }
25053
26348
  prompt(name, ...rest) {
25054
26349
  if (this._registeredPrompts[name]) {
@@ -25127,20 +26422,29 @@ var EMPTY_OBJECT_JSON_SCHEMA = {
25127
26422
  type: "object",
25128
26423
  properties: {}
25129
26424
  };
25130
- function isZodRawShape(obj) {
25131
- if (typeof obj !== "object" || obj === null)
25132
- return false;
25133
- const isEmptyObject = Object.keys(obj).length === 0;
25134
- return isEmptyObject || Object.values(obj).some(isZodTypeLike);
25135
- }
25136
26425
  function isZodTypeLike(value) {
25137
26426
  return value !== null && typeof value === "object" && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
25138
26427
  }
26428
+ function isZodSchemaInstance(obj) {
26429
+ return "_def" in obj || "_zod" in obj || isZodTypeLike(obj);
26430
+ }
26431
+ function isZodRawShapeCompat(obj) {
26432
+ if (typeof obj !== "object" || obj === null) {
26433
+ return false;
26434
+ }
26435
+ if (isZodSchemaInstance(obj)) {
26436
+ return false;
26437
+ }
26438
+ if (Object.keys(obj).length === 0) {
26439
+ return true;
26440
+ }
26441
+ return Object.values(obj).some(isZodTypeLike);
26442
+ }
25139
26443
  function getZodSchemaObject(schema) {
25140
26444
  if (!schema) {
25141
26445
  return void 0;
25142
26446
  }
25143
- if (isZodRawShape(schema)) {
26447
+ if (isZodRawShapeCompat(schema)) {
25144
26448
  return objectFromShape(schema);
25145
26449
  }
25146
26450
  return schema;
@@ -25383,8 +26687,8 @@ function generateMcpTools(config2) {
25383
26687
  const tool = generateMcpTool({ method, path: `${defaultServerUrl}${path2}`, operation }, config2);
25384
26688
  info(`Generated tool: ${tool.name} for ${method} ${path2}`);
25385
26689
  tools.push(tool);
25386
- } catch (error) {
25387
- err(`Failed to generate tool for ${method} ${path2}:`, error);
26690
+ } catch (error2) {
26691
+ err(`Failed to generate tool for ${method} ${path2}:`, error2);
25388
26692
  }
25389
26693
  }
25390
26694
  }
@@ -25419,8 +26723,8 @@ function generateMcpTool(description, config2) {
25419
26723
  },
25420
26724
  body: "data" in params ? JSON.stringify(params.data, null, 2) : void 0
25421
26725
  });
25422
- } catch (error) {
25423
- err(`Failed to fetch ${url}. Are you sure that the server is running?`, error);
26726
+ } catch (error2) {
26727
+ err(`Failed to fetch ${url}. Are you sure that the server is running?`, error2);
25424
26728
  return {
25425
26729
  content: [
25426
26730
  {
@@ -25450,8 +26754,8 @@ function generateMcpTool(description, config2) {
25450
26754
  const text = await response.text();
25451
26755
  return { content: [{ type: "text", text }] };
25452
26756
  }
25453
- } catch (error) {
25454
- return { content: [{ type: "text", text: String(error) }], isError: true };
26757
+ } catch (error2) {
26758
+ return { content: [{ type: "text", text: String(error2) }], isError: true };
25455
26759
  }
25456
26760
  }
25457
26761
  const inputSchema = {};
@@ -25531,8 +26835,8 @@ function read() {
25531
26835
  try {
25532
26836
  const data = readFileSync(STORAGE_PATH, { encoding: "utf8" });
25533
26837
  return JSON.parse(data);
25534
- } catch (error) {
25535
- err("Failed to read storage from file", STORAGE_PATH, error);
26838
+ } catch (error2) {
26839
+ err("Failed to read storage from file", STORAGE_PATH, error2);
25536
26840
  return {};
25537
26841
  }
25538
26842
  }
@@ -25541,8 +26845,8 @@ function read() {
25541
26845
  function write(newStorage) {
25542
26846
  try {
25543
26847
  writeFile(STORAGE_PATH, JSON.stringify(newStorage, null, 2));
25544
- } catch (error) {
25545
- err(`Failed to write storage to file: ${STORAGE_PATH}`, error);
26848
+ } catch (error2) {
26849
+ err(`Failed to write storage to file: ${STORAGE_PATH}`, error2);
25546
26850
  }
25547
26851
  }
25548
26852
 
@@ -25575,8 +26879,8 @@ async function fetchOpenApiSpec(url, secret) {
25575
26879
  headers["Authorization"] = `Bearer ${secret}`;
25576
26880
  }
25577
26881
  response = await fetch(url, { headers });
25578
- } catch (error) {
25579
- err(`Failed to fetch OpenAPI spec from ${url}. Are you sure that the server is running?`, error);
26882
+ } catch (error2) {
26883
+ err(`Failed to fetch OpenAPI spec from ${url}. Are you sure that the server is running?`, error2);
25580
26884
  return;
25581
26885
  }
25582
26886
  if (!response.ok) {