@wix/mcp 1.0.18 → 1.0.19

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.
@@ -4588,7 +4588,7 @@ var require_error = __commonJS({
4588
4588
  "toJSON",
4589
4589
  "__CANCEL__"
4590
4590
  ];
4591
- var HttpError = class _HttpError extends Error {
4591
+ var HttpError2 = class _HttpError extends Error {
4592
4592
  constructor(error) {
4593
4593
  super(error.message);
4594
4594
  this.isWixHttpError = true;
@@ -4601,9 +4601,9 @@ var require_error = __commonJS({
4601
4601
  return (0, headers_1.requestIdOrEmptyString)(this.response);
4602
4602
  }
4603
4603
  };
4604
- exports.HttpError = HttpError;
4604
+ exports.HttpError = HttpError2;
4605
4605
  function createHttpError(...args) {
4606
- return new HttpError(...args);
4606
+ return new HttpError2(...args);
4607
4607
  }
4608
4608
  exports.createHttpError = createHttpError;
4609
4609
  }
@@ -7565,7 +7565,7 @@ var require_http_client = __commonJS({
7565
7565
  var headers_1 = require_headers();
7566
7566
  var options_1 = require_options();
7567
7567
  var utils_1 = require_utils4();
7568
- var HttpClient2 = class {
7568
+ var HttpClient3 = class {
7569
7569
  constructor(opts = {}) {
7570
7570
  this.opts = opts;
7571
7571
  this.opts = defaultClientOptions(this.opts);
@@ -7697,9 +7697,9 @@ var require_http_client = __commonJS({
7697
7697
  });
7698
7698
  }
7699
7699
  };
7700
- exports.HttpClient = HttpClient2;
7701
- HttpClient2.CancelToken = axios_1.default.CancelToken;
7702
- HttpClient2.isCancel = axios_1.default.isCancel;
7700
+ exports.HttpClient = HttpClient3;
7701
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
7702
+ HttpClient3.isCancel = axios_1.default.isCancel;
7703
7703
  function defaultClientOptions(opts) {
7704
7704
  let adapter = opts.adapter;
7705
7705
  if (!adapter) {
@@ -7769,7 +7769,7 @@ var require_http_client = __commonJS({
7769
7769
  }
7770
7770
  }
7771
7771
  function createHttpClient(...args) {
7772
- return new HttpClient2(...args);
7772
+ return new HttpClient3(...args);
7773
7773
  }
7774
7774
  exports.createHttpClient = createHttpClient;
7775
7775
  }
@@ -9537,7 +9537,7 @@ var require_error2 = __commonJS({
9537
9537
  "toJSON",
9538
9538
  "__CANCEL__"
9539
9539
  ];
9540
- var HttpError = class _HttpError extends Error {
9540
+ var HttpError2 = class _HttpError extends Error {
9541
9541
  constructor(error) {
9542
9542
  super(error.message);
9543
9543
  this.isWixHttpError = true;
@@ -9550,9 +9550,9 @@ var require_error2 = __commonJS({
9550
9550
  return (0, headers_1.requestIdOrEmptyString)(this.response);
9551
9551
  }
9552
9552
  };
9553
- exports.HttpError = HttpError;
9553
+ exports.HttpError = HttpError2;
9554
9554
  function createHttpError(...args) {
9555
- return new HttpError(...args);
9555
+ return new HttpError2(...args);
9556
9556
  }
9557
9557
  exports.createHttpError = createHttpError;
9558
9558
  }
@@ -11241,7 +11241,7 @@ var require_http_client2 = __commonJS({
11241
11241
  var headers_1 = require_headers2();
11242
11242
  var options_1 = require_options2();
11243
11243
  var utils_1 = require_utils7();
11244
- var HttpClient2 = class {
11244
+ var HttpClient3 = class {
11245
11245
  constructor(opts = {}) {
11246
11246
  this.opts = opts;
11247
11247
  this.opts = defaultClientOptions(this.opts);
@@ -11373,9 +11373,9 @@ var require_http_client2 = __commonJS({
11373
11373
  });
11374
11374
  }
11375
11375
  };
11376
- exports.HttpClient = HttpClient2;
11377
- HttpClient2.CancelToken = axios_1.default.CancelToken;
11378
- HttpClient2.isCancel = axios_1.default.isCancel;
11376
+ exports.HttpClient = HttpClient3;
11377
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
11378
+ HttpClient3.isCancel = axios_1.default.isCancel;
11379
11379
  function defaultClientOptions(opts) {
11380
11380
  let adapter = opts.adapter;
11381
11381
  if (!adapter) {
@@ -11445,7 +11445,7 @@ var require_http_client2 = __commonJS({
11445
11445
  }
11446
11446
  }
11447
11447
  function createHttpClient(...args) {
11448
- return new HttpClient2(...args);
11448
+ return new HttpClient3(...args);
11449
11449
  }
11450
11450
  exports.createHttpClient = createHttpClient;
11451
11451
  }
@@ -12181,7 +12181,7 @@ var require_error3 = __commonJS({
12181
12181
  "toJSON",
12182
12182
  "__CANCEL__"
12183
12183
  ];
12184
- var HttpError = class _HttpError extends Error {
12184
+ var HttpError2 = class _HttpError extends Error {
12185
12185
  constructor(error) {
12186
12186
  var _a;
12187
12187
  super(error.message);
@@ -12198,9 +12198,9 @@ var require_error3 = __commonJS({
12198
12198
  return (0, headers_1.requestIdOrEmptyString)(this.response);
12199
12199
  }
12200
12200
  };
12201
- exports.HttpError = HttpError;
12201
+ exports.HttpError = HttpError2;
12202
12202
  function createHttpError(...args) {
12203
- return new HttpError(...args);
12203
+ return new HttpError2(...args);
12204
12204
  }
12205
12205
  exports.createHttpError = createHttpError;
12206
12206
  }
@@ -14517,7 +14517,7 @@ var require_http_client3 = __commonJS({
14517
14517
  var headers_1 = require_headers3();
14518
14518
  var options_1 = require_options3();
14519
14519
  var utils_1 = require_utils10();
14520
- var HttpClient2 = class {
14520
+ var HttpClient3 = class {
14521
14521
  constructor(opts = {}) {
14522
14522
  this.opts = opts;
14523
14523
  this.opts = defaultClientOptions(this.opts);
@@ -14658,9 +14658,9 @@ var require_http_client3 = __commonJS({
14658
14658
  });
14659
14659
  }
14660
14660
  };
14661
- exports.HttpClient = HttpClient2;
14662
- HttpClient2.CancelToken = axios_1.default.CancelToken;
14663
- HttpClient2.isCancel = axios_1.default.isCancel;
14661
+ exports.HttpClient = HttpClient3;
14662
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
14663
+ HttpClient3.isCancel = axios_1.default.isCancel;
14664
14664
  function defaultClientOptions(opts) {
14665
14665
  let adapter = opts.adapter;
14666
14666
  if (!adapter) {
@@ -14730,7 +14730,7 @@ var require_http_client3 = __commonJS({
14730
14730
  }
14731
14731
  }
14732
14732
  function createHttpClient(...args) {
14733
- return new HttpClient2(...args);
14733
+ return new HttpClient3(...args);
14734
14734
  }
14735
14735
  exports.createHttpClient = createHttpClient;
14736
14736
  }
@@ -16053,6 +16053,7 @@ var addDocsResources = async (server2, portals) => {
16053
16053
  };
16054
16054
 
16055
16055
  // src/api-call/index.ts
16056
+ var import_http_client2 = __toESM(require_index_node3(), 1);
16056
16057
  import { z as z3 } from "zod";
16057
16058
 
16058
16059
  // src/tool-utils.ts
@@ -16079,7 +16080,7 @@ var buildErrorMessage = ({
16079
16080
  ].filter((str) => !!str).join("\n");
16080
16081
  };
16081
16082
  var handleWixAPIResponse = async (response) => {
16082
- const requestId = response.headers.get?.("x-wix-request-id");
16083
+ const requestId = response.headers?.["x-wix-request-id"];
16083
16084
  if (!response.status.toString().startsWith("2")) {
16084
16085
  const errorMessage = buildErrorMessage({
16085
16086
  status: response.status,
@@ -16187,10 +16188,15 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
16187
16188
  ]
16188
16189
  };
16189
16190
  } catch (error) {
16190
- logger.error(`Failed to call Wix Site API: ${error}`);
16191
+ let requestId;
16192
+ if (import_http_client2.HttpClient.isHttpError(error)) {
16193
+ requestId = error.requestId;
16194
+ }
16195
+ const errorMessage = `Failed to call Wix Site API: ${error} Request ID: ${requestId ? `Request ID: ${requestId}` : ""}`;
16196
+ logger.error(errorMessage);
16191
16197
  const response = error.response;
16192
16198
  if (!response) {
16193
- throw new Error(`Failed to call Wix Site API: ${error}`);
16199
+ throw new Error(errorMessage);
16194
16200
  }
16195
16201
  return handleWixAPIResponse(response);
16196
16202
  }