@wix/mcp 1.0.80 → 1.0.81

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 (34) hide show
  1. package/README.md +1 -1
  2. package/build/bin-standalone.js +72 -28
  3. package/build/cjs/index.cjs +90 -361
  4. package/build/cjs/toolkit.cjs +81 -30
  5. package/build/dts/api-call/index.js +41 -3
  6. package/build/dts/code-mode/index.js +8 -2
  7. package/build/dts/config/api-request-rules.d.ts +11 -0
  8. package/build/dts/config/api-request-rules.js +11 -0
  9. package/build/dts/config/default-config.js +8 -2
  10. package/build/dts/config/param-descriptions.d.ts +1 -1
  11. package/build/dts/config/param-descriptions.js +5 -3
  12. package/build/dts/docs/docs.js +6 -6
  13. package/build/dts/infra/tool-bi.d.ts +1 -1
  14. package/build/dts/infra/tool-bi.js +3 -2
  15. package/build/dts/toolkit-entry.d.cts +1 -1
  16. package/build/dts/toolkit-entry.d.ts +1 -1
  17. package/build/dts/toolkit.js +4 -1
  18. package/build/dts/wix-mcp-server.d.ts +2 -0
  19. package/build/dts/wix-mcp-server.js +4 -1
  20. package/build/dts/wixel/api.d.ts +0 -60
  21. package/build/dts/wixel/api.js +1 -50
  22. package/build/dts/wixel/constants.d.ts +0 -1
  23. package/build/dts/wixel/constants.js +0 -1
  24. package/build/dts/wixel/index.d.ts +0 -3
  25. package/build/dts/wixel/index.js +0 -9
  26. package/build/esm/index.js +90 -358
  27. package/build/esm/toolkit.js +81 -30
  28. package/package.json +3 -3
  29. package/build/dts/wixel/open-headless-wixel-project-tool.d.ts +0 -6
  30. package/build/dts/wixel/open-headless-wixel-project-tool.js +0 -84
  31. package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts +0 -6
  32. package/build/dts/wixel/pull-headless-wixel-job-tool.js +0 -61
  33. package/build/dts/wixel/update-headless-wixel-job-tool.d.ts +0 -6
  34. package/build/dts/wixel/update-headless-wixel-job-tool.js +0 -106
@@ -12075,6 +12075,9 @@ function rethrowIfUnauthorized(error) {
12075
12075
  }
12076
12076
  }
12077
12077
 
12078
+ // src/config/api-request-rules.ts
12079
+ var ARRAY_QUERY_PARAMS_RULE = "Repeat array query params once per value: `?fieldsets=URL&fieldsets=RICH_CONTENT`. Do NOT comma-join values (`fieldsets=URL,RICH_CONTENT`), do NOT leave a trailing comma, and do NOT use a value the method schema does not list, even if a sibling method accepts it (draft posts have no `SEO` fieldset).";
12080
+
12078
12081
  // src/config/default-config.ts
12079
12082
  var AGENT_GOAL = dedent_default`
12080
12083
  You are an agent that helps the user manage their Wix site.
@@ -12196,11 +12199,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
12196
12199
  CODE CONTRACT:
12197
12200
  - Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
12198
12201
  - Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
12202
+ - Do not minify the code. Put each object property on its own line, with spaces after colons and commas, and declare deep literals (request bodies, filters, patch lists) as a named \`const\` before use so each \`wix.request({ ... })\` argument stays short.
12199
12203
 
12200
12204
  CONFIRM API CONTRACTS:
12201
12205
  - Do not rely on memory for endpoints, methods, bodies, response paths, filters, enum values, or auth scope. Confirm every method from conversation-provided details, a complete matching docs example, or the schema/docs tools before executing.
12202
12206
  - Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
12203
12207
  - A response field is not automatically filterable or sortable. Use only capabilities declared for that exact query/search method. If an unsupported filter is unavoidable, fetch a bounded result set and filter it in code.
12208
+ - ${ARRAY_QUERY_PARAMS_RULE}
12204
12209
  - Read-only probes may inspect state or resolve IDs. Never use speculative create/update/delete calls to discover request or response shapes, and never repeat a successful mutation merely to obtain more response data.
12205
12210
  `;
12206
12211
  var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
@@ -12216,6 +12221,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
12216
12221
  SCOPE AND SITE TARGETING:
12217
12222
  - Set \`scope: "site"\` for site-level APIs and \`scope: "account"\` for account-level APIs. Account-level acts on the account itself, or on sites as objects within it; anything that reads or writes inside a site is site-level.
12218
12223
  - If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
12224
+ - Site-level calls need a site ID; there is no implicit current site. Before any \`scope: "site"\` call, pass the site's ID as the ExecuteWixAPI \`siteId\` parameter or per request. \`scope: "site"\` without a \`siteId\` fails.
12219
12225
  - \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
12220
12226
  - Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
12221
12227
  - For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
@@ -12536,8 +12542,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
12536
12542
  SearchBuildAppsDocumentation: dedent_default`
12537
12543
  Searches the Wix Build Apps documentation.
12538
12544
  `,
12539
- SearchOverviewDocumentation: dedent_default`
12540
- Searches high-level Wix platform and business overview documentation.
12545
+ SearchDevelopmentDocumentation: dedent_default`
12546
+ Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
12547
+ Skip it entirely for general, business, support, or Wix-editor questions.
12548
+ Call it only after the specific search for your task returned nothing useful: \`SearchWixRESTDocumentation\` (REST), \`SearchWixSDKDocumentation\` (JS SDK), \`SearchWixCLIDocumentation\` (CLI), \`SearchBuildAppsDocumentation\` (apps), \`SearchWixHeadlessDocumentation\` (Headless), \`SearchWixWDSDocumentation\` (WDS). Never use it as a first search.
12541
12549
  `,
12542
12550
  SearchWixHeadlessDocumentation: dedent_default`
12543
12551
  Searches the Wix Headless documentation.
@@ -13189,14 +13197,20 @@ function renderApps(apps, knownApps) {
13189
13197
  }
13190
13198
  function renderProperties(props) {
13191
13199
  const sections = [];
13192
- const locale = [];
13193
- if (props.language) locale.push(`- Language: **${props.language}**`);
13194
- if (props.locale?.country) locale.push(`- Country: **${props.locale.country}**`);
13195
- if (props.timeZone) locale.push(`- Timezone: **${props.timeZone}**`);
13196
- if (props.paymentCurrency) locale.push(`- Currency: **${props.paymentCurrency}**`);
13197
- if (locale.length) {
13198
- sections.push(`**Locale & Region**
13199
- ${locale.join("\n")}`);
13200
+ const regionalFormat = [];
13201
+ if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
13202
+ if (props.locale?.country)
13203
+ regionalFormat.push(`- Locale region: **${props.locale.country}**`);
13204
+ if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
13205
+ if (props.paymentCurrency)
13206
+ regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
13207
+ if (regionalFormat.length) {
13208
+ sections.push(`**Regional Format**
13209
+ ${regionalFormat.join("\n")}`);
13210
+ }
13211
+ if (props.address?.country) {
13212
+ sections.push(`**Location**
13213
+ - Country: **${props.address.country}**`);
13200
13214
  }
13201
13215
  const contact = [];
13202
13216
  if (props.email) contact.push(`- Email: **${props.email}**`);
@@ -13343,6 +13357,7 @@ var known_apps_default = {
13343
13357
  "225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
13344
13358
  "d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
13345
13359
  "148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
13360
+ "14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
13346
13361
  "13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
13347
13362
  "14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
13348
13363
  "14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
@@ -13377,8 +13392,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
13377
13392
  partnerContextEnabled: options,
13378
13393
  includeAccountContext: options
13379
13394
  } : options;
13380
- const includePartnerContext = contextOptions?.partnerContextEnabled ?? false;
13381
- const includeAccountContext = contextOptions?.includeAccountContext ?? false;
13395
+ const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
13396
+ const includeAccountContext = contextOptions?.includeAccountContext ?? true;
13382
13397
  try {
13383
13398
  const accountHeaders = await auth.getAccountAuthHeaders();
13384
13399
  const noFilter = !filter?.siteId && !filter?.siteName;
@@ -13492,7 +13507,8 @@ var paramDescriptions = {
13492
13507
  "The url of the api to call - ALWAYS get the API url from the Wix REST docs or from the conversation context, the URL MUST BE ABSOLUTE URL",
13493
13508
  'NEVER guess the API url, ALWAYS get it from the conversation context, i.e from the user prompt or from the "WixREADME" tool or from the "SearchWixRESTDocumentation" tool or from the "BrowseWixRESTDocsMenu" tool or from the "ReadFullDocsArticle" tool',
13494
13509
  `Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
13495
- `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`
13510
+ `Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
13511
+ ARRAY_QUERY_PARAMS_RULE
13496
13512
  ].join("\n"),
13497
13513
  method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
13498
13514
  body: 'The request body as a JSON object or array with all the required fields and values, including nested objects. Pass the actual value (object or array), NOT a JSON string. YOU MUST NEVER MAKE UP A BODY - the body should be based on the conversation context, i.e from the user prompt OR got into the conversation context by the "ReadFullDocsArticle" tool OR by the "SearchWixAPISpec" tool OR by the "ReadFullDocsMethodSchema" tool - i.e based on the API docs, a relevant recipe you read (preferably), a code example you found in the docs, a schema you read etc.. YOU MUST NEVER ASSUME YOU KNOW WHAT THE BODY SCHEMA IS WITHOUT CONCRETE EXAMPLES OR SCHEMA DEFINITIONS FROM THE CONVERSATION CONTEXT. Prefer reading relevant recipes if you have them in context for understand the body schema for API calls.',
@@ -13565,8 +13581,8 @@ var paramDescriptions = {
13565
13581
  searchTerm: "The search term to search for in the Build Apps Documentation",
13566
13582
  maxResults: "The maximum number of results to return, default is 10, max is 15"
13567
13583
  },
13568
- SearchOverviewDocumentation: {
13569
- searchTerm: "The search term to search for in the Wix Overview Documentation",
13584
+ SearchDevelopmentDocumentation: {
13585
+ searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
13570
13586
  maxResults: "The maximum number of results to return, default is 10, max is 15"
13571
13587
  },
13572
13588
  SearchWixHeadlessDocumentation: {
@@ -14362,15 +14378,15 @@ var addDocsTools = (server, allowedTools = [
14362
14378
  }
14363
14379
  );
14364
14380
  }
14365
- if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchOverviewDocumentation")) {
14381
+ if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
14366
14382
  server.tool(
14367
- "SearchOverviewDocumentation",
14383
+ "SearchDevelopmentDocumentation",
14368
14384
  getDescription(
14369
- "SearchOverviewDocumentation",
14370
- defaultToolDescriptions.SearchOverviewDocumentation ?? ""
14385
+ "SearchDevelopmentDocumentation",
14386
+ defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
14371
14387
  ),
14372
14388
  (() => {
14373
- const d = desc("SearchOverviewDocumentation");
14389
+ const d = desc("SearchDevelopmentDocumentation");
14374
14390
  return {
14375
14391
  searchTerm: external_exports.string().describe(d.searchTerm),
14376
14392
  maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
@@ -14400,8 +14416,8 @@ var addDocsTools = (server, allowedTools = [
14400
14416
  panorama.errorMonitor().reportError(error);
14401
14417
  captureException(error, {
14402
14418
  tags: {
14403
- componentId: "SearchOverviewDocumentation",
14404
- toolName: "SearchOverviewDocumentation"
14419
+ componentId: "SearchDevelopmentDocumentation",
14420
+ toolName: "SearchDevelopmentDocumentation"
14405
14421
  }
14406
14422
  });
14407
14423
  logger.error(
@@ -15262,6 +15278,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
15262
15278
 
15263
15279
  // src/api-call/index.ts
15264
15280
  var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
15281
+ function extractReturnedRows(responseData) {
15282
+ if (responseData === null || typeof responseData !== "object") {
15283
+ return void 0;
15284
+ }
15285
+ const data = responseData;
15286
+ const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
15287
+ const raw = block?.count;
15288
+ if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
15289
+ return void 0;
15290
+ }
15291
+ const count = Number(raw);
15292
+ return Number.isFinite(count) ? count : void 0;
15293
+ }
15265
15294
  function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
15266
15295
  if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
15267
15296
  return {
@@ -15269,13 +15298,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
15269
15298
  isError: true
15270
15299
  };
15271
15300
  }
15301
+ const returnedRows = extractReturnedRows(responseData);
15272
15302
  let responseText = JSON.stringify(responseData);
15303
+ const originalLength = responseText.length;
15273
15304
  const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
15274
15305
  if (responseText.length > effectiveMax) {
15275
15306
  responseText = responseText.slice(0, effectiveMax) + `
15276
15307
  ...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
15277
15308
  }
15278
- return { text: responseText, isError: false };
15309
+ return { text: responseText, isError: false, originalLength, returnedRows };
15279
15310
  }
15280
15311
  function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
15281
15312
  const effectiveAllowedTools = [
@@ -15338,9 +15369,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
15338
15369
  data: method === "GET" ? void 0 : body
15339
15370
  });
15340
15371
  const requestId = response.headers?.["x-wix-request-id"];
15341
- setToolBiParams({ requestId, siteId });
15342
15372
  const responseData = await handleWixAPIResponse(response);
15343
15373
  const formatted = formatApiResponse(responseData, maxResponseSize);
15374
+ setToolBiParams({
15375
+ requestId,
15376
+ siteId,
15377
+ returnedRows: formatted.returnedRows,
15378
+ originalLength: formatted.originalLength
15379
+ });
15344
15380
  if (formatted.isError) {
15345
15381
  return {
15346
15382
  content: [
@@ -15479,7 +15515,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
15479
15515
  destructiveHint: true,
15480
15516
  openWorldHint: false
15481
15517
  }),
15482
- async ({ url, body, method, reason }, { httpClient }) => {
15518
+ async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
15483
15519
  logger.log(
15484
15520
  `Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
15485
15521
  );
@@ -15508,6 +15544,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
15508
15544
  });
15509
15545
  const responseData = await handleWixAPIResponse(response);
15510
15546
  const formatted = formatApiResponse(responseData, maxResponseSize);
15547
+ setToolBiParams({
15548
+ returnedRows: formatted.returnedRows,
15549
+ originalLength: formatted.originalLength
15550
+ });
15511
15551
  if (formatted.isError) {
15512
15552
  return {
15513
15553
  content: [
@@ -15730,10 +15770,13 @@ function executeTextResult(message) {
15730
15770
  content: [{ type: "text", text: message }]
15731
15771
  };
15732
15772
  }
15733
- function formatExecuteResult(data, maxResponseSize) {
15773
+ function formatExecuteResult(data, maxResponseSize, reportBi) {
15734
15774
  if (data.error) {
15735
15775
  return executeErrorResult(data.error);
15736
15776
  }
15777
+ reportBi?.({
15778
+ originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
15779
+ });
15737
15780
  return {
15738
15781
  content: [
15739
15782
  { type: "text", text: truncateResponse(data.result, maxResponseSize) }
@@ -15843,7 +15886,11 @@ function addExecuteTool(server, options) {
15843
15886
  status: data.authErrorStatus
15844
15887
  });
15845
15888
  }
15846
- return formatExecuteResult(data, maxResponseSize);
15889
+ return formatExecuteResult(
15890
+ data,
15891
+ maxResponseSize,
15892
+ extra?.setToolBiParams
15893
+ );
15847
15894
  } catch (err) {
15848
15895
  const message = err instanceof Error ? err.message : String(err);
15849
15896
  logger.log(
@@ -17687,7 +17734,7 @@ function extractText(result) {
17687
17734
  return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
17688
17735
  }
17689
17736
  var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
17690
- function formatToolResultAdditionalFields(result) {
17737
+ function formatToolResultAdditionalFields(result, extras) {
17691
17738
  const resultText = extractText(result);
17692
17739
  const contentTypes = [
17693
17740
  ...new Set(
@@ -17703,7 +17750,8 @@ function formatToolResultAdditionalFields(result) {
17703
17750
  resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
17704
17751
  resultTextLength: resultText.length,
17705
17752
  resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
17706
- resultContentTypes: contentTypes
17753
+ resultContentTypes: contentTypes,
17754
+ ...extras
17707
17755
  });
17708
17756
  }
17709
17757
  function createToolBiEvent(params) {
@@ -17941,7 +17989,10 @@ function createWixToolkit(options) {
17941
17989
  if (!toolSucceeded) {
17942
17990
  errorBody = extractText(cbResult);
17943
17991
  } else {
17944
- additionalFields = formatToolResultAdditionalFields(cbResult);
17992
+ additionalFields = formatToolResultAdditionalFields(cbResult, {
17993
+ returnedRows: toolBiParams.returnedRows,
17994
+ originalLength: toolBiParams.originalLength
17995
+ });
17945
17996
  }
17946
17997
  if (!isDevEnvironment) {
17947
17998
  if (toolSucceeded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
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.1",
46
+ "@wix/dynamic-context-enricher": "0.1.3",
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": "2841f7992b059d939012b492dc7d764ed583d4c9dc157d9aaf2859ad"
136
+ "falconPackageHash": "04c1a3fafda823896c3a8c44537812f0689d6738d5369629956fdaf4"
137
137
  }
@@ -1,6 +0,0 @@
1
- import { McpAuthenticationStrategy } from '../auth/index.js';
2
- import { WixMcpServer } from '../wix-mcp-server.js';
3
- export declare function addOpenHeadlessWixelProjectTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
4
- conductorOverride?: string;
5
- }): void;
6
- //# sourceMappingURL=open-headless-wixel-project-tool.d.ts.map
@@ -1,84 +0,0 @@
1
- import { z } from 'zod';
2
- import { openHeadlessWixelProject } from './api.js';
3
- import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
4
- const TOOL_NAME = 'openHeadlessWixelProject';
5
- const TOOL_TITLE = 'Open Headless Wixel Project';
6
- const TOOL_DESCRIPTION = `Open a headless Wixel project for background asset generation.`;
7
- const TOOL_META = {
8
- ui: { visibility: ['app'] }
9
- };
10
- export function addOpenHeadlessWixelProjectTool(server, authStrategy, options = {}) {
11
- const { getAccountAuthHeaders } = authStrategy;
12
- registerAppTool(server, TOOL_NAME, {
13
- title: TOOL_TITLE,
14
- description: TOOL_DESCRIPTION,
15
- inputSchema: {
16
- url: z.string().describe('The URL of the Wixel project'),
17
- userPrompt: z.string().describe('The user prompt for the project'),
18
- jobId: z.string().describe('The job ID'),
19
- siteId: z.string().describe('The site ID'),
20
- projectId: z.string().describe('The project ID'),
21
- conversationId: z.string().describe('The conversation ID'),
22
- withScreenshots: z
23
- .boolean()
24
- .optional()
25
- .describe('Whether to include screenshots'),
26
- useProvidedCookies: z
27
- .boolean()
28
- .optional()
29
- .describe('Whether to use provided cookies'),
30
- timeout: z.number().optional().describe('Timeout in milliseconds')
31
- },
32
- annotations: {
33
- readOnlyHint: false,
34
- destructiveHint: true,
35
- openWorldHint: false
36
- },
37
- _meta: TOOL_META
38
- }, async (args) => {
39
- try {
40
- const accountAuthHeaders = await getAccountAuthHeaders();
41
- const result = await openHeadlessWixelProject({
42
- accountAuthHeaders,
43
- url: args.url,
44
- userPrompt: args.userPrompt,
45
- jobId: args.jobId,
46
- siteId: args.siteId,
47
- projectId: args.projectId,
48
- conversationId: args.conversationId,
49
- withScreenshots: args.withScreenshots,
50
- useProvidedCookies: args.useProvidedCookies,
51
- timeout: args.timeout,
52
- conductorOverride: options.conductorOverride
53
- });
54
- return {
55
- isError: false,
56
- content: [
57
- {
58
- type: 'text',
59
- text: `Headless Wixel project opened for job ${args.jobId}`
60
- }
61
- ],
62
- structuredContent: {
63
- success: true,
64
- jobId: args.jobId,
65
- projectId: args.projectId,
66
- ...result
67
- }
68
- };
69
- }
70
- catch (error) {
71
- console.error('❌ Error opening headless Wixel project:', error);
72
- const errorMessage = error.message;
73
- return {
74
- isError: true,
75
- content: [{ type: 'text', text: errorMessage }],
76
- structuredContent: {
77
- success: false,
78
- error: errorMessage
79
- }
80
- };
81
- }
82
- });
83
- }
84
- //# sourceMappingURL=open-headless-wixel-project-tool.js.map
@@ -1,6 +0,0 @@
1
- import { McpAuthenticationStrategy } from '../auth/index.js';
2
- import { WixMcpServer } from '../wix-mcp-server.js';
3
- export declare function addPullHeadlessWixelJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
4
- conductorOverride?: string;
5
- }): void;
6
- //# sourceMappingURL=pull-headless-wixel-job-tool.d.ts.map
@@ -1,61 +0,0 @@
1
- import { pullHeadlessWixelJob } from './api.js';
2
- import { z } from 'zod';
3
- import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
4
- const TOOL_NAME = 'pullHeadlessWixelJob';
5
- const TOOL_TITLE = 'Pull Headless Wixel Job';
6
- const TOOL_DESCRIPTION = `Pull the next available headless Wixel job.`;
7
- const TOOL_META = {
8
- ui: { visibility: ['app'] }
9
- };
10
- export function addPullHeadlessWixelJobTool(server, authStrategy, options = {}) {
11
- const { getAccountAuthHeaders } = authStrategy;
12
- registerAppTool(server, TOOL_NAME, {
13
- title: TOOL_TITLE,
14
- description: TOOL_DESCRIPTION,
15
- inputSchema: {
16
- jobId: z.string().describe('The job ID')
17
- },
18
- annotations: {
19
- readOnlyHint: false,
20
- destructiveHint: false,
21
- openWorldHint: false
22
- },
23
- _meta: TOOL_META
24
- }, async (args) => {
25
- try {
26
- const accountAuthHeaders = await getAccountAuthHeaders();
27
- const result = await pullHeadlessWixelJob({
28
- accountAuthHeaders,
29
- jobId: args.jobId,
30
- conductorOverride: options.conductorOverride
31
- });
32
- return {
33
- isError: false,
34
- content: [
35
- {
36
- type: 'text',
37
- text: result.job
38
- ? `Pulled headless Wixel job: ${result.job.id}`
39
- : 'No headless Wixel job available'
40
- }
41
- ],
42
- structuredContent: {
43
- ...result
44
- }
45
- };
46
- }
47
- catch (error) {
48
- console.error('❌ Error pulling headless Wixel job:', error);
49
- const errorMessage = error.message;
50
- return {
51
- isError: true,
52
- content: [{ type: 'text', text: errorMessage }],
53
- structuredContent: {
54
- success: false,
55
- error: errorMessage
56
- }
57
- };
58
- }
59
- });
60
- }
61
- //# sourceMappingURL=pull-headless-wixel-job-tool.js.map
@@ -1,6 +0,0 @@
1
- import { McpAuthenticationStrategy } from '../auth/index.js';
2
- import { WixMcpServer } from '../wix-mcp-server.js';
3
- export declare function addUpdateHeadlessWixelJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, options?: {
4
- conductorOverride?: string;
5
- }): void;
6
- //# sourceMappingURL=update-headless-wixel-job-tool.d.ts.map
@@ -1,106 +0,0 @@
1
- import { z } from 'zod';
2
- import { updateHeadlessWixelJob } from './api.js';
3
- import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
4
- const TOOL_NAME = 'updateHeadlessWixelJob';
5
- const TOOL_TITLE = 'Update Headless Wixel Job';
6
- const TOOL_DESCRIPTION = `Update the status and data of a headless Wixel job.`;
7
- const TOOL_META = {
8
- ui: { visibility: ['app'] }
9
- };
10
- const wixelJobStatusSchema = z.enum([
11
- 'STARTED',
12
- 'IN_PROGRESS',
13
- 'COMPLETED',
14
- 'FAILED',
15
- 'CANCELLED'
16
- ]);
17
- export function addUpdateHeadlessWixelJobTool(server, authStrategy, options = {}) {
18
- const { getAccountAuthHeaders } = authStrategy;
19
- registerAppTool(server, TOOL_NAME, {
20
- title: TOOL_TITLE,
21
- description: TOOL_DESCRIPTION,
22
- inputSchema: {
23
- id: z.string().describe('The job ID'),
24
- status: wixelJobStatusSchema.describe('The job status'),
25
- userPrompt: z
26
- .string()
27
- .optional()
28
- .describe('The user prompt for the job'),
29
- shouldRefresh: z
30
- .boolean()
31
- .optional()
32
- .describe('Whether the job should refresh'),
33
- errorMessage: z
34
- .string()
35
- .optional()
36
- .describe('Error message if the job failed'),
37
- type: z.string().optional().describe('The type of asset being created'),
38
- data: z
39
- .object({
40
- siteId: z.string().optional().describe('The site ID'),
41
- assetId: z.string().optional().describe('The asset ID'),
42
- projectId: z.string().optional().describe('The project ID'),
43
- conversationId: z
44
- .string()
45
- .optional()
46
- .describe('The conversation ID')
47
- })
48
- .optional()
49
- .describe('Additional job data'),
50
- userId: z.string().optional().describe('The user ID'),
51
- accountId: z.string().optional().describe('The account ID')
52
- },
53
- annotations: {
54
- readOnlyHint: false,
55
- destructiveHint: true,
56
- openWorldHint: false
57
- },
58
- _meta: TOOL_META
59
- }, async (args) => {
60
- try {
61
- const accountAuthHeaders = await getAccountAuthHeaders();
62
- const result = await updateHeadlessWixelJob({
63
- accountAuthHeaders,
64
- conductorOverride: options.conductorOverride,
65
- job: {
66
- id: args.id,
67
- status: args.status,
68
- userPrompt: args.userPrompt,
69
- shouldRefresh: args.shouldRefresh,
70
- errorMessage: args.errorMessage,
71
- type: args.type,
72
- data: args.data,
73
- userId: args.userId,
74
- accountId: args.accountId
75
- }
76
- });
77
- return {
78
- isError: false,
79
- content: [
80
- {
81
- type: 'text',
82
- text: `Headless Wixel job ${args.id} updated to status: ${args.status}`
83
- }
84
- ],
85
- structuredContent: {
86
- jobId: args.id,
87
- status: args.status,
88
- ...result
89
- }
90
- };
91
- }
92
- catch (error) {
93
- console.error('❌ Error updating headless Wixel job:', error);
94
- const errorMessage = error.message;
95
- return {
96
- isError: true,
97
- content: [{ type: 'text', text: errorMessage }],
98
- structuredContent: {
99
- success: false,
100
- error: errorMessage
101
- }
102
- };
103
- }
104
- });
105
- }
106
- //# sourceMappingURL=update-headless-wixel-job-tool.js.map