@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.
@@ -4928,7 +4928,7 @@ var require_error = __commonJS({
4928
4928
  "toJSON",
4929
4929
  "__CANCEL__"
4930
4930
  ];
4931
- var HttpError = class _HttpError extends Error {
4931
+ var HttpError2 = class _HttpError extends Error {
4932
4932
  constructor(error) {
4933
4933
  super(error.message);
4934
4934
  this.isWixHttpError = true;
@@ -4941,9 +4941,9 @@ var require_error = __commonJS({
4941
4941
  return (0, headers_1.requestIdOrEmptyString)(this.response);
4942
4942
  }
4943
4943
  };
4944
- exports2.HttpError = HttpError;
4944
+ exports2.HttpError = HttpError2;
4945
4945
  function createHttpError(...args) {
4946
- return new HttpError(...args);
4946
+ return new HttpError2(...args);
4947
4947
  }
4948
4948
  exports2.createHttpError = createHttpError;
4949
4949
  }
@@ -7905,7 +7905,7 @@ var require_http_client = __commonJS({
7905
7905
  var headers_1 = require_headers();
7906
7906
  var options_1 = require_options();
7907
7907
  var utils_1 = require_utils4();
7908
- var HttpClient2 = class {
7908
+ var HttpClient3 = class {
7909
7909
  constructor(opts = {}) {
7910
7910
  this.opts = opts;
7911
7911
  this.opts = defaultClientOptions(this.opts);
@@ -8037,9 +8037,9 @@ var require_http_client = __commonJS({
8037
8037
  });
8038
8038
  }
8039
8039
  };
8040
- exports2.HttpClient = HttpClient2;
8041
- HttpClient2.CancelToken = axios_1.default.CancelToken;
8042
- HttpClient2.isCancel = axios_1.default.isCancel;
8040
+ exports2.HttpClient = HttpClient3;
8041
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
8042
+ HttpClient3.isCancel = axios_1.default.isCancel;
8043
8043
  function defaultClientOptions(opts) {
8044
8044
  let adapter = opts.adapter;
8045
8045
  if (!adapter) {
@@ -8109,7 +8109,7 @@ var require_http_client = __commonJS({
8109
8109
  }
8110
8110
  }
8111
8111
  function createHttpClient(...args) {
8112
- return new HttpClient2(...args);
8112
+ return new HttpClient3(...args);
8113
8113
  }
8114
8114
  exports2.createHttpClient = createHttpClient;
8115
8115
  }
@@ -9877,7 +9877,7 @@ var require_error2 = __commonJS({
9877
9877
  "toJSON",
9878
9878
  "__CANCEL__"
9879
9879
  ];
9880
- var HttpError = class _HttpError extends Error {
9880
+ var HttpError2 = class _HttpError extends Error {
9881
9881
  constructor(error) {
9882
9882
  super(error.message);
9883
9883
  this.isWixHttpError = true;
@@ -9890,9 +9890,9 @@ var require_error2 = __commonJS({
9890
9890
  return (0, headers_1.requestIdOrEmptyString)(this.response);
9891
9891
  }
9892
9892
  };
9893
- exports2.HttpError = HttpError;
9893
+ exports2.HttpError = HttpError2;
9894
9894
  function createHttpError(...args) {
9895
- return new HttpError(...args);
9895
+ return new HttpError2(...args);
9896
9896
  }
9897
9897
  exports2.createHttpError = createHttpError;
9898
9898
  }
@@ -11581,7 +11581,7 @@ var require_http_client2 = __commonJS({
11581
11581
  var headers_1 = require_headers2();
11582
11582
  var options_1 = require_options2();
11583
11583
  var utils_1 = require_utils7();
11584
- var HttpClient2 = class {
11584
+ var HttpClient3 = class {
11585
11585
  constructor(opts = {}) {
11586
11586
  this.opts = opts;
11587
11587
  this.opts = defaultClientOptions(this.opts);
@@ -11713,9 +11713,9 @@ var require_http_client2 = __commonJS({
11713
11713
  });
11714
11714
  }
11715
11715
  };
11716
- exports2.HttpClient = HttpClient2;
11717
- HttpClient2.CancelToken = axios_1.default.CancelToken;
11718
- HttpClient2.isCancel = axios_1.default.isCancel;
11716
+ exports2.HttpClient = HttpClient3;
11717
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
11718
+ HttpClient3.isCancel = axios_1.default.isCancel;
11719
11719
  function defaultClientOptions(opts) {
11720
11720
  let adapter = opts.adapter;
11721
11721
  if (!adapter) {
@@ -11785,7 +11785,7 @@ var require_http_client2 = __commonJS({
11785
11785
  }
11786
11786
  }
11787
11787
  function createHttpClient(...args) {
11788
- return new HttpClient2(...args);
11788
+ return new HttpClient3(...args);
11789
11789
  }
11790
11790
  exports2.createHttpClient = createHttpClient;
11791
11791
  }
@@ -12521,7 +12521,7 @@ var require_error3 = __commonJS({
12521
12521
  "toJSON",
12522
12522
  "__CANCEL__"
12523
12523
  ];
12524
- var HttpError = class _HttpError extends Error {
12524
+ var HttpError2 = class _HttpError extends Error {
12525
12525
  constructor(error) {
12526
12526
  var _a;
12527
12527
  super(error.message);
@@ -12538,9 +12538,9 @@ var require_error3 = __commonJS({
12538
12538
  return (0, headers_1.requestIdOrEmptyString)(this.response);
12539
12539
  }
12540
12540
  };
12541
- exports2.HttpError = HttpError;
12541
+ exports2.HttpError = HttpError2;
12542
12542
  function createHttpError(...args) {
12543
- return new HttpError(...args);
12543
+ return new HttpError2(...args);
12544
12544
  }
12545
12545
  exports2.createHttpError = createHttpError;
12546
12546
  }
@@ -14857,7 +14857,7 @@ var require_http_client3 = __commonJS({
14857
14857
  var headers_1 = require_headers3();
14858
14858
  var options_1 = require_options3();
14859
14859
  var utils_1 = require_utils10();
14860
- var HttpClient2 = class {
14860
+ var HttpClient3 = class {
14861
14861
  constructor(opts = {}) {
14862
14862
  this.opts = opts;
14863
14863
  this.opts = defaultClientOptions(this.opts);
@@ -14998,9 +14998,9 @@ var require_http_client3 = __commonJS({
14998
14998
  });
14999
14999
  }
15000
15000
  };
15001
- exports2.HttpClient = HttpClient2;
15002
- HttpClient2.CancelToken = axios_1.default.CancelToken;
15003
- HttpClient2.isCancel = axios_1.default.isCancel;
15001
+ exports2.HttpClient = HttpClient3;
15002
+ HttpClient3.CancelToken = axios_1.default.CancelToken;
15003
+ HttpClient3.isCancel = axios_1.default.isCancel;
15004
15004
  function defaultClientOptions(opts) {
15005
15005
  let adapter = opts.adapter;
15006
15006
  if (!adapter) {
@@ -15070,7 +15070,7 @@ var require_http_client3 = __commonJS({
15070
15070
  }
15071
15071
  }
15072
15072
  function createHttpClient(...args) {
15073
- return new HttpClient2(...args);
15073
+ return new HttpClient3(...args);
15074
15074
  }
15075
15075
  exports2.createHttpClient = createHttpClient;
15076
15076
  }
@@ -24310,6 +24310,9 @@ var addDocsTools = (server, allowedTools = [
24310
24310
  );
24311
24311
  };
24312
24312
 
24313
+ // src/api-call/index.ts
24314
+ var import_http_client2 = __toESM(require_index_node3(), 1);
24315
+
24313
24316
  // src/tool-utils.ts
24314
24317
  var safeParseJSON = (text) => {
24315
24318
  try {
@@ -24334,7 +24337,7 @@ var buildErrorMessage = ({
24334
24337
  ].filter((str) => !!str).join("\n");
24335
24338
  };
24336
24339
  var handleWixAPIResponse = async (response) => {
24337
- const requestId = response.headers.get?.("x-wix-request-id");
24340
+ const requestId = response.headers?.["x-wix-request-id"];
24338
24341
  if (!response.status.toString().startsWith("2")) {
24339
24342
  const errorMessage = buildErrorMessage({
24340
24343
  status: response.status,
@@ -24442,10 +24445,15 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
24442
24445
  ]
24443
24446
  };
24444
24447
  } catch (error) {
24445
- logger2.error(`Failed to call Wix Site API: ${error}`);
24448
+ let requestId;
24449
+ if (import_http_client2.HttpClient.isHttpError(error)) {
24450
+ requestId = error.requestId;
24451
+ }
24452
+ const errorMessage = `Failed to call Wix Site API: ${error} Request ID: ${requestId ? `Request ID: ${requestId}` : ""}`;
24453
+ logger2.error(errorMessage);
24446
24454
  const response = error.response;
24447
24455
  if (!response) {
24448
- throw new Error(`Failed to call Wix Site API: ${error}`);
24456
+ throw new Error(errorMessage);
24449
24457
  }
24450
24458
  return handleWixAPIResponse(response);
24451
24459
  }