@wix/mcp 1.0.85 → 1.0.86

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.
@@ -72663,6 +72663,22 @@ function renderApps(apps, knownApps) {
72663
72663
  }
72664
72664
  return lines.join("\n");
72665
72665
  }
72666
+ function sanitizeCustomAppName(raw) {
72667
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
72668
+ }
72669
+ function renderCustomAppsWithSkillsTools(apps) {
72670
+ const relevant = apps.filter((a2) => a2.appId && (a2.hasSkills || a2.hasTools)).sort(
72671
+ (a2, b) => (a2.appName ?? a2.appId ?? "").localeCompare(b.appName ?? b.appId ?? "")
72672
+ );
72673
+ if (!relevant.length) return "";
72674
+ const lines = [];
72675
+ for (const app of relevant) {
72676
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
72677
+ const name = sanitizedName || app.appId;
72678
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
72679
+ }
72680
+ return lines.join("\n");
72681
+ }
72666
72682
  function renderProperties(props) {
72667
72683
  const sections = [];
72668
72684
  const regionalFormat = [];
@@ -72725,6 +72741,15 @@ function renderSite(site, index, knownApps) {
72725
72741
  lines.push("");
72726
72742
  lines.push(appsContent);
72727
72743
  }
72744
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
72745
+ site.customApps ?? []
72746
+ );
72747
+ if (customAppsWithSkillsToolsContent) {
72748
+ lines.push("");
72749
+ lines.push("### Custom Apps with skills and tools");
72750
+ lines.push("");
72751
+ lines.push(customAppsWithSkillsToolsContent);
72752
+ }
72728
72753
  lines.push("");
72729
72754
  lines.push("---");
72730
72755
  lines.push("");
@@ -73527,7 +73552,9 @@ function getErrorMessage(error2) {
73527
73552
  }
73528
73553
  function shouldTryMenuFallbackForDocsRead(error2, articleUrl) {
73529
73554
  const message = getErrorMessage(error2);
73530
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
73555
+ const { pathname } = new URL(articleUrl);
73556
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
73557
+ if (!message.includes("404") || !isMenuFallbackUrl) {
73531
73558
  return false;
73532
73559
  }
73533
73560
  return !["This resource is deprecated", "No schema found"].some(
@@ -74180,7 +74207,7 @@ var addDocsTools = (server2, allowedTools = [
74180
74207
  content: [
74181
74208
  {
74182
74209
  type: "text",
74183
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
74210
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
74184
74211
 
74185
74212
  ${text}`
74186
74213
  }
@@ -74272,7 +74299,7 @@ ${text}`
74272
74299
  content: [
74273
74300
  {
74274
74301
  type: "text",
74275
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
74302
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
74276
74303
 
74277
74304
  ${text}`
74278
74305
  }
@@ -85350,7 +85377,25 @@ function extractText(result) {
85350
85377
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
85351
85378
  }
85352
85379
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
85353
- function formatToolResultAdditionalFields(result, extras) {
85380
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
85381
+ function getCodexTruncation(resultText, client) {
85382
+ const isCodex = [client?.name, client?.userAgent].some(
85383
+ (identity3) => identity3?.toLowerCase().includes("codex")
85384
+ );
85385
+ if (!isCodex) {
85386
+ return void 0;
85387
+ }
85388
+ const resultBytes = new TextEncoder().encode(resultText).length;
85389
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
85390
+ return void 0;
85391
+ }
85392
+ return {
85393
+ resultBytes,
85394
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
85395
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
85396
+ };
85397
+ }
85398
+ function formatToolResultAdditionalFields(result, extras, client) {
85354
85399
  const resultText = extractText(result);
85355
85400
  const contentTypes = [
85356
85401
  ...new Set(
@@ -85367,6 +85412,7 @@ function formatToolResultAdditionalFields(result, extras) {
85367
85412
  resultTextLength: resultText.length,
85368
85413
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
85369
85414
  resultContentTypes: contentTypes,
85415
+ codexTruncation: getCodexTruncation(resultText, client),
85370
85416
  ...extras
85371
85417
  });
85372
85418
  }
@@ -85545,10 +85591,17 @@ var WixMcpServer = class extends McpServer {
85545
85591
  if (!toolSucceeded) {
85546
85592
  errorBody = extractText(cbResult);
85547
85593
  } else {
85548
- additionalFields = formatToolResultAdditionalFields(cbResult, {
85549
- returnedRows: toolBiParams.returnedRows,
85550
- originalLength: toolBiParams.originalLength
85551
- });
85594
+ additionalFields = formatToolResultAdditionalFields(
85595
+ cbResult,
85596
+ {
85597
+ returnedRows: toolBiParams.returnedRows,
85598
+ originalLength: toolBiParams.originalLength
85599
+ },
85600
+ {
85601
+ name: this.getClientName?.() || this.server.getClientVersion()?.name,
85602
+ userAgent: this.getUserAgent?.()
85603
+ }
85604
+ );
85552
85605
  }
85553
85606
  if (toolSucceeded && !isDevEnvironment) {
85554
85607
  panorama.transaction(toolName).finish({ toolInvocationId });
@@ -36024,7 +36024,25 @@ function extractText(result) {
36024
36024
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
36025
36025
  }
36026
36026
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
36027
- function formatToolResultAdditionalFields(result, extras) {
36027
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
36028
+ function getCodexTruncation(resultText, client) {
36029
+ const isCodex = [client?.name, client?.userAgent].some(
36030
+ (identity) => identity?.toLowerCase().includes("codex")
36031
+ );
36032
+ if (!isCodex) {
36033
+ return void 0;
36034
+ }
36035
+ const resultBytes = new TextEncoder().encode(resultText).length;
36036
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
36037
+ return void 0;
36038
+ }
36039
+ return {
36040
+ resultBytes,
36041
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
36042
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
36043
+ };
36044
+ }
36045
+ function formatToolResultAdditionalFields(result, extras, client) {
36028
36046
  const resultText = extractText(result);
36029
36047
  const contentTypes = [
36030
36048
  ...new Set(
@@ -36041,6 +36059,7 @@ function formatToolResultAdditionalFields(result, extras) {
36041
36059
  resultTextLength: resultText.length,
36042
36060
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
36043
36061
  resultContentTypes: contentTypes,
36062
+ codexTruncation: getCodexTruncation(resultText, client),
36044
36063
  ...extras
36045
36064
  });
36046
36065
  }
@@ -36222,10 +36241,17 @@ var WixMcpServer = class extends McpServer {
36222
36241
  if (!toolSucceeded) {
36223
36242
  errorBody = extractText(cbResult);
36224
36243
  } else {
36225
- additionalFields = formatToolResultAdditionalFields(cbResult, {
36226
- returnedRows: toolBiParams.returnedRows,
36227
- originalLength: toolBiParams.originalLength
36228
- });
36244
+ additionalFields = formatToolResultAdditionalFields(
36245
+ cbResult,
36246
+ {
36247
+ returnedRows: toolBiParams.returnedRows,
36248
+ originalLength: toolBiParams.originalLength
36249
+ },
36250
+ {
36251
+ name: this.getClientName?.() || this.server.getClientVersion()?.name,
36252
+ userAgent: this.getUserAgent?.()
36253
+ }
36254
+ );
36229
36255
  }
36230
36256
  if (toolSucceeded && !isDevEnvironment) {
36231
36257
  panorama.transaction(toolName).finish({ toolInvocationId });
@@ -38283,6 +38309,22 @@ function renderApps(apps, knownApps) {
38283
38309
  }
38284
38310
  return lines.join("\n");
38285
38311
  }
38312
+ function sanitizeCustomAppName(raw) {
38313
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
38314
+ }
38315
+ function renderCustomAppsWithSkillsTools(apps) {
38316
+ const relevant = apps.filter((a2) => a2.appId && (a2.hasSkills || a2.hasTools)).sort(
38317
+ (a2, b2) => (a2.appName ?? a2.appId ?? "").localeCompare(b2.appName ?? b2.appId ?? "")
38318
+ );
38319
+ if (!relevant.length) return "";
38320
+ const lines = [];
38321
+ for (const app of relevant) {
38322
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
38323
+ const name = sanitizedName || app.appId;
38324
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
38325
+ }
38326
+ return lines.join("\n");
38327
+ }
38286
38328
  function renderProperties(props) {
38287
38329
  const sections = [];
38288
38330
  const regionalFormat = [];
@@ -38345,6 +38387,15 @@ function renderSite(site, index, knownApps) {
38345
38387
  lines.push("");
38346
38388
  lines.push(appsContent);
38347
38389
  }
38390
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
38391
+ site.customApps ?? []
38392
+ );
38393
+ if (customAppsWithSkillsToolsContent) {
38394
+ lines.push("");
38395
+ lines.push("### Custom Apps with skills and tools");
38396
+ lines.push("");
38397
+ lines.push(customAppsWithSkillsToolsContent);
38398
+ }
38348
38399
  lines.push("");
38349
38400
  lines.push("---");
38350
38401
  lines.push("");
@@ -39147,7 +39198,9 @@ function getErrorMessage(error2) {
39147
39198
  }
39148
39199
  function shouldTryMenuFallbackForDocsRead(error2, articleUrl) {
39149
39200
  const message = getErrorMessage(error2);
39150
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
39201
+ const { pathname } = new URL(articleUrl);
39202
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
39203
+ if (!message.includes("404") || !isMenuFallbackUrl) {
39151
39204
  return false;
39152
39205
  }
39153
39206
  return !["This resource is deprecated", "No schema found"].some(
@@ -39800,7 +39853,7 @@ var addDocsTools = (server, allowedTools = [
39800
39853
  content: [
39801
39854
  {
39802
39855
  type: "text",
39803
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
39856
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
39804
39857
 
39805
39858
  ${text}`
39806
39859
  }
@@ -39892,7 +39945,7 @@ ${text}`
39892
39945
  content: [
39893
39946
  {
39894
39947
  type: "text",
39895
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
39948
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
39896
39949
 
39897
39950
  ${text}`
39898
39951
  }
@@ -53396,10 +53449,14 @@ function createWixToolkit(options) {
53396
53449
  if (!toolSucceeded) {
53397
53450
  errorBody = extractText(cbResult);
53398
53451
  } else {
53399
- additionalFields = formatToolResultAdditionalFields(cbResult, {
53400
- returnedRows: toolBiParams.returnedRows,
53401
- originalLength: toolBiParams.originalLength
53402
- });
53452
+ additionalFields = formatToolResultAdditionalFields(
53453
+ cbResult,
53454
+ {
53455
+ returnedRows: toolBiParams.returnedRows,
53456
+ originalLength: toolBiParams.originalLength
53457
+ },
53458
+ { name: clientName }
53459
+ );
53403
53460
  }
53404
53461
  if (!isDevEnvironment) {
53405
53462
  if (toolSucceeded) {
@@ -18804,6 +18804,22 @@ function renderApps(apps, knownApps) {
18804
18804
  }
18805
18805
  return lines.join("\n");
18806
18806
  }
18807
+ function sanitizeCustomAppName(raw) {
18808
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
18809
+ }
18810
+ function renderCustomAppsWithSkillsTools(apps) {
18811
+ const relevant = apps.filter((a) => a.appId && (a.hasSkills || a.hasTools)).sort(
18812
+ (a, b) => (a.appName ?? a.appId ?? "").localeCompare(b.appName ?? b.appId ?? "")
18813
+ );
18814
+ if (!relevant.length) return "";
18815
+ const lines = [];
18816
+ for (const app of relevant) {
18817
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
18818
+ const name = sanitizedName || app.appId;
18819
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
18820
+ }
18821
+ return lines.join("\n");
18822
+ }
18807
18823
  function renderProperties(props) {
18808
18824
  const sections = [];
18809
18825
  const regionalFormat = [];
@@ -18866,6 +18882,15 @@ function renderSite(site, index, knownApps) {
18866
18882
  lines.push("");
18867
18883
  lines.push(appsContent);
18868
18884
  }
18885
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
18886
+ site.customApps ?? []
18887
+ );
18888
+ if (customAppsWithSkillsToolsContent) {
18889
+ lines.push("");
18890
+ lines.push("### Custom Apps with skills and tools");
18891
+ lines.push("");
18892
+ lines.push(customAppsWithSkillsToolsContent);
18893
+ }
18869
18894
  lines.push("");
18870
18895
  lines.push("---");
18871
18896
  lines.push("");
@@ -19657,7 +19682,9 @@ function getErrorMessage(error) {
19657
19682
  }
19658
19683
  function shouldTryMenuFallbackForDocsRead(error, articleUrl) {
19659
19684
  const message = getErrorMessage(error);
19660
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
19685
+ const { pathname } = new URL(articleUrl);
19686
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
19687
+ if (!message.includes("404") || !isMenuFallbackUrl) {
19661
19688
  return false;
19662
19689
  }
19663
19690
  return !["This resource is deprecated", "No schema found"].some(
@@ -20310,7 +20337,7 @@ var addDocsTools = (server, allowedTools = [
20310
20337
  content: [
20311
20338
  {
20312
20339
  type: "text",
20313
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
20340
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
20314
20341
 
20315
20342
  ${text}`
20316
20343
  }
@@ -20402,7 +20429,7 @@ ${text}`
20402
20429
  content: [
20403
20430
  {
20404
20431
  type: "text",
20405
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
20432
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
20406
20433
 
20407
20434
  ${text}`
20408
20435
  }
@@ -22395,7 +22422,25 @@ function extractText(result) {
22395
22422
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
22396
22423
  }
22397
22424
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
22398
- function formatToolResultAdditionalFields(result, extras) {
22425
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
22426
+ function getCodexTruncation(resultText, client) {
22427
+ const isCodex = [client?.name, client?.userAgent].some(
22428
+ (identity) => identity?.toLowerCase().includes("codex")
22429
+ );
22430
+ if (!isCodex) {
22431
+ return void 0;
22432
+ }
22433
+ const resultBytes = new TextEncoder().encode(resultText).length;
22434
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
22435
+ return void 0;
22436
+ }
22437
+ return {
22438
+ resultBytes,
22439
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
22440
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
22441
+ };
22442
+ }
22443
+ function formatToolResultAdditionalFields(result, extras, client) {
22399
22444
  const resultText = extractText(result);
22400
22445
  const contentTypes = [
22401
22446
  ...new Set(
@@ -22412,6 +22457,7 @@ function formatToolResultAdditionalFields(result, extras) {
22412
22457
  resultTextLength: resultText.length,
22413
22458
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
22414
22459
  resultContentTypes: contentTypes,
22460
+ codexTruncation: getCodexTruncation(resultText, client),
22415
22461
  ...extras
22416
22462
  });
22417
22463
  }
@@ -22667,10 +22713,14 @@ function createWixToolkit(options) {
22667
22713
  if (!toolSucceeded) {
22668
22714
  errorBody = extractText(cbResult);
22669
22715
  } else {
22670
- additionalFields = formatToolResultAdditionalFields(cbResult, {
22671
- returnedRows: toolBiParams.returnedRows,
22672
- originalLength: toolBiParams.originalLength
22673
- });
22716
+ additionalFields = formatToolResultAdditionalFields(
22717
+ cbResult,
22718
+ {
22719
+ returnedRows: toolBiParams.returnedRows,
22720
+ originalLength: toolBiParams.originalLength
22721
+ },
22722
+ { name: clientName }
22723
+ );
22674
22724
  }
22675
22725
  if (!isDevEnvironment) {
22676
22726
  if (toolSucceeded) {
@@ -47,7 +47,9 @@ function getErrorMessage(error) {
47
47
  }
48
48
  function shouldTryMenuFallbackForDocsRead(error, articleUrl) {
49
49
  const message = getErrorMessage(error);
50
- if (!message.includes('404') || !articleUrl.includes('/api-reference/')) {
50
+ const { pathname } = new URL(articleUrl);
51
+ const isMenuFallbackUrl = articleUrl.includes('/api-reference/') || pathname.startsWith('/docs/velo');
52
+ if (!message.includes('404') || !isMenuFallbackUrl) {
51
53
  return false;
52
54
  }
53
55
  return !['This resource is deprecated', 'No schema found'].some((knownArticleError) => message.includes(knownArticleError));
@@ -671,7 +673,7 @@ export const addDocsTools = (server, allowedTools = [
671
673
  content: [
672
674
  {
673
675
  type: 'text',
674
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.\n\n${text}`
676
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.\n\n${text}`
675
677
  }
676
678
  ]
677
679
  };
@@ -746,7 +748,7 @@ export const addDocsTools = (server, allowedTools = [
746
748
  content: [
747
749
  {
748
750
  type: 'text',
749
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.\n\n${text}`
751
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.\n\n${text}`
750
752
  }
751
753
  ]
752
754
  };
@@ -6,7 +6,11 @@ import { wixMcpRequestSrc39Evid1607, executeWixApiToolRequestSrc39Evid1612 } fro
6
6
  * and concatenates text blocks with newlines.
7
7
  */
8
8
  export declare function extractText(result: WixToolCallResult): string;
9
- export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>): string | undefined;
9
+ export interface ToolResultClient {
10
+ name?: string;
11
+ userAgent?: string;
12
+ }
13
+ export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>, client?: ToolResultClient): string | undefined;
10
14
  export declare function createToolBiEvent(params: Parameters<typeof wixMcpRequestSrc39Evid1607>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").wixMcpRequestSrc39Evid1607Params>;
11
15
  export declare function createExecuteWixAPICallToolBiEvent(params: Parameters<typeof executeWixApiToolRequestSrc39Evid1612>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").executeWixApiToolRequestSrc39Evid1612Params>;
12
16
  //# sourceMappingURL=tool-bi.d.ts.map
@@ -11,7 +11,27 @@ export function extractText(result) {
11
11
  .join('\n');
12
12
  }
13
13
  const TOOL_RESULT_PREVIEW_MAX_CHARS = 4000;
14
- export function formatToolResultAdditionalFields(result, extras) {
14
+ // Codex keeps 10,000 tokens of a tool result by default, estimated at 4 bytes
15
+ // per token, and drops the middle of anything longer.
16
+ const CODEX_OUTPUT_BUDGET_BYTES = 40_000;
17
+ // Predicted from the default budget: a user who raised Codex's
18
+ // tool_output_token_limit is flagged here but not actually truncated.
19
+ function getCodexTruncation(resultText, client) {
20
+ const isCodex = [client?.name, client?.userAgent].some((identity) => identity?.toLowerCase().includes('codex'));
21
+ if (!isCodex) {
22
+ return undefined;
23
+ }
24
+ const resultBytes = new TextEncoder().encode(resultText).length;
25
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
26
+ return undefined;
27
+ }
28
+ return {
29
+ resultBytes,
30
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
31
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
32
+ };
33
+ }
34
+ export function formatToolResultAdditionalFields(result, extras, client) {
15
35
  const resultText = extractText(result);
16
36
  const contentTypes = [
17
37
  ...new Set(result.content?.map((content) => content.type) ?? [])
@@ -24,6 +44,7 @@ export function formatToolResultAdditionalFields(result, extras) {
24
44
  resultTextLength: resultText.length,
25
45
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
26
46
  resultContentTypes: contentTypes,
47
+ codexTruncation: getCodexTruncation(resultText, client),
27
48
  ...extras
28
49
  });
29
50
  }
@@ -175,7 +175,11 @@ export type CodeModeFetch = (url: string, init: RequestInit) => Promise<Response
175
175
  * and concatenates text blocks with newlines.
176
176
  */
177
177
  export declare function extractText(result: WixToolCallResult): string;
178
- export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>): string | undefined;
178
+ export interface ToolResultClient {
179
+ name?: string;
180
+ userAgent?: string;
181
+ }
182
+ export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>, client?: ToolResultClient): string | undefined;
179
183
  /** A single tool extracted from @wix/mcp, ready to execute. */
180
184
  export interface WixTool {
181
185
  /** Tool name (e.g. 'CallWixSiteAPI', 'SearchWixRESTDocumentation') */
@@ -175,7 +175,11 @@ export type CodeModeFetch = (url: string, init: RequestInit) => Promise<Response
175
175
  * and concatenates text blocks with newlines.
176
176
  */
177
177
  export declare function extractText(result: WixToolCallResult): string;
178
- export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>): string | undefined;
178
+ export interface ToolResultClient {
179
+ name?: string;
180
+ userAgent?: string;
181
+ }
182
+ export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>, client?: ToolResultClient): string | undefined;
179
183
  /** A single tool extracted from @wix/mcp, ready to execute. */
180
184
  export interface WixTool {
181
185
  /** Tool name (e.g. 'CallWixSiteAPI', 'SearchWixRESTDocumentation') */
@@ -319,7 +319,7 @@ export function createWixToolkit(options) {
319
319
  additionalFields = formatToolResultAdditionalFields(cbResult, {
320
320
  returnedRows: toolBiParams.returnedRows,
321
321
  originalLength: toolBiParams.originalLength
322
- });
322
+ }, { name: clientName });
323
323
  }
324
324
  // Panorama: finish or report error
325
325
  if (!isDevEnvironment) {
@@ -183,6 +183,9 @@ export class WixMcpServer extends McpServer {
183
183
  additionalFields = formatToolResultAdditionalFields(cbResult, {
184
184
  returnedRows: toolBiParams.returnedRows,
185
185
  originalLength: toolBiParams.originalLength
186
+ }, {
187
+ name: this.getClientName?.() || this.server.getClientVersion()?.name,
188
+ userAgent: this.getUserAgent?.()
186
189
  });
187
190
  }
188
191
  if (toolSucceeded && !isDevEnvironment) {
@@ -29740,7 +29740,25 @@ function extractText(result) {
29740
29740
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
29741
29741
  }
29742
29742
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
29743
- function formatToolResultAdditionalFields(result, extras) {
29743
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
29744
+ function getCodexTruncation(resultText, client) {
29745
+ const isCodex = [client?.name, client?.userAgent].some(
29746
+ (identity) => identity?.toLowerCase().includes("codex")
29747
+ );
29748
+ if (!isCodex) {
29749
+ return void 0;
29750
+ }
29751
+ const resultBytes = new TextEncoder().encode(resultText).length;
29752
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
29753
+ return void 0;
29754
+ }
29755
+ return {
29756
+ resultBytes,
29757
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
29758
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
29759
+ };
29760
+ }
29761
+ function formatToolResultAdditionalFields(result, extras, client) {
29744
29762
  const resultText = extractText(result);
29745
29763
  const contentTypes = [
29746
29764
  ...new Set(
@@ -29757,6 +29775,7 @@ function formatToolResultAdditionalFields(result, extras) {
29757
29775
  resultTextLength: resultText.length,
29758
29776
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
29759
29777
  resultContentTypes: contentTypes,
29778
+ codexTruncation: getCodexTruncation(resultText, client),
29760
29779
  ...extras
29761
29780
  });
29762
29781
  }
@@ -29938,10 +29957,17 @@ var WixMcpServer = class extends McpServer {
29938
29957
  if (!toolSucceeded) {
29939
29958
  errorBody = extractText(cbResult);
29940
29959
  } else {
29941
- additionalFields = formatToolResultAdditionalFields(cbResult, {
29942
- returnedRows: toolBiParams.returnedRows,
29943
- originalLength: toolBiParams.originalLength
29944
- });
29960
+ additionalFields = formatToolResultAdditionalFields(
29961
+ cbResult,
29962
+ {
29963
+ returnedRows: toolBiParams.returnedRows,
29964
+ originalLength: toolBiParams.originalLength
29965
+ },
29966
+ {
29967
+ name: this.getClientName?.() || this.server.getClientVersion()?.name,
29968
+ userAgent: this.getUserAgent?.()
29969
+ }
29970
+ );
29945
29971
  }
29946
29972
  if (toolSucceeded && !isDevEnvironment) {
29947
29973
  panorama.transaction(toolName).finish({ toolInvocationId });
@@ -31996,6 +32022,22 @@ function renderApps(apps, knownApps) {
31996
32022
  }
31997
32023
  return lines.join("\n");
31998
32024
  }
32025
+ function sanitizeCustomAppName(raw) {
32026
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
32027
+ }
32028
+ function renderCustomAppsWithSkillsTools(apps) {
32029
+ const relevant = apps.filter((a2) => a2.appId && (a2.hasSkills || a2.hasTools)).sort(
32030
+ (a2, b2) => (a2.appName ?? a2.appId ?? "").localeCompare(b2.appName ?? b2.appId ?? "")
32031
+ );
32032
+ if (!relevant.length) return "";
32033
+ const lines = [];
32034
+ for (const app of relevant) {
32035
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
32036
+ const name = sanitizedName || app.appId;
32037
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
32038
+ }
32039
+ return lines.join("\n");
32040
+ }
31999
32041
  function renderProperties(props) {
32000
32042
  const sections = [];
32001
32043
  const regionalFormat = [];
@@ -32058,6 +32100,15 @@ function renderSite(site, index, knownApps) {
32058
32100
  lines.push("");
32059
32101
  lines.push(appsContent);
32060
32102
  }
32103
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
32104
+ site.customApps ?? []
32105
+ );
32106
+ if (customAppsWithSkillsToolsContent) {
32107
+ lines.push("");
32108
+ lines.push("### Custom Apps with skills and tools");
32109
+ lines.push("");
32110
+ lines.push(customAppsWithSkillsToolsContent);
32111
+ }
32061
32112
  lines.push("");
32062
32113
  lines.push("---");
32063
32114
  lines.push("");
@@ -32860,7 +32911,9 @@ function getErrorMessage(error2) {
32860
32911
  }
32861
32912
  function shouldTryMenuFallbackForDocsRead(error2, articleUrl) {
32862
32913
  const message = getErrorMessage(error2);
32863
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
32914
+ const { pathname } = new URL(articleUrl);
32915
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
32916
+ if (!message.includes("404") || !isMenuFallbackUrl) {
32864
32917
  return false;
32865
32918
  }
32866
32919
  return !["This resource is deprecated", "No schema found"].some(
@@ -33513,7 +33566,7 @@ var addDocsTools = (server, allowedTools = [
33513
33566
  content: [
33514
33567
  {
33515
33568
  type: "text",
33516
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
33569
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
33517
33570
 
33518
33571
  ${text}`
33519
33572
  }
@@ -33605,7 +33658,7 @@ ${text}`
33605
33658
  content: [
33606
33659
  {
33607
33660
  type: "text",
33608
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
33661
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
33609
33662
 
33610
33663
  ${text}`
33611
33664
  }
@@ -47160,10 +47213,14 @@ function createWixToolkit(options) {
47160
47213
  if (!toolSucceeded) {
47161
47214
  errorBody = extractText(cbResult);
47162
47215
  } else {
47163
- additionalFields = formatToolResultAdditionalFields(cbResult, {
47164
- returnedRows: toolBiParams.returnedRows,
47165
- originalLength: toolBiParams.originalLength
47166
- });
47216
+ additionalFields = formatToolResultAdditionalFields(
47217
+ cbResult,
47218
+ {
47219
+ returnedRows: toolBiParams.returnedRows,
47220
+ originalLength: toolBiParams.originalLength
47221
+ },
47222
+ { name: clientName }
47223
+ );
47167
47224
  }
47168
47225
  if (!isDevEnvironment) {
47169
47226
  if (toolSucceeded) {
@@ -13226,6 +13226,22 @@ function renderApps(apps, knownApps) {
13226
13226
  }
13227
13227
  return lines.join("\n");
13228
13228
  }
13229
+ function sanitizeCustomAppName(raw) {
13230
+ return raw.replace(/[\x00-\x1f\x7f]/g, " ").replace(/[`*_[\]|<>]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);
13231
+ }
13232
+ function renderCustomAppsWithSkillsTools(apps) {
13233
+ const relevant = apps.filter((a) => a.appId && (a.hasSkills || a.hasTools)).sort(
13234
+ (a, b) => (a.appName ?? a.appId ?? "").localeCompare(b.appName ?? b.appId ?? "")
13235
+ );
13236
+ if (!relevant.length) return "";
13237
+ const lines = [];
13238
+ for (const app of relevant) {
13239
+ const sanitizedName = app.appName ? sanitizeCustomAppName(app.appName) : "";
13240
+ const name = sanitizedName || app.appId;
13241
+ lines.push(`- \`${name}\` (ID: \`${app.appId}\`)`);
13242
+ }
13243
+ return lines.join("\n");
13244
+ }
13229
13245
  function renderProperties(props) {
13230
13246
  const sections = [];
13231
13247
  const regionalFormat = [];
@@ -13288,6 +13304,15 @@ function renderSite(site, index, knownApps) {
13288
13304
  lines.push("");
13289
13305
  lines.push(appsContent);
13290
13306
  }
13307
+ const customAppsWithSkillsToolsContent = renderCustomAppsWithSkillsTools(
13308
+ site.customApps ?? []
13309
+ );
13310
+ if (customAppsWithSkillsToolsContent) {
13311
+ lines.push("");
13312
+ lines.push("### Custom Apps with skills and tools");
13313
+ lines.push("");
13314
+ lines.push(customAppsWithSkillsToolsContent);
13315
+ }
13291
13316
  lines.push("");
13292
13317
  lines.push("---");
13293
13318
  lines.push("");
@@ -14079,7 +14104,9 @@ function getErrorMessage(error) {
14079
14104
  }
14080
14105
  function shouldTryMenuFallbackForDocsRead(error, articleUrl) {
14081
14106
  const message = getErrorMessage(error);
14082
- if (!message.includes("404") || !articleUrl.includes("/api-reference/")) {
14107
+ const { pathname } = new URL(articleUrl);
14108
+ const isMenuFallbackUrl = articleUrl.includes("/api-reference/") || pathname.startsWith("/docs/velo");
14109
+ if (!message.includes("404") || !isMenuFallbackUrl) {
14083
14110
  return false;
14084
14111
  }
14085
14112
  return !["This resource is deprecated", "No schema found"].some(
@@ -14732,7 +14759,7 @@ var addDocsTools = (server, allowedTools = [
14732
14759
  content: [
14733
14760
  {
14734
14761
  type: "text",
14735
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14762
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14736
14763
 
14737
14764
  ${text}`
14738
14765
  }
@@ -14824,7 +14851,7 @@ ${text}`
14824
14851
  content: [
14825
14852
  {
14826
14853
  type: "text",
14827
- text: `Note: "${articleUrl}" is a documentation category, not an article. Showing its menu contents below. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14854
+ text: `Note: "${articleUrl}" is not an article. Showing the closest documentation menu below; read the article you need from its links. For category URLs, use BrowseWixRESTDocsMenu directly next time.
14828
14855
 
14829
14856
  ${text}`
14830
14857
  }
@@ -18566,7 +18593,25 @@ function extractText(result) {
18566
18593
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
18567
18594
  }
18568
18595
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
18569
- function formatToolResultAdditionalFields(result, extras) {
18596
+ var CODEX_OUTPUT_BUDGET_BYTES = 4e4;
18597
+ function getCodexTruncation(resultText, client) {
18598
+ const isCodex = [client?.name, client?.userAgent].some(
18599
+ (identity) => identity?.toLowerCase().includes("codex")
18600
+ );
18601
+ if (!isCodex) {
18602
+ return void 0;
18603
+ }
18604
+ const resultBytes = new TextEncoder().encode(resultText).length;
18605
+ if (resultBytes <= CODEX_OUTPUT_BUDGET_BYTES) {
18606
+ return void 0;
18607
+ }
18608
+ return {
18609
+ resultBytes,
18610
+ budgetBytes: CODEX_OUTPUT_BUDGET_BYTES,
18611
+ truncatedBytes: resultBytes - CODEX_OUTPUT_BUDGET_BYTES
18612
+ };
18613
+ }
18614
+ function formatToolResultAdditionalFields(result, extras, client) {
18570
18615
  const resultText = extractText(result);
18571
18616
  const contentTypes = [
18572
18617
  ...new Set(
@@ -18583,6 +18628,7 @@ function formatToolResultAdditionalFields(result, extras) {
18583
18628
  resultTextLength: resultText.length,
18584
18629
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
18585
18630
  resultContentTypes: contentTypes,
18631
+ codexTruncation: getCodexTruncation(resultText, client),
18586
18632
  ...extras
18587
18633
  });
18588
18634
  }
@@ -18838,10 +18884,14 @@ function createWixToolkit(options) {
18838
18884
  if (!toolSucceeded) {
18839
18885
  errorBody = extractText(cbResult);
18840
18886
  } else {
18841
- additionalFields = formatToolResultAdditionalFields(cbResult, {
18842
- returnedRows: toolBiParams.returnedRows,
18843
- originalLength: toolBiParams.originalLength
18844
- });
18887
+ additionalFields = formatToolResultAdditionalFields(
18888
+ cbResult,
18889
+ {
18890
+ returnedRows: toolBiParams.returnedRows,
18891
+ originalLength: toolBiParams.originalLength
18892
+ },
18893
+ { name: clientName }
18894
+ );
18845
18895
  }
18846
18896
  if (!isDevEnvironment) {
18847
18897
  if (toolSucceeded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.85",
3
+ "version": "1.0.86",
4
4
  "description": "A Model Context Protocol server for Wix AI tools",
5
5
  "bin": "./build/bin-standalone.js",
6
6
  "dependencies": {
@@ -43,7 +43,7 @@
43
43
  "@wix/bi-logger-wix-code-data": "^1.485.0",
44
44
  "@wix/common-widget-types": "^1.77.0",
45
45
  "@wix/design-system": "^1.256.2",
46
- "@wix/dynamic-context-enricher": "0.1.3",
46
+ "@wix/dynamic-context-enricher": "0.1.4",
47
47
  "@wix/http-client": "^2.85.0",
48
48
  "@wix/panorama-client-node": "^3.253.0",
49
49
  "@wix/standalone-node-bi-logger": "^1.7.24",
@@ -133,5 +133,5 @@
133
133
  ]
134
134
  }
135
135
  },
136
- "falconPackageHash": "fa4f66edf0696bfeabc3430c4fc334d1b036704c758c5d5c65aa2b60"
136
+ "falconPackageHash": "bfa0ad2bd45ba9e54844e736741354d379ec2790f92872287c5fc1d2"
137
137
  }