@wix/mcp 1.0.79 → 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.
- package/README.md +1 -1
- package/build/bin-standalone.js +94 -36
- package/build/cjs/index.cjs +449 -459
- package/build/cjs/toolkit.cjs +112 -44
- package/build/dts/account-tools/get-profile-tool.d.ts +5 -0
- package/build/dts/account-tools/get-profile-tool.js +49 -0
- package/build/dts/api-call/index.js +41 -3
- package/build/dts/code-mode/index.js +8 -2
- package/build/dts/config/api-request-rules.d.ts +11 -0
- package/build/dts/config/api-request-rules.js +11 -0
- package/build/dts/config/default-config.d.ts +2 -2
- package/build/dts/config/default-config.js +19 -9
- package/build/dts/config/param-descriptions.d.ts +1 -1
- package/build/dts/config/param-descriptions.js +5 -3
- package/build/dts/docs/docs.js +6 -6
- package/build/dts/index.d.ts +1 -0
- package/build/dts/index.js +1 -0
- package/build/dts/infra/tool-bi.d.ts +1 -1
- package/build/dts/infra/tool-bi.js +3 -2
- package/build/dts/toolkit-entry.d.cts +3 -1
- package/build/dts/toolkit-entry.d.ts +3 -1
- package/build/dts/toolkit.d.ts +2 -0
- package/build/dts/toolkit.js +18 -21
- package/build/dts/wix-mcp-server.d.ts +2 -0
- package/build/dts/wix-mcp-server.js +4 -1
- package/build/dts/wixel/api.d.ts +0 -60
- package/build/dts/wixel/api.js +1 -50
- package/build/dts/wixel/constants.d.ts +0 -1
- package/build/dts/wixel/constants.js +0 -1
- package/build/dts/wixel/index.d.ts +0 -3
- package/build/dts/wixel/index.js +0 -9
- package/build/esm/index.js +367 -401
- package/build/esm/toolkit.js +112 -44
- package/package.json +4 -3
- package/build/dts/wixel/open-headless-wixel-project-tool.d.ts +0 -6
- package/build/dts/wixel/open-headless-wixel-project-tool.js +0 -84
- package/build/dts/wixel/pull-headless-wixel-job-tool.d.ts +0 -6
- package/build/dts/wixel/pull-headless-wixel-job-tool.js +0 -61
- package/build/dts/wixel/update-headless-wixel-job-tool.d.ts +0 -6
- package/build/dts/wixel/update-headless-wixel-job-tool.js +0 -106
package/build/esm/toolkit.js
CHANGED
|
@@ -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.
|
|
@@ -12085,7 +12088,7 @@ var DISCOVERY_FLOWS = [
|
|
|
12085
12088
|
"- METHOD CODE EXAMPLE BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call API using CallWixSiteAPI() based on the method code examples",
|
|
12086
12089
|
"- FULL SCHEMA BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call API using CallWixSiteAPI() based on the schema"
|
|
12087
12090
|
];
|
|
12088
|
-
function buildSystemReminderGuidelines(includeReadme) {
|
|
12091
|
+
function buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance) {
|
|
12089
12092
|
const exception = includeReadme ? "**Exception:** " : "";
|
|
12090
12093
|
const lines = [];
|
|
12091
12094
|
if (includeReadme) {
|
|
@@ -12097,9 +12100,13 @@ function buildSystemReminderGuidelines(includeReadme) {
|
|
|
12097
12100
|
);
|
|
12098
12101
|
}
|
|
12099
12102
|
lines.push(
|
|
12100
|
-
`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? "skip WixREADME and " : ""}call ListWixSites directly
|
|
12101
|
-
`${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? "WixREADME and " : ""}all docs/schema/API flows \u2014 call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`
|
|
12103
|
+
`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? "skip WixREADME and " : ""}call ListWixSites directly.`
|
|
12102
12104
|
);
|
|
12105
|
+
if (includeImageUploadGuidance) {
|
|
12106
|
+
lines.push(
|
|
12107
|
+
`${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? "WixREADME and " : ""}all docs/schema/API flows \u2014 call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`
|
|
12108
|
+
);
|
|
12109
|
+
}
|
|
12103
12110
|
if (includeReadme) {
|
|
12104
12111
|
lines.push(
|
|
12105
12112
|
"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."
|
|
@@ -12126,9 +12133,15 @@ function buildSystemReminderFlows(includeReadme) {
|
|
|
12126
12133
|
lines.push(...DISCOVERY_FLOWS);
|
|
12127
12134
|
return lines.join("\n");
|
|
12128
12135
|
}
|
|
12129
|
-
var SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(
|
|
12130
|
-
|
|
12131
|
-
|
|
12136
|
+
var SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(
|
|
12137
|
+
true,
|
|
12138
|
+
true
|
|
12139
|
+
);
|
|
12140
|
+
function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
|
|
12141
|
+
const guidelines = buildSystemReminderGuidelines(
|
|
12142
|
+
includeReadme,
|
|
12143
|
+
includeImageUploadGuidance
|
|
12144
|
+
);
|
|
12132
12145
|
const flows = buildSystemReminderFlows(includeReadme);
|
|
12133
12146
|
return dedent_default`
|
|
12134
12147
|
<agent-mandatory-instructions>
|
|
@@ -12186,11 +12199,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
|
12186
12199
|
CODE CONTRACT:
|
|
12187
12200
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
12188
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.
|
|
12189
12203
|
|
|
12190
12204
|
CONFIRM API CONTRACTS:
|
|
12191
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.
|
|
12192
12206
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
12193
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}
|
|
12194
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.
|
|
12195
12210
|
`;
|
|
12196
12211
|
var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
|
|
@@ -12206,6 +12221,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
12206
12221
|
SCOPE AND SITE TARGETING:
|
|
12207
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.
|
|
12208
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.
|
|
12209
12225
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
12210
12226
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
12211
12227
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -12339,8 +12355,11 @@ var executeWixApiDescription = dedent_default`
|
|
|
12339
12355
|
|
|
12340
12356
|
${EXECUTE_WIX_API_MULTI_SITE_EXAMPLE}
|
|
12341
12357
|
`;
|
|
12342
|
-
function buildToolDescriptions(includeReadme) {
|
|
12343
|
-
const reminder = buildSystemReminder(
|
|
12358
|
+
function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true) {
|
|
12359
|
+
const reminder = buildSystemReminder(
|
|
12360
|
+
includeReadme,
|
|
12361
|
+
includeImageUploadGuidance
|
|
12362
|
+
);
|
|
12344
12363
|
return {
|
|
12345
12364
|
WixREADME: dedent_default`
|
|
12346
12365
|
# Tool: WixREADME
|
|
@@ -12391,6 +12410,7 @@ function buildToolDescriptions(includeReadme) {
|
|
|
12391
12410
|
**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.
|
|
12392
12411
|
${reminder}
|
|
12393
12412
|
`,
|
|
12413
|
+
get_profile: "Returns the authenticated user's email address",
|
|
12394
12414
|
GetSiteContext: dedent_default`
|
|
12395
12415
|
Fetches deep context for a specific Wix site and returns it as structured markdown.
|
|
12396
12416
|
|
|
@@ -12522,8 +12542,10 @@ function buildToolDescriptions(includeReadme) {
|
|
|
12522
12542
|
SearchBuildAppsDocumentation: dedent_default`
|
|
12523
12543
|
Searches the Wix Build Apps documentation.
|
|
12524
12544
|
`,
|
|
12525
|
-
|
|
12526
|
-
|
|
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.
|
|
12527
12549
|
`,
|
|
12528
12550
|
SearchWixHeadlessDocumentation: dedent_default`
|
|
12529
12551
|
Searches the Wix Headless documentation.
|
|
@@ -13175,14 +13197,20 @@ function renderApps(apps, knownApps) {
|
|
|
13175
13197
|
}
|
|
13176
13198
|
function renderProperties(props) {
|
|
13177
13199
|
const sections = [];
|
|
13178
|
-
const
|
|
13179
|
-
if (props.language)
|
|
13180
|
-
if (props.locale?.country)
|
|
13181
|
-
|
|
13182
|
-
if (props.
|
|
13183
|
-
if (
|
|
13184
|
-
|
|
13185
|
-
|
|
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}**`);
|
|
13186
13214
|
}
|
|
13187
13215
|
const contact = [];
|
|
13188
13216
|
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
@@ -13329,6 +13357,7 @@ var known_apps_default = {
|
|
|
13329
13357
|
"225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
|
|
13330
13358
|
"d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
|
|
13331
13359
|
"148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
|
|
13360
|
+
"14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
|
|
13332
13361
|
"13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
|
|
13333
13362
|
"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
|
|
13334
13363
|
"14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
|
|
@@ -13363,8 +13392,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
13363
13392
|
partnerContextEnabled: options,
|
|
13364
13393
|
includeAccountContext: options
|
|
13365
13394
|
} : options;
|
|
13366
|
-
const includePartnerContext = contextOptions?.partnerContextEnabled ??
|
|
13367
|
-
const includeAccountContext = contextOptions?.includeAccountContext ??
|
|
13395
|
+
const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
|
|
13396
|
+
const includeAccountContext = contextOptions?.includeAccountContext ?? true;
|
|
13368
13397
|
try {
|
|
13369
13398
|
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
13370
13399
|
const noFilter = !filter?.siteId && !filter?.siteName;
|
|
@@ -13478,7 +13507,8 @@ var paramDescriptions = {
|
|
|
13478
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",
|
|
13479
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',
|
|
13480
13509
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
|
|
13481
|
-
`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
|
|
13482
13512
|
].join("\n"),
|
|
13483
13513
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
13484
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.',
|
|
@@ -13551,8 +13581,8 @@ var paramDescriptions = {
|
|
|
13551
13581
|
searchTerm: "The search term to search for in the Build Apps Documentation",
|
|
13552
13582
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
13553
13583
|
},
|
|
13554
|
-
|
|
13555
|
-
searchTerm: "The search term
|
|
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.",
|
|
13556
13586
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
13557
13587
|
},
|
|
13558
13588
|
SearchWixHeadlessDocumentation: {
|
|
@@ -14348,15 +14378,15 @@ var addDocsTools = (server, allowedTools = [
|
|
|
14348
14378
|
}
|
|
14349
14379
|
);
|
|
14350
14380
|
}
|
|
14351
|
-
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("
|
|
14381
|
+
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
|
|
14352
14382
|
server.tool(
|
|
14353
|
-
"
|
|
14383
|
+
"SearchDevelopmentDocumentation",
|
|
14354
14384
|
getDescription(
|
|
14355
|
-
"
|
|
14356
|
-
defaultToolDescriptions.
|
|
14385
|
+
"SearchDevelopmentDocumentation",
|
|
14386
|
+
defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
|
|
14357
14387
|
),
|
|
14358
14388
|
(() => {
|
|
14359
|
-
const d = desc("
|
|
14389
|
+
const d = desc("SearchDevelopmentDocumentation");
|
|
14360
14390
|
return {
|
|
14361
14391
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
14362
14392
|
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
|
|
@@ -14386,8 +14416,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
14386
14416
|
panorama.errorMonitor().reportError(error);
|
|
14387
14417
|
captureException(error, {
|
|
14388
14418
|
tags: {
|
|
14389
|
-
componentId: "
|
|
14390
|
-
toolName: "
|
|
14419
|
+
componentId: "SearchDevelopmentDocumentation",
|
|
14420
|
+
toolName: "SearchDevelopmentDocumentation"
|
|
14391
14421
|
}
|
|
14392
14422
|
});
|
|
14393
14423
|
logger.error(
|
|
@@ -15248,6 +15278,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
|
|
|
15248
15278
|
|
|
15249
15279
|
// src/api-call/index.ts
|
|
15250
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
|
+
}
|
|
15251
15294
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
15252
15295
|
if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
|
|
15253
15296
|
return {
|
|
@@ -15255,13 +15298,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
15255
15298
|
isError: true
|
|
15256
15299
|
};
|
|
15257
15300
|
}
|
|
15301
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
15258
15302
|
let responseText = JSON.stringify(responseData);
|
|
15303
|
+
const originalLength = responseText.length;
|
|
15259
15304
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
15260
15305
|
if (responseText.length > effectiveMax) {
|
|
15261
15306
|
responseText = responseText.slice(0, effectiveMax) + `
|
|
15262
15307
|
...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
15263
15308
|
}
|
|
15264
|
-
return { text: responseText, isError: false };
|
|
15309
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
15265
15310
|
}
|
|
15266
15311
|
function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
15267
15312
|
const effectiveAllowedTools = [
|
|
@@ -15324,9 +15369,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15324
15369
|
data: method === "GET" ? void 0 : body
|
|
15325
15370
|
});
|
|
15326
15371
|
const requestId = response.headers?.["x-wix-request-id"];
|
|
15327
|
-
setToolBiParams({ requestId, siteId });
|
|
15328
15372
|
const responseData = await handleWixAPIResponse(response);
|
|
15329
15373
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
15374
|
+
setToolBiParams({
|
|
15375
|
+
requestId,
|
|
15376
|
+
siteId,
|
|
15377
|
+
returnedRows: formatted.returnedRows,
|
|
15378
|
+
originalLength: formatted.originalLength
|
|
15379
|
+
});
|
|
15330
15380
|
if (formatted.isError) {
|
|
15331
15381
|
return {
|
|
15332
15382
|
content: [
|
|
@@ -15465,7 +15515,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15465
15515
|
destructiveHint: true,
|
|
15466
15516
|
openWorldHint: false
|
|
15467
15517
|
}),
|
|
15468
|
-
async ({ url, body, method, reason }, { httpClient }) => {
|
|
15518
|
+
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
15469
15519
|
logger.log(
|
|
15470
15520
|
`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
|
|
15471
15521
|
);
|
|
@@ -15494,6 +15544,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
15494
15544
|
});
|
|
15495
15545
|
const responseData = await handleWixAPIResponse(response);
|
|
15496
15546
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
15547
|
+
setToolBiParams({
|
|
15548
|
+
returnedRows: formatted.returnedRows,
|
|
15549
|
+
originalLength: formatted.originalLength
|
|
15550
|
+
});
|
|
15497
15551
|
if (formatted.isError) {
|
|
15498
15552
|
return {
|
|
15499
15553
|
content: [
|
|
@@ -15716,10 +15770,13 @@ function executeTextResult(message) {
|
|
|
15716
15770
|
content: [{ type: "text", text: message }]
|
|
15717
15771
|
};
|
|
15718
15772
|
}
|
|
15719
|
-
function formatExecuteResult(data, maxResponseSize) {
|
|
15773
|
+
function formatExecuteResult(data, maxResponseSize, reportBi) {
|
|
15720
15774
|
if (data.error) {
|
|
15721
15775
|
return executeErrorResult(data.error);
|
|
15722
15776
|
}
|
|
15777
|
+
reportBi?.({
|
|
15778
|
+
originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
|
|
15779
|
+
});
|
|
15723
15780
|
return {
|
|
15724
15781
|
content: [
|
|
15725
15782
|
{ type: "text", text: truncateResponse(data.result, maxResponseSize) }
|
|
@@ -15829,7 +15886,11 @@ function addExecuteTool(server, options) {
|
|
|
15829
15886
|
status: data.authErrorStatus
|
|
15830
15887
|
});
|
|
15831
15888
|
}
|
|
15832
|
-
return formatExecuteResult(
|
|
15889
|
+
return formatExecuteResult(
|
|
15890
|
+
data,
|
|
15891
|
+
maxResponseSize,
|
|
15892
|
+
extra?.setToolBiParams
|
|
15893
|
+
);
|
|
15833
15894
|
} catch (err) {
|
|
15834
15895
|
const message = err instanceof Error ? err.message : String(err);
|
|
15835
15896
|
logger.log(
|
|
@@ -17673,7 +17734,7 @@ function extractText(result) {
|
|
|
17673
17734
|
return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
|
|
17674
17735
|
}
|
|
17675
17736
|
var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
|
|
17676
|
-
function formatToolResultAdditionalFields(result) {
|
|
17737
|
+
function formatToolResultAdditionalFields(result, extras) {
|
|
17677
17738
|
const resultText = extractText(result);
|
|
17678
17739
|
const contentTypes = [
|
|
17679
17740
|
...new Set(
|
|
@@ -17689,7 +17750,8 @@ function formatToolResultAdditionalFields(result) {
|
|
|
17689
17750
|
resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
|
|
17690
17751
|
resultTextLength: resultText.length,
|
|
17691
17752
|
resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
|
|
17692
|
-
resultContentTypes: contentTypes
|
|
17753
|
+
resultContentTypes: contentTypes,
|
|
17754
|
+
...extras
|
|
17693
17755
|
});
|
|
17694
17756
|
}
|
|
17695
17757
|
function createToolBiEvent(params) {
|
|
@@ -17783,13 +17845,13 @@ function createWixToolkit(options) {
|
|
|
17783
17845
|
clientName,
|
|
17784
17846
|
hooks,
|
|
17785
17847
|
conversationId,
|
|
17786
|
-
includeReadmeMentions = false
|
|
17848
|
+
includeReadmeMentions = false,
|
|
17849
|
+
includeImageUploadGuidance = false
|
|
17787
17850
|
} = options;
|
|
17788
17851
|
const authStrategy = normalizeAuth(auth);
|
|
17789
17852
|
const executeWixApiRequested = isExecuteWixApiRequested(api);
|
|
17790
|
-
|
|
17853
|
+
const descriptionsWithoutReadme = buildToolDescriptions(includeReadmeMentions, includeImageUploadGuidance);
|
|
17791
17854
|
if (!includeReadmeMentions) {
|
|
17792
|
-
descriptionsWithoutReadme = buildToolDescriptions(false);
|
|
17793
17855
|
delete descriptionsWithoutReadme.WixREADME;
|
|
17794
17856
|
}
|
|
17795
17857
|
const sessionId = v4_default();
|
|
@@ -17806,13 +17868,16 @@ function createWixToolkit(options) {
|
|
|
17806
17868
|
authStrategy,
|
|
17807
17869
|
dynamicContextEnabled: true,
|
|
17808
17870
|
// README-free defaults first so consumer overrides still win.
|
|
17809
|
-
toolDescriptions:
|
|
17871
|
+
toolDescriptions: {
|
|
17872
|
+
...descriptionsWithoutReadme,
|
|
17873
|
+
...docsOptions.toolDescriptions
|
|
17874
|
+
}
|
|
17810
17875
|
});
|
|
17811
17876
|
} else {
|
|
17812
17877
|
addDocsTools(server, void 0, {
|
|
17813
17878
|
authStrategy,
|
|
17814
17879
|
dynamicContextEnabled: true,
|
|
17815
|
-
|
|
17880
|
+
toolDescriptions: descriptionsWithoutReadme
|
|
17816
17881
|
});
|
|
17817
17882
|
}
|
|
17818
17883
|
if (api) {
|
|
@@ -17825,7 +17890,7 @@ function createWixToolkit(options) {
|
|
|
17825
17890
|
maxResponseSize,
|
|
17826
17891
|
codeModeBaseUrl = "https://mcp.wix.com"
|
|
17827
17892
|
} = api;
|
|
17828
|
-
const effectiveToolDescriptions =
|
|
17893
|
+
const effectiveToolDescriptions = {
|
|
17829
17894
|
...descriptionsWithoutReadme,
|
|
17830
17895
|
...executeWixApiRequested ? executeCodeModeToolDescriptions : {},
|
|
17831
17896
|
...toolDescriptions
|
|
@@ -17924,7 +17989,10 @@ function createWixToolkit(options) {
|
|
|
17924
17989
|
if (!toolSucceeded) {
|
|
17925
17990
|
errorBody = extractText(cbResult);
|
|
17926
17991
|
} else {
|
|
17927
|
-
additionalFields = formatToolResultAdditionalFields(cbResult
|
|
17992
|
+
additionalFields = formatToolResultAdditionalFields(cbResult, {
|
|
17993
|
+
returnedRows: toolBiParams.returnedRows,
|
|
17994
|
+
originalLength: toolBiParams.originalLength
|
|
17995
|
+
});
|
|
17928
17996
|
}
|
|
17929
17997
|
if (!isDevEnvironment) {
|
|
17930
17998
|
if (toolSucceeded) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/mcp",
|
|
3
|
-
"version": "1.0.
|
|
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": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@wix/ambassador-editorurls-v2-editor-urls": "^1.0.43",
|
|
30
30
|
"@wix/ambassador-funnel-templates-gallery-v2-template": "^1.0.90",
|
|
31
31
|
"@wix/ambassador-genie-chat-service-v1-no-entity": "^1.0.130",
|
|
32
|
+
"@wix/ambassador-identity-account-v1-user": "^1.0.7",
|
|
32
33
|
"@wix/ambassador-metasite-api-v1-meta-site": "^1.0.133",
|
|
33
34
|
"@wix/ambassador-site-actions-v1-site-actions": "^1.0.55",
|
|
34
35
|
"@wix/ambassador-urls-api-v2-published-site-urls": "^1.0.31",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"@wix/bi-logger-wix-code-data": "^1.485.0",
|
|
43
44
|
"@wix/common-widget-types": "^1.77.0",
|
|
44
45
|
"@wix/design-system": "^1.256.2",
|
|
45
|
-
"@wix/dynamic-context-enricher": "0.1.
|
|
46
|
+
"@wix/dynamic-context-enricher": "0.1.3",
|
|
46
47
|
"@wix/http-client": "^2.85.0",
|
|
47
48
|
"@wix/panorama-client-node": "^3.253.0",
|
|
48
49
|
"@wix/standalone-node-bi-logger": "^1.7.24",
|
|
@@ -132,5 +133,5 @@
|
|
|
132
133
|
]
|
|
133
134
|
}
|
|
134
135
|
},
|
|
135
|
-
"falconPackageHash": "
|
|
136
|
+
"falconPackageHash": "04c1a3fafda823896c3a8c44537812f0689d6738d5369629956fdaf4"
|
|
136
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
|