@wix/mcp 1.0.29 → 1.0.30

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 (39) hide show
  1. package/README.md +1 -0
  2. package/build/bin-standalone.js +209 -2
  3. package/build/bin-standalone.js.map +2 -2
  4. package/build/cjs/index.cjs +383 -13
  5. package/build/cjs/index.cjs.map +4 -4
  6. package/build/dts/bin.d.ts +1 -1
  7. package/build/dts/bin.d.ts.map +1 -1
  8. package/build/dts/code-mode/index.d.ts +10 -0
  9. package/build/dts/code-mode/index.d.ts.map +1 -0
  10. package/build/dts/code-mode/index.js +150 -0
  11. package/build/dts/code-mode/index.js.map +1 -0
  12. package/build/dts/config/default-config.d.ts +1 -0
  13. package/build/dts/config/default-config.d.ts.map +1 -1
  14. package/build/dts/config/default-config.js +144 -1
  15. package/build/dts/config/default-config.js.map +1 -1
  16. package/build/dts/config/param-descriptions.d.ts +5 -0
  17. package/build/dts/config/param-descriptions.d.ts.map +1 -1
  18. package/build/dts/config/param-descriptions.js +5 -0
  19. package/build/dts/config/param-descriptions.js.map +1 -1
  20. package/build/dts/docs/docs.d.ts +1 -1
  21. package/build/dts/docs/docs.d.ts.map +1 -1
  22. package/build/dts/docs/docs.js +56 -2
  23. package/build/dts/docs/docs.js.map +1 -1
  24. package/build/dts/docs/semanticSearch.d.ts.map +1 -1
  25. package/build/dts/docs/semanticSearch.js +3 -0
  26. package/build/dts/docs/semanticSearch.js.map +1 -1
  27. package/build/dts/docs/semanticSearch.test.js +33 -0
  28. package/build/dts/docs/semanticSearch.test.js.map +1 -1
  29. package/build/dts/index.d.ts +1 -0
  30. package/build/dts/index.d.ts.map +1 -1
  31. package/build/dts/index.js +2 -0
  32. package/build/dts/index.js.map +1 -1
  33. package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +0 -7
  34. package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -1
  35. package/build/dts/site-widget-tools/site-builder-tool/index.js +6 -10
  36. package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
  37. package/build/esm/index.js +382 -13
  38. package/build/esm/index.js.map +4 -4
  39. package/package.json +2 -2
@@ -20393,6 +20393,7 @@ __export(index_exports, {
20393
20393
  VALID_DOCS_TOOLS: () => VALID_DOCS_TOOLS,
20394
20394
  WixMcpServer: () => WixMcpServer,
20395
20395
  addApiCallTool: () => addApiCallTool,
20396
+ addCodeModeTools: () => addCodeModeTools,
20396
20397
  addCreateSiteWidgetTool: () => addCreateSiteWidgetTool,
20397
20398
  addDocsResources: () => addDocsResources,
20398
20399
  addDocsTools: () => addDocsTools,
@@ -35614,6 +35615,8 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
35614
35615
  kbNames.push("HEADLESS_KB_ID");
35615
35616
  } else if (toolName === "VELO") {
35616
35617
  kbNames.push("VELO_DOCS_KB_ID", "VELO_METHODS_KB_ID");
35618
+ } else if (toolName === "CLI") {
35619
+ kbNames.push("CLI_KB_ID");
35617
35620
  }
35618
35621
  logger2.log(
35619
35622
  `[SemanticSearch] Tool: ${toolName}, KBs: [${kbNames.join(", ")}], Query: "${toolParams.searchTerm}"`
@@ -36210,6 +36213,148 @@ var defaultToolDescriptions = {
36210
36213
  `,
36211
36214
  VeloREADME: dedent_default`
36212
36215
  This tool is set for providing Velo context in order to be used by the agent for executing Velo-related tasks.
36216
+ `,
36217
+ SearchWixCLIDocumentation: dedent_default`
36218
+ Searches the Wix CLI documentation for website development and CLI commands.
36219
+ Use this tool when you need information about Wix CLI commands, local development workflows, or CLI-based website development.
36220
+ Specify what you need information about (e.g., 'wix dev command', 'local development setup', 'CLI authentication', 'wix deploy').
36221
+ If you can't find what you need, try to rephrase your search term or use bigger maxResults value.
36222
+ ${SYSTEM_REMINDER}
36223
+ `,
36224
+ SearchWixAPISpec: dedent_default`
36225
+ Search the Wix REST API documentation by writing JavaScript code that runs in a sandboxed environment.
36226
+ Your code has access to two globals:
36227
+
36228
+ **lightIndex** — Array of all Wix REST API resources (~330):
36229
+ \`\`\`typescript
36230
+ interface LightResource {
36231
+ name: string; // e.g. "Products V3", "Contact V4"
36232
+ resourceId: string;
36233
+ menuPath: string[]; // e.g. ["business-solutions", "stores", "catalog-v3", "products-v3"]
36234
+ methods: Array<{
36235
+ operationId: string; // e.g. "wix.stores.catalog.v3.CatalogApi.CreateProduct"
36236
+ summary: string; // e.g. "Create Product"
36237
+ httpMethod: string; // "get" | "post" | "patch" | "delete"
36238
+ path: string; // e.g. "/v3/products"
36239
+ description: string; // truncated to 200 chars
36240
+ }>;
36241
+ }
36242
+ \`\`\`
36243
+
36244
+ **getResourceSchema(resourceId)** — Async function returning the full schema for a resource:
36245
+ \`\`\`typescript
36246
+ interface FullSchema {
36247
+ title: string;
36248
+ description: string;
36249
+ fqdn: string;
36250
+ methods: Array<{
36251
+ summary: string;
36252
+ description: string;
36253
+ operationId: string;
36254
+ httpMethod: string;
36255
+ path: string;
36256
+ servers: Array<{ url: string }>; // Base URLs (e.g. "https://www.wixapis.com/...")
36257
+ requestBody: object | null;
36258
+ responses: object;
36259
+ parameters: Array<object>;
36260
+ permissions: string[];
36261
+ legacyExamples: Array<{ // Curl examples
36262
+ content: { title: string; request: string; response: string };
36263
+ }>;
36264
+ sdkData: { // JS SDK examples
36265
+ packageName: string;
36266
+ namespace: string;
36267
+ methodExamples: Array<{ title: string; content: string }>;
36268
+ };
36269
+ }>;
36270
+ components: { schemas: object };
36271
+ }
36272
+ \`\`\`
36273
+
36274
+ Your code MUST be an \`async function()\` expression that returns a value.
36275
+
36276
+ Top-level verticals: business-solutions (stores, e-commerce, bookings, events, restaurants, pricing-plans, coupons), crm (contacts, members, loyalty-program, forms, community), business-management (payments, invoices, automations), assets (media, files), app-management (oauth, billing), account-level, site.
36277
+
36278
+ Examples:
36279
+
36280
+ Find APIs by keyword:
36281
+ \`\`\`javascript
36282
+ async function() {
36283
+ return lightIndex.filter(r => r.methods.some(m => m.summary.toLowerCase().includes("query products")))
36284
+ .map(r => ({ name: r.name, methods: r.methods.map(m => m.summary + " (" + m.httpMethod.toUpperCase() + " " + m.path + ")") }));
36285
+ }
36286
+ \`\`\`
36287
+
36288
+ Get full schema with base URL, curl examples, and permissions:
36289
+ \`\`\`javascript
36290
+ async function() {
36291
+ const resource = lightIndex.find(r => r.name === "Contact V4");
36292
+ const schema = await getResourceSchema(resource.resourceId);
36293
+ const method = schema.methods.find(m => m.summary === "Query Contacts");
36294
+ return {
36295
+ baseUrl: method.servers?.find(s => s.url.includes("wixapis.com"))?.url,
36296
+ path: method.path,
36297
+ httpMethod: method.httpMethod,
36298
+ permissions: method.permissions,
36299
+ requestBody: method.requestBody,
36300
+ curlExample: method.legacyExamples?.[0]?.content,
36301
+ sdkExample: method.sdkData?.methodExamples?.[0]?.content
36302
+ };
36303
+ }
36304
+ \`\`\`
36305
+
36306
+ Browse a vertical:
36307
+ \`\`\`javascript
36308
+ async function() {
36309
+ return lightIndex.filter(r => r.menuPath[0] === "crm")
36310
+ .map(r => ({ name: r.name, path: r.menuPath.join(" > "), methods: r.methods.length }));
36311
+ }
36312
+ \`\`\`
36313
+ `,
36314
+ ExecuteWixAPI: dedent_default`
36315
+ Execute JavaScript code against the Wix REST API. First use the 'SearchWixAPISpec' tool to find the right endpoints, base URLs, and request/response schemas. Then write code using the wix.request() function. Auth is handled automatically — do not set Authorization headers.
36316
+
36317
+ Available in your code:
36318
+ \`\`\`typescript
36319
+ interface WixRequestOptions {
36320
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
36321
+ url: string; // Full URL from schema servers field, e.g. "https://www.wixapis.com/contacts/v4/contacts"
36322
+ body?: unknown;
36323
+ headers?: Record<string, string>; // Do NOT set Authorization — it is injected automatically
36324
+ }
36325
+
36326
+ interface WixResponse<T = unknown> {
36327
+ status: number;
36328
+ data: T;
36329
+ }
36330
+
36331
+ declare const wix: {
36332
+ request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
36333
+ };
36334
+
36335
+ declare const siteId: string | undefined;
36336
+ \`\`\`
36337
+
36338
+ Your code MUST be an \`async function()\` expression that returns the result.
36339
+
36340
+ Example — query products then update one:
36341
+ \`\`\`javascript
36342
+ async function() {
36343
+ const list = await wix.request({
36344
+ method: "POST",
36345
+ url: "https://www.wixapis.com/stores/v1/products/query",
36346
+ body: { query: { paging: { limit: 5 } } }
36347
+ });
36348
+ const product = list.data.products[0];
36349
+ if (!product) return { error: "No products found" };
36350
+ const updated = await wix.request({
36351
+ method: "PATCH",
36352
+ url: \`https://www.wixapis.com/stores/v1/products/\${product.id}\`,
36353
+ body: { product: { name: "Updated Name" } }
36354
+ });
36355
+ return updated.data;
36356
+ }
36357
+ \`\`\`
36213
36358
  `
36214
36359
  };
36215
36360
  var defaultReadmeDocs = [
@@ -36293,7 +36438,8 @@ function mergeConfig(base, overrides) {
36293
36438
  toolHints: { ...base.toolHints, ...overrides.toolHints },
36294
36439
  docsTools: overrides.docsTools ?? base.docsTools,
36295
36440
  getToKnowWixEnabled: overrides.getToKnowWixEnabled ?? base.getToKnowWixEnabled,
36296
- createWixBusinessGuideEnabled: overrides.createWixBusinessGuideEnabled ?? base.createWixBusinessGuideEnabled
36441
+ createWixBusinessGuideEnabled: overrides.createWixBusinessGuideEnabled ?? base.createWixBusinessGuideEnabled,
36442
+ codeModeEnabled: overrides.codeModeEnabled ?? base.codeModeEnabled
36297
36443
  };
36298
36444
  }
36299
36445
  var defaultConfig = {
@@ -36576,6 +36722,11 @@ var paramDescriptions = {
36576
36722
  searchTerm: "The search term to search for in the Velo Documentation",
36577
36723
  maxResults: "The maximum number of results to return, default is 5, max is 15"
36578
36724
  },
36725
+ SearchWixCLIDocumentation: {
36726
+ searchTerm: "The search term to search for in the Wix CLI Documentation",
36727
+ maxResults: "The maximum number of results to return, default is 5, max is 15",
36728
+ reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
36729
+ },
36579
36730
  ReadFullDocsArticle: {
36580
36731
  articleUrl: "The URL of the docs article or method article to fetch. Should be something like https://dev.wix.com/docs/.../.../..."
36581
36732
  },
@@ -36614,7 +36765,8 @@ var VALID_DOCS_TOOLS = [
36614
36765
  "BUILD_APPS",
36615
36766
  "WIX_HEADLESS",
36616
36767
  "VELO",
36617
- "BUSINESS_SOLUTIONS"
36768
+ "BUSINESS_SOLUTIONS",
36769
+ "CLI"
36618
36770
  ];
36619
36771
  var addDocsTools = (server, allowedTools = [
36620
36772
  "WDS",
@@ -36622,7 +36774,8 @@ var addDocsTools = (server, allowedTools = [
36622
36774
  "SDK",
36623
36775
  "BUILD_APPS",
36624
36776
  "WIX_HEADLESS",
36625
- "BUSINESS_SOLUTIONS"
36777
+ "BUSINESS_SOLUTIONS",
36778
+ "CLI"
36626
36779
  ], options = {}) => {
36627
36780
  const {
36628
36781
  getToKnowWixEnabled = false,
@@ -37031,6 +37184,62 @@ var addDocsTools = (server, allowedTools = [
37031
37184
  }
37032
37185
  );
37033
37186
  }
37187
+ if (allowedTools.includes("CLI") && !disableTools?.includes("SearchWixCLIDocumentation")) {
37188
+ server.tool(
37189
+ "SearchWixCLIDocumentation",
37190
+ getDescription(
37191
+ "SearchWixCLIDocumentation",
37192
+ defaultToolDescriptions.SearchWixCLIDocumentation ?? ""
37193
+ ),
37194
+ (() => {
37195
+ const d = desc("SearchWixCLIDocumentation");
37196
+ return {
37197
+ searchTerm: external_exports.string().describe(d.searchTerm),
37198
+ maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(10),
37199
+ reason: external_exports.string().describe(d.reason)
37200
+ };
37201
+ })(),
37202
+ { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
37203
+ async ({ searchTerm, maxResults, reason }, { panorama }) => {
37204
+ try {
37205
+ logger2.log(
37206
+ `[SearchWixCLIDocumentation] searchTerm="${searchTerm}", reason="${reason}"`
37207
+ );
37208
+ const result = await runSemanticSearchAndFormat({
37209
+ toolName: "CLI",
37210
+ toolParams: {
37211
+ searchTerm
37212
+ },
37213
+ maxResults: Math.max(1, Math.min(maxResults ?? 5, 15)),
37214
+ linesInEachResult: 15
37215
+ });
37216
+ return {
37217
+ content: [
37218
+ {
37219
+ type: "text",
37220
+ text: result
37221
+ }
37222
+ ]
37223
+ };
37224
+ } catch (error2) {
37225
+ panorama.errorMonitor().reportError(error2);
37226
+ captureException(error2, {
37227
+ tags: {
37228
+ componentId: "SearchWixCLIDocumentation",
37229
+ toolName: "SearchWixCLIDocumentation"
37230
+ }
37231
+ });
37232
+ logger2.error(
37233
+ `Error searching for ${searchTerm} in Wix CLI: ${error2}`
37234
+ );
37235
+ return {
37236
+ isError: true,
37237
+ content: [{ type: "text", text: "Error: " + error2.message }]
37238
+ };
37239
+ }
37240
+ }
37241
+ );
37242
+ }
37034
37243
  if (!disableTools?.includes("ReadFullDocsArticle")) {
37035
37244
  server.tool(
37036
37245
  "ReadFullDocsArticle",
@@ -37884,20 +38093,18 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
37884
38093
  };
37885
38094
  }
37886
38095
  );
37887
- const isCompactPrompt = options?.compactSitePrompt ?? true;
37888
- const compactSuffix = " Keep the prompt short and concise, single page site if possible, do not add pages that are not explicitly requested.";
37889
- const toolDescription = `A tool that builds a site using Wix. Use this ONLY when the user explicitly asks to build/create/generate a site/website/application. The widget resource is available at ${CREATE_SITE_WIDGET_URI}.${isCompactPrompt ? compactSuffix : ""}`;
37890
- const sitePromptDescription = `The prompt to build the site.${isCompactPrompt ? compactSuffix : ""} If not provided, the user will be asked to provide a prompt.`;
37891
38096
  server.registerTool(
37892
38097
  SITE_BUILDER_TOOL_NAME,
37893
38098
  {
37894
38099
  title: "Wix Site Builder",
37895
- description: toolDescription,
38100
+ 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.`,
37896
38101
  inputSchema: {
37897
38102
  jobId: external_exports.string().optional().describe(
37898
38103
  "The job ID of the site build. If not provided, a new job will be created."
37899
38104
  ),
37900
- sitePrompt: external_exports.string().describe(sitePromptDescription)
38105
+ sitePrompt: external_exports.string().describe(
38106
+ `The prompt to build the site. If not provided, the user will be asked to provide a prompt.`
38107
+ )
37901
38108
  },
37902
38109
  _meta: toolMeta(),
37903
38110
  annotations: {
@@ -37909,7 +38116,7 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
37909
38116
  async (args, { setToolBiParams }) => {
37910
38117
  console.log(
37911
38118
  `[${SITE_BUILDER_TOOL_NAME}] \u{1F680} Start Building Your Site tool invoked!`,
37912
- { prompt: args.sitePrompt, jobId: args.jobId, isCompactPrompt }
38119
+ { prompt: args.sitePrompt, jobId: args.jobId }
37913
38120
  );
37914
38121
  const accountHeaders = await getAccountAuthHeaders();
37915
38122
  let jobId;
@@ -37992,9 +38199,7 @@ async function buildHarmonySite({
37992
38199
  withScreenshots: true,
37993
38200
  actionContext: "wix-mcp"
37994
38201
  };
37995
- console.log("[buildHarmonySite] request", {
37996
- buildSiteRequest
37997
- });
38202
+ console.log("[buildHarmonySite] request", { buildSiteRequest });
37998
38203
  try {
37999
38204
  const response = await httpClient.post(
38000
38205
  "https://manage.wix.com/_api/harmony-site-builder/generate-harmony-site",
@@ -39487,6 +39692,170 @@ function createWixToolkit(options) {
39487
39692
  }
39488
39693
  };
39489
39694
  }
39695
+
39696
+ // src/code-mode/index.ts
39697
+ var SEARCH_TOOL_NAME = "SearchWixAPISpec";
39698
+ var EXECUTE_TOOL_NAME = "ExecuteWixAPI";
39699
+ function addCodeModeTools(server, options) {
39700
+ const {
39701
+ codeModeBaseUrl,
39702
+ authStrategy,
39703
+ disableTools = [],
39704
+ toolDescriptions
39705
+ } = options;
39706
+ if (!disableTools.includes(SEARCH_TOOL_NAME)) {
39707
+ addSearchTool(server, codeModeBaseUrl, disableTools, toolDescriptions);
39708
+ }
39709
+ if (!disableTools.includes(EXECUTE_TOOL_NAME) && authStrategy) {
39710
+ addExecuteTool(
39711
+ server,
39712
+ codeModeBaseUrl,
39713
+ authStrategy,
39714
+ disableTools,
39715
+ toolDescriptions
39716
+ );
39717
+ }
39718
+ }
39719
+ function addSearchTool(server, codeModeBaseUrl, disableTools, toolDescriptions) {
39720
+ const searchUrl = `${codeModeBaseUrl}/api/code-mode/search`;
39721
+ server.tool(
39722
+ SEARCH_TOOL_NAME,
39723
+ toolDescriptions?.[SEARCH_TOOL_NAME] ?? defaultToolDescriptions.SearchWixAPISpec,
39724
+ {
39725
+ code: external_exports.string().describe(
39726
+ "JavaScript async function() expression to search the Wix API index. Has access to `lightIndex` (array of resources) and `getResourceSchema(resourceId)` (returns full schema)."
39727
+ )
39728
+ },
39729
+ { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
39730
+ async ({ code }) => {
39731
+ logger2.log(`[SearchWixAPISpec] Executing search (${code.length} chars)`);
39732
+ try {
39733
+ const resp = await fetch(searchUrl, {
39734
+ method: "POST",
39735
+ headers: { "Content-Type": "application/json" },
39736
+ body: JSON.stringify({ code })
39737
+ });
39738
+ if (!resp.ok) {
39739
+ const errorBody = await resp.text();
39740
+ logger2.log(`[SearchWixAPISpec] HTTP ${resp.status}: ${errorBody}`);
39741
+ return {
39742
+ content: [
39743
+ {
39744
+ type: "text",
39745
+ text: `Search error (${resp.status}): ${errorBody}`,
39746
+ isError: true
39747
+ }
39748
+ ]
39749
+ };
39750
+ }
39751
+ const data = await resp.json();
39752
+ if (data.error) {
39753
+ return {
39754
+ content: [
39755
+ {
39756
+ type: "text",
39757
+ text: `Search error: ${data.error}`,
39758
+ isError: true
39759
+ }
39760
+ ]
39761
+ };
39762
+ }
39763
+ const text = typeof data.result === "string" ? data.result : JSON.stringify(data.result, null, 2);
39764
+ return {
39765
+ content: [{ type: "text", text }]
39766
+ };
39767
+ } catch (err) {
39768
+ const message = err instanceof Error ? err.message : String(err);
39769
+ logger2.log(`[SearchWixAPISpec] Error: ${message}`);
39770
+ return {
39771
+ content: [
39772
+ { type: "text", text: `Search error: ${message}`, isError: true }
39773
+ ]
39774
+ };
39775
+ }
39776
+ }
39777
+ );
39778
+ }
39779
+ function addExecuteTool(server, codeModeBaseUrl, authStrategy, disableTools, toolDescriptions) {
39780
+ const executeUrl = `${codeModeBaseUrl}/api/code-mode/execute`;
39781
+ server.tool(
39782
+ EXECUTE_TOOL_NAME,
39783
+ toolDescriptions?.[EXECUTE_TOOL_NAME] ?? defaultToolDescriptions.ExecuteWixAPI,
39784
+ {
39785
+ code: external_exports.string().describe(
39786
+ "JavaScript async function() expression to execute against the Wix REST API. Has access to `wix.request({ method, url, body, headers })` and `siteId`."
39787
+ ),
39788
+ siteId: external_exports.string().optional().describe(
39789
+ "Wix site ID to execute against. You can find site IDs using the ListWixSites tool or by querying the Wix API."
39790
+ )
39791
+ },
39792
+ { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
39793
+ async ({ code, siteId }) => {
39794
+ if (!siteId) {
39795
+ return {
39796
+ content: [
39797
+ {
39798
+ type: "text",
39799
+ text: "Error: siteId is required. You can list available sites using the ListWixSites tool or by querying the Wix Sites API.",
39800
+ isError: true
39801
+ }
39802
+ ]
39803
+ };
39804
+ }
39805
+ logger2.log(
39806
+ `[ExecuteWixAPI] Executing code (${code.length} chars), siteId=${siteId}`
39807
+ );
39808
+ try {
39809
+ const authHeaders = await authStrategy.getSiteAuthHeaders(siteId);
39810
+ const resp = await fetch(executeUrl, {
39811
+ method: "POST",
39812
+ headers: {
39813
+ "Content-Type": "application/json",
39814
+ ...authHeaders
39815
+ },
39816
+ body: JSON.stringify({ code, siteId })
39817
+ });
39818
+ if (!resp.ok) {
39819
+ const errorBody = await resp.text();
39820
+ logger2.log(`[ExecuteWixAPI] HTTP ${resp.status}: ${errorBody}`);
39821
+ return {
39822
+ content: [
39823
+ {
39824
+ type: "text",
39825
+ text: `Execute error (${resp.status}): ${errorBody}`,
39826
+ isError: true
39827
+ }
39828
+ ]
39829
+ };
39830
+ }
39831
+ const data = await resp.json();
39832
+ if (data.error) {
39833
+ return {
39834
+ content: [
39835
+ {
39836
+ type: "text",
39837
+ text: `Execute error: ${data.error}`,
39838
+ isError: true
39839
+ }
39840
+ ]
39841
+ };
39842
+ }
39843
+ const text = typeof data.result === "string" ? data.result : JSON.stringify(data.result, null, 2);
39844
+ return {
39845
+ content: [{ type: "text", text }]
39846
+ };
39847
+ } catch (err) {
39848
+ const message = err instanceof Error ? err.message : String(err);
39849
+ logger2.log(`[ExecuteWixAPI] Error: ${message}`);
39850
+ return {
39851
+ content: [
39852
+ { type: "text", text: `Execute error: ${message}`, isError: true }
39853
+ ]
39854
+ };
39855
+ }
39856
+ }
39857
+ );
39858
+ }
39490
39859
  // Annotate the CommonJS export names for ESM import in node:
39491
39860
  0 && (module.exports = {
39492
39861
  MENU_CONTENT_THRESHOLD,
@@ -39495,6 +39864,7 @@ function createWixToolkit(options) {
39495
39864
  VALID_DOCS_TOOLS,
39496
39865
  WixMcpServer,
39497
39866
  addApiCallTool,
39867
+ addCodeModeTools,
39498
39868
  addCreateSiteWidgetTool,
39499
39869
  addDocsResources,
39500
39870
  addDocsTools,