@wix/mcp 1.0.31 → 1.0.32

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 (33) hide show
  1. package/build/bin-standalone.js +65 -19
  2. package/build/bin-standalone.js.map +3 -3
  3. package/build/cjs/index.cjs +350 -23
  4. package/build/cjs/index.cjs.map +4 -4
  5. package/build/dts/bin.js +3 -1
  6. package/build/dts/bin.js.map +1 -1
  7. package/build/dts/config/default-config.d.ts +1 -0
  8. package/build/dts/config/default-config.d.ts.map +1 -1
  9. package/build/dts/config/default-config.js +27 -4
  10. package/build/dts/config/default-config.js.map +1 -1
  11. package/build/dts/docs/docs.d.ts +2 -0
  12. package/build/dts/docs/docs.d.ts.map +1 -1
  13. package/build/dts/docs/docs.js +10 -2
  14. package/build/dts/docs/docs.js.map +1 -1
  15. package/build/dts/docs/get-to-know.d.ts +12 -1
  16. package/build/dts/docs/get-to-know.d.ts.map +1 -1
  17. package/build/dts/docs/get-to-know.js +20 -8
  18. package/build/dts/docs/get-to-know.js.map +1 -1
  19. package/build/dts/docs/get-to-know.test.d.ts +2 -0
  20. package/build/dts/docs/get-to-know.test.d.ts.map +1 -0
  21. package/build/dts/docs/get-to-know.test.js +89 -0
  22. package/build/dts/docs/get-to-know.test.js.map +1 -0
  23. package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +4 -0
  24. package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -1
  25. package/build/dts/site-widget-tools/site-builder-tool/index.js +22 -1
  26. package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
  27. package/build/dts/toolkit.d.ts +11 -2
  28. package/build/dts/toolkit.d.ts.map +1 -1
  29. package/build/dts/toolkit.js +15 -3
  30. package/build/dts/toolkit.js.map +1 -1
  31. package/build/esm/index.js +346 -19
  32. package/build/esm/index.js.map +4 -4
  33. package/package.json +3 -2
@@ -15697,9 +15697,9 @@ var require_dist4 = __commonJS({
15697
15697
  }
15698
15698
  });
15699
15699
 
15700
- // ../../node_modules/@wix/http-client/node_modules/https-proxy-agent/dist/parse-proxy-response.js
15700
+ // ../../node_modules/https-proxy-agent/dist/parse-proxy-response.js
15701
15701
  var require_parse_proxy_response = __commonJS({
15702
- "../../node_modules/@wix/http-client/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
15702
+ "../../node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
15703
15703
  "use strict";
15704
15704
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
15705
15705
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -15793,9 +15793,9 @@ var require_parse_proxy_response = __commonJS({
15793
15793
  }
15794
15794
  });
15795
15795
 
15796
- // ../../node_modules/@wix/http-client/node_modules/https-proxy-agent/dist/index.js
15796
+ // ../../node_modules/https-proxy-agent/dist/index.js
15797
15797
  var require_dist5 = __commonJS({
15798
- "../../node_modules/@wix/http-client/node_modules/https-proxy-agent/dist/index.js"(exports2) {
15798
+ "../../node_modules/https-proxy-agent/dist/index.js"(exports2) {
15799
15799
  "use strict";
15800
15800
  var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
15801
15801
  if (k2 === void 0) k2 = k;
@@ -34564,6 +34564,8 @@ var SYSTEM_REMINDER = dedent_default`
34564
34564
  </goal>
34565
34565
  <guidelines>
34566
34566
  if the WixREADME tool is available to you, YOU MUST USE IT AT THE BEGINNING OF ANY CONVERSATION and then continue with calling the other tools and calling the Wix APIs until the task is completed.
34567
+ **Exception:** If the user asks to create, build, or generate a new Wix site/website, skip WixREADME and call WixSiteBuilder directly if it is available.
34568
+ **Exception:** If the user asks to list, show, or find their Wix sites, skip WixREADME and call ListWixSites directly.
34567
34569
  If the WixREADME tool is not available to you, you should use the other flows as described without using the WixREADME tool until the task is completed.
34568
34570
  If the user prompt / task is an instruction to do something in Wix, You should not tell the user what Docs to read or what API to call, your task is to do the work and complete the task in minimal steps and time with minimal back and forth with the user, unless absolutely necessary.
34569
34571
  </guidelines>
@@ -34606,6 +34608,7 @@ var defaultToolDescriptions = {
34606
34608
  `,
34607
34609
  CallWixSiteAPI: dedent_default`
34608
34610
  Call Wix apis on a business or site. Use this to create, read, update, and delete data and other Wix entities in your Wix site.
34611
+ **Prefer using the "ListWixSites" tool when the user asks to list or show their sites.** Only use this tool for site listing if the user needs advanced filtering or specific site details beyond what ListWixSites provides.
34609
34612
  For POST/PATCH/PUT requests, pass the request body as a JSON object in the "body" parameter with all the required fields and values as described in the API schema, code examples, or docs you retrieved (e.g. body: {"name": "value", "nested": {"key": "value"}}).
34610
34613
  The API endpoint url param MUST ALWAYS be taken from the conversation context.
34611
34614
  By conversation context we mean the endpoint url was given in the user prompt OR got into the conversation context by the "WixREADME" tool OR by the "SearchWixRESTDocumentation" tool OR by the "BrowseWixRESTDocsMenu" tool OR by the "ReadFullDocsArticle" tool.
@@ -34618,7 +34621,11 @@ var defaultToolDescriptions = {
34618
34621
  ${SYSTEM_REMINDER}
34619
34622
  `,
34620
34623
  ListWixSites: dedent_default`
34621
- List Wix sites for the current user, by default it will return all sites, but you can filter by name
34624
+ **Use this tool whenever the user asks to list, show, get, or find their Wix sites.** This is the dedicated tool for listing Wix sites for the current user. By default it returns all sites, but you can filter by name.
34625
+
34626
+ **Do NOT use WixREADME before this tool.** When the user asks to list their sites, call this tool directly — no need to read documentation first.
34627
+
34628
+ **Prefer this tool over CallWixSiteAPI for listing sites.** Call this tool directly — it already knows the correct API and handles everything needed. Only fall back to CallWixSiteAPI if the user needs advanced filtering or specific site details beyond what this tool provides.
34622
34629
  ${SYSTEM_REMINDER}
34623
34630
  `,
34624
34631
  ManageWixSite: dedent_default`
@@ -34660,6 +34667,15 @@ var defaultToolDescriptions = {
34660
34667
  - Site Properties: "https://dev.wix.com/docs/api-reference/business-management/site-properties"
34661
34668
  ${SYSTEM_REMINDER}
34662
34669
  `,
34670
+ WixSiteBuilder: dedent_default`
34671
+ **PRIMARY tool for creating/building/generating a Wix site or website.** This is the preferred and recommended way to create a new Wix site. Use this tool whenever the user asks to build, create, or generate a site/website/application. Do NOT use CreateWixBusinessGuide for site creation — use this tool instead.
34672
+
34673
+ **Do NOT use WixREADME or SearchWixRESTDocumentation before this tool.** When the user asks to build, create, or generate a site, call this tool directly. It handles everything needed for site creation.
34674
+
34675
+ **IMPORTANT: You MUST call this tool to build the site.** Do NOT suggest HTML code, prompt templates, or alternative approaches instead of actually building the site. When a user asks to create a site, your job is to call this tool and build it — not to describe how to build it or suggest alternatives.
34676
+
34677
+ **IMPORTANT: The sitePrompt must be under 6000 characters.** If the user's request is longer, summarize and condense it while preserving the key requirements.
34678
+ `,
34663
34679
  CreateWixBusinessGuide: dedent_default`
34664
34680
  Provides comprehensive documentation for creating a new Wix Business (i.e site, app, etc.)
34665
34681
 
@@ -34955,7 +34971,12 @@ var defaultReadmeDocs = [
34955
34971
 
34956
34972
  <flow-description>
34957
34973
  Wix MCP Site Management Flows:
34958
-
34974
+
34975
+ Site Creation flow (highest priority for site creation requests):
34976
+ 1. User asks to create, build, or generate a Wix site/website,
34977
+ 2. Call the "WixSiteBuilder" tool directly with the user's prompt. Do NOT call WixREADME first.
34978
+ 3. Do NOT suggest HTML code or alternative approaches — actually build the site.
34979
+
34959
34980
  "Recipe" based flow (The most preferred flow):
34960
34981
  1. User asks you to do something,
34961
34982
  2. You use the "WixREADME" tool to get the context, it will return a list of "recipes" which are essentially Wix docs articles that describe how to do something in Wix.
@@ -35024,7 +35045,8 @@ function mergeConfig(base, overrides) {
35024
35045
  getToKnowWixEnabled: overrides.getToKnowWixEnabled ?? base.getToKnowWixEnabled,
35025
35046
  createWixBusinessGuideEnabled: overrides.createWixBusinessGuideEnabled ?? base.createWixBusinessGuideEnabled,
35026
35047
  codeModeEnabled: overrides.codeModeEnabled ?? base.codeModeEnabled,
35027
- maxResponseSize: overrides.maxResponseSize ?? base.maxResponseSize
35048
+ maxResponseSize: overrides.maxResponseSize ?? base.maxResponseSize,
35049
+ dynamicContextEnabled: overrides.dynamicContextEnabled ?? base.dynamicContextEnabled
35028
35050
  };
35029
35051
  }
35030
35052
  var defaultConfig = {
@@ -35034,11 +35056,271 @@ var defaultConfig = {
35034
35056
  readmeDocs: defaultReadmeDocs,
35035
35057
  // docsTools not set - defaults to all docs tools in addDocsTools()
35036
35058
  getToKnowWixEnabled: true,
35037
- createWixBusinessGuideEnabled: true
35059
+ createWixBusinessGuideEnabled: true,
35060
+ dynamicContextEnabled: true
35061
+ };
35062
+
35063
+ // ../dynamic-context-enricher/build/index.mjs
35064
+ var __defProp2 = Object.defineProperty;
35065
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
35066
+ var __esm2 = (fn, res) => function __init() {
35067
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
35038
35068
  };
35069
+ var __export2 = (target, all) => {
35070
+ for (var name in all)
35071
+ __defProp2(target, name, { get: all[name], enumerable: true });
35072
+ };
35073
+ var enrich_exports = {};
35074
+ __export2(enrich_exports, {
35075
+ enrichDynamicContext: () => enrichDynamicContext
35076
+ });
35077
+ function snakeToCamel(obj) {
35078
+ if (Array.isArray(obj)) return obj.map(snakeToCamel);
35079
+ if (obj !== null && typeof obj === "object") {
35080
+ const result = {};
35081
+ for (const [key, value] of Object.entries(obj)) {
35082
+ const camelKey = key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
35083
+ result[camelKey] = snakeToCamel(value);
35084
+ }
35085
+ return result;
35086
+ }
35087
+ return obj;
35088
+ }
35089
+ function formatTimestamp(value) {
35090
+ if (!value) return "";
35091
+ try {
35092
+ const date3 = new Date(value);
35093
+ return date3.toLocaleDateString("en-US", {
35094
+ month: "short",
35095
+ day: "2-digit",
35096
+ year: "numeric",
35097
+ hour: "2-digit",
35098
+ minute: "2-digit",
35099
+ hour12: false,
35100
+ timeZone: "UTC"
35101
+ });
35102
+ } catch {
35103
+ return value;
35104
+ }
35105
+ }
35106
+ function capitalize(s) {
35107
+ if (!s) return s;
35108
+ return s.charAt(0).toUpperCase() + s.slice(1);
35109
+ }
35110
+ function renderAccountHeader(account) {
35111
+ const lines = [];
35112
+ if (account.displayName) {
35113
+ lines.push(`**Account**: ${account.displayName}`);
35114
+ }
35115
+ if (account.id) {
35116
+ lines.push(`**Account ID**: \`${account.id}\``);
35117
+ }
35118
+ const meta = [];
35119
+ if (account.status) meta.push(`Status: **${account.status}**`);
35120
+ if (account.coBranding && account.coBranding !== "None" && account.coBranding !== "CO_BRANDING_UNSPECIFIED") {
35121
+ meta.push("Co-branded");
35122
+ }
35123
+ if (meta.length) lines.push(meta.join(" \xB7 "));
35124
+ if (account.createdDate) {
35125
+ let dateLine = `**Created**: ${formatTimestamp(account.createdDate)}`;
35126
+ if (account.updatedDate) {
35127
+ dateLine += ` \xB7 **Updated**: ${formatTimestamp(account.updatedDate)}`;
35128
+ }
35129
+ lines.push(dateLine);
35130
+ }
35131
+ return lines.length ? lines.join("\n") : "";
35132
+ }
35133
+ function renderStatusBadges(site) {
35134
+ const tags = [];
35135
+ tags.push(site.published ? "Published" : "Draft");
35136
+ if (site.premium) tags.push("Premium");
35137
+ if (site.domainConnected) tags.push("Custom Domain");
35138
+ if (site.editorType && site.editorType !== "EDITOR_TYPE_UNSPECIFIED" && site.editorType !== "UNKNOWN") {
35139
+ tags.push(capitalize(site.editorType.replace(/_/g, " ").toLowerCase()));
35140
+ }
35141
+ return tags.join(" \xB7 ");
35142
+ }
35143
+ function renderApps(apps) {
35144
+ const relevant = apps.filter((a) => a.appId && KNOWN_APPS[a.appId]).sort(
35145
+ (a, b) => (KNOWN_APPS[a.appId] ?? "").localeCompare(KNOWN_APPS[b.appId] ?? "")
35146
+ );
35147
+ if (!relevant.length) return "";
35148
+ const lines = [];
35149
+ for (const app of relevant) {
35150
+ let line = `- **${KNOWN_APPS[app.appId]}**`;
35151
+ if (app.catalogVersion) {
35152
+ line += ` \u2014 catalog: **${app.catalogVersion}**`;
35153
+ }
35154
+ lines.push(line);
35155
+ }
35156
+ return lines.join("\n");
35157
+ }
35158
+ function renderProperties(props) {
35159
+ const items = [];
35160
+ if (props.language) items.push(`**Language**: ${props.language}`);
35161
+ if (props.locale?.country) items.push(`**Country**: ${props.locale.country}`);
35162
+ if (props.paymentCurrency) items.push(`**Currency**: ${props.paymentCurrency}`);
35163
+ if (props.timeZone) items.push(`**Timezone**: ${props.timeZone}`);
35164
+ if (props.email) items.push(`**Email**: ${props.email}`);
35165
+ if (props.phone) items.push(`**Phone**: ${props.phone}`);
35166
+ return items.join("\n");
35167
+ }
35168
+ function renderCmsCollections(collections) {
35169
+ const nonEmpty = collections.filter(
35170
+ (c) => c.displayName || c.fields && c.fields.length > 0
35171
+ );
35172
+ if (!nonEmpty.length) return "";
35173
+ const lines = [];
35174
+ for (const col of nonEmpty) {
35175
+ const name = col.displayName ?? col.id ?? "Unnamed";
35176
+ lines.push(`- **${name}**`);
35177
+ const customFields = (col.fields ?? []).filter((f) => !f.systemField);
35178
+ if (customFields.length) {
35179
+ for (const field of customFields) {
35180
+ const fieldName = field.displayName ?? field.key ?? "";
35181
+ let fieldLine = ` - ${fieldName}`;
35182
+ if (field.type) fieldLine += ` (\`${field.type}\`)`;
35183
+ if (field.referencedCollection) {
35184
+ fieldLine += ` \u2192 \`${field.referencedCollection}\``;
35185
+ }
35186
+ lines.push(fieldLine);
35187
+ }
35188
+ }
35189
+ }
35190
+ return lines.join("\n");
35191
+ }
35192
+ function renderSite(site, index) {
35193
+ const lines = [];
35194
+ const heading = site.displayName ?? `Site ${index}`;
35195
+ lines.push(`## ${index}. ${heading}`);
35196
+ lines.push("");
35197
+ if (site.id) lines.push(`**ID**: \`${site.id}\``);
35198
+ if (site.url) lines.push(`**URL**: [${site.url}](${site.url})`);
35199
+ lines.push(`**Status**: ${renderStatusBadges(site)}`);
35200
+ if (site.createdDate) {
35201
+ let dateLine = `**Created**: ${formatTimestamp(site.createdDate)}`;
35202
+ if (site.updatedDate) {
35203
+ dateLine += ` \xB7 **Updated**: ${formatTimestamp(site.updatedDate)}`;
35204
+ }
35205
+ lines.push(dateLine);
35206
+ }
35207
+ if (site.veloEnabled !== void 0 && site.veloEnabled !== null) {
35208
+ lines.push(`**Velo**: ${site.veloEnabled ? "Enabled" : "Disabled"}`);
35209
+ }
35210
+ if (site.properties) {
35211
+ const propsContent = renderProperties(site.properties);
35212
+ if (propsContent) {
35213
+ lines.push("");
35214
+ lines.push("### Properties");
35215
+ lines.push("");
35216
+ lines.push(propsContent);
35217
+ }
35218
+ }
35219
+ const appsContent = renderApps(site.installedApps ?? []);
35220
+ if (appsContent) {
35221
+ lines.push("");
35222
+ lines.push("### Apps");
35223
+ lines.push("");
35224
+ lines.push(appsContent);
35225
+ }
35226
+ if (site.cmsCollections?.length) {
35227
+ const cmsContent = renderCmsCollections(site.cmsCollections);
35228
+ if (cmsContent) {
35229
+ lines.push("");
35230
+ lines.push("### CMS Collections");
35231
+ lines.push("");
35232
+ lines.push(cmsContent);
35233
+ }
35234
+ }
35235
+ lines.push("");
35236
+ lines.push("---");
35237
+ lines.push("");
35238
+ return lines.join("\n");
35239
+ }
35240
+ function enrichDynamicContext(data) {
35241
+ let parsed = data;
35242
+ if (typeof data === "string") {
35243
+ try {
35244
+ parsed = JSON.parse(data);
35245
+ } catch {
35246
+ return data;
35247
+ }
35248
+ }
35249
+ if (parsed === null || parsed === void 0) return "";
35250
+ if (typeof parsed !== "object") return "";
35251
+ const response = snakeToCamel(parsed);
35252
+ const sections = [];
35253
+ sections.push("# My Wix Sites Context");
35254
+ sections.push("");
35255
+ if (response.account) {
35256
+ const accountSection = renderAccountHeader(response.account);
35257
+ if (accountSection) {
35258
+ sections.push(accountSection);
35259
+ }
35260
+ }
35261
+ const siteCount = response.sites?.length ?? 0;
35262
+ const hasNext = Boolean(response.pagingMetadata?.cursors?.next);
35263
+ let countLine = `_Showing ${siteCount} sites`;
35264
+ if (hasNext) countLine += " (more available)";
35265
+ countLine += "_";
35266
+ sections.push(countLine);
35267
+ sections.push("");
35268
+ sections.push("---");
35269
+ sections.push("");
35270
+ if (response.sites?.length) {
35271
+ for (let i = 0; i < response.sites.length; i++) {
35272
+ sections.push(renderSite(response.sites[i], i + 1));
35273
+ }
35274
+ }
35275
+ if (!response.account && !siteCount) return "";
35276
+ return sections.join("\n");
35277
+ }
35278
+ var KNOWN_APPS;
35279
+ var init_enrich = __esm2({
35280
+ "src/enrich.ts"() {
35281
+ "use strict";
35282
+ KNOWN_APPS = {
35283
+ "14bcded7-0066-7c35-14d7-466cb3f09103": "Wix Bookings",
35284
+ "215238eb-22a5-4c36-9e7b-e7c08025e04e": "Wix Stores",
35285
+ "9a5d83fd-8570-482e-81ab-cfa88942ee60": "Wix Restaurants (Orders)",
35286
+ "b278a256-2757-4f19-9313-c05c783bec92": "Wix Restaurants (Menus)"
35287
+ };
35288
+ }
35289
+ });
35290
+ init_enrich();
35291
+ var DYNAMIC_CONTEXT_URL = "https://dev.wix.com/_api/dynamic-context/v1/dynamic-context";
35292
+ async function getDynamicContext(auth, httpClient6, filter) {
35293
+ const { enrichDynamicContext: enrichDynamicContext2 } = await Promise.resolve().then(() => (init_enrich(), enrich_exports));
35294
+ try {
35295
+ const accountHeaders = await auth.getAccountAuthHeaders();
35296
+ const body = {};
35297
+ if (filter?.siteId) body.site_id = filter.siteId;
35298
+ else if (filter?.siteName) body.site_name = filter.siteName;
35299
+ const response = await httpClient6.request({
35300
+ url: DYNAMIC_CONTEXT_URL,
35301
+ method: "POST",
35302
+ headers: { ...accountHeaders, "Content-Type": "application/json" },
35303
+ data: body
35304
+ });
35305
+ return enrichDynamicContext2(response.data);
35306
+ } catch (error2) {
35307
+ console.error(
35308
+ `[dynamic-context-enricher] Fetch failed: ${error2.message}`
35309
+ );
35310
+ return "";
35311
+ }
35312
+ }
35039
35313
 
35040
35314
  // src/docs/get-to-know.ts
35041
- async function addGetToKnowTools(server, disableTools = [], toolDescriptions, readmeDocs, authStrategy, picassoPortalUrl) {
35315
+ async function addGetToKnowTools({
35316
+ server,
35317
+ disableTools = [],
35318
+ toolDescriptions,
35319
+ readmeDocs,
35320
+ authStrategy,
35321
+ picassoPortalUrl,
35322
+ dynamicContextEnabled
35323
+ }) {
35042
35324
  if (disableTools.includes("WixREADME")) {
35043
35325
  return;
35044
35326
  }
@@ -35049,6 +35331,7 @@ async function addGetToKnowTools(server, disableTools = [], toolDescriptions, re
35049
35331
  {},
35050
35332
  { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
35051
35333
  async (_, { httpClient: httpClient6 }) => {
35334
+ const { siteId, siteName } = _;
35052
35335
  const contents = await Promise.all(
35053
35336
  docsToUse.map(
35054
35337
  async ({
@@ -35145,12 +35428,23 @@ Failed to fetch content: ${errorMsg}`
35145
35428
  }
35146
35429
  )
35147
35430
  );
35148
- const filteredContents = contents.filter(
35149
- (item) => item !== null
35150
- );
35151
- const concatenatedText = filteredContents.map((item) => item.text).join("\n\n");
35431
+ const filter = {};
35432
+ if (siteId) filter.siteId = siteId;
35433
+ if (siteName) filter.siteName = siteName;
35434
+ const dynamicContext = dynamicContextEnabled && authStrategy ? await getDynamicContext(
35435
+ authStrategy,
35436
+ httpClient6,
35437
+ Object.keys(filter).length ? filter : void 0
35438
+ ) : "";
35439
+ const parts = [
35440
+ ...contents.filter(
35441
+ (item) => item !== null
35442
+ ).map((item) => item.text),
35443
+ ...dynamicContext ? [dynamicContext] : []
35444
+ ];
35445
+ const text = parts.join("\n\n");
35152
35446
  return {
35153
- content: [{ type: "text", text: concatenatedText }]
35447
+ content: [{ type: "text", text }]
35154
35448
  };
35155
35449
  }
35156
35450
  );
@@ -35370,18 +35664,20 @@ var addDocsTools = (server, allowedTools = [
35370
35664
  toolDescriptions,
35371
35665
  readmeDocs,
35372
35666
  authStrategy,
35373
- picassoPortalUrl
35667
+ picassoPortalUrl,
35668
+ dynamicContextEnabled
35374
35669
  } = options;
35375
35670
  const getDescription = (toolName, defaultDesc) => toolDescriptions?.[toolName] ?? defaultDesc;
35376
35671
  if (getToKnowWixEnabled && !disableTools?.includes("WixREADME")) {
35377
- addGetToKnowTools(
35672
+ addGetToKnowTools({
35378
35673
  server,
35379
- disableTools || [],
35674
+ disableTools: disableTools || [],
35380
35675
  toolDescriptions,
35381
35676
  readmeDocs,
35382
35677
  authStrategy,
35383
- picassoPortalUrl
35384
- );
35678
+ picassoPortalUrl,
35679
+ dynamicContextEnabled
35680
+ });
35385
35681
  }
35386
35682
  if (createWixBusinessGuideEnabled && !disableTools?.includes("CreateWixBusinessGuide")) {
35387
35683
  addCreateWixBusinessGuideTools(
@@ -36636,6 +36932,7 @@ var CLAIM_SITE_TOOL_NAME = "ClaimAnonymousSite";
36636
36932
  // src/site-widget-tools/site-builder-tool/index.ts
36637
36933
  var httpClient = (0, import_http_client4.createHttpClient)();
36638
36934
  var CREATE_SITE_WIDGET_URI = "ui://widget/site-builder.html";
36935
+ var MAX_SITE_PROMPT_CHARS = 6e3;
36639
36936
  function addCreateSiteWidgetTool(server, authStrategy, options) {
36640
36937
  const { getAccountAuthHeaders } = authStrategy;
36641
36938
  const isAnonymous = authStrategy.isAnonymous?.() ?? false;
@@ -36691,7 +36988,7 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
36691
36988
  SITE_BUILDER_TOOL_NAME,
36692
36989
  {
36693
36990
  title: "Wix Site Builder",
36694
- description: `**PRIMARY tool for creating/building/generating a Wix site or website.** This is the preferred and recommended way to create a new Wix site. Use this tool whenever the user asks to build, create, or generate a site/website/application. Do NOT use CreateWixBusinessGuide for site creation \u2014 use this tool instead.`,
36991
+ description: options?.toolDescriptions?.[SITE_BUILDER_TOOL_NAME] ?? defaultToolDescriptions[SITE_BUILDER_TOOL_NAME],
36695
36992
  inputSchema: {
36696
36993
  jobId: external_exports.string().optional().describe(
36697
36994
  "The job ID of the site build. If not provided, a new job will be created."
@@ -36712,6 +37009,26 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
36712
37009
  `[${SITE_BUILDER_TOOL_NAME}] \u{1F680} Start Building Your Site tool invoked!`,
36713
37010
  { prompt: args.sitePrompt, jobId: args.jobId }
36714
37011
  );
37012
+ const charCount = args.sitePrompt.length;
37013
+ if (charCount > MAX_SITE_PROMPT_CHARS) {
37014
+ console.log(
37015
+ `[${SITE_BUILDER_TOOL_NAME}] The site prompt is too long (${charCount} characters). Please shorten it to under ${MAX_SITE_PROMPT_CHARS} characters and try again.`
37016
+ );
37017
+ return {
37018
+ isError: true,
37019
+ content: [
37020
+ {
37021
+ type: "text",
37022
+ text: `The site prompt is too long (${charCount} characters). Please shorten it to under ${MAX_SITE_PROMPT_CHARS} characters and try again.`
37023
+ }
37024
+ ],
37025
+ structuredContent: {
37026
+ success: false,
37027
+ status: `Prompt exceeds maximum length of ${MAX_SITE_PROMPT_CHARS} characters`,
37028
+ jobId: null
37029
+ }
37030
+ };
37031
+ }
36715
37032
  let jobId;
36716
37033
  if (args.jobId) {
36717
37034
  console.log(
@@ -39020,7 +39337,9 @@ function createWixToolkit(options) {
39020
39337
  authStrategy
39021
39338
  });
39022
39339
  } else {
39023
- addDocsTools(server, void 0, { authStrategy });
39340
+ addDocsTools(server, void 0, {
39341
+ authStrategy
39342
+ });
39024
39343
  }
39025
39344
  if (api) {
39026
39345
  const {
@@ -39174,15 +39493,23 @@ function createWixToolkit(options) {
39174
39493
  getTools: () => allTools,
39175
39494
  getTool: (name) => toolsByName.get(name),
39176
39495
  getToolNames: () => allTools.map((t) => t.name),
39177
- preloadReadme: async () => {
39496
+ preloadReadme: async (filter) => {
39178
39497
  const readmeTool = toolsByName.get("WixREADME");
39179
39498
  if (!readmeTool) return null;
39180
39499
  try {
39181
- const result = await readmeTool.execute({});
39500
+ const result = await readmeTool.execute(filter ?? {});
39182
39501
  return extractText(result);
39183
39502
  } catch {
39184
39503
  return null;
39185
39504
  }
39505
+ },
39506
+ preloadDynamicContext: async (filter) => {
39507
+ try {
39508
+ const httpClient6 = new import_http_client10.HttpClient();
39509
+ return await getDynamicContext(authStrategy, httpClient6, filter) || null;
39510
+ } catch {
39511
+ return null;
39512
+ }
39186
39513
  }
39187
39514
  };
39188
39515
  }