@wix/mcp 1.0.28 → 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.
- package/README.md +1 -0
- package/build/bin-standalone.js +214 -5
- package/build/bin-standalone.js.map +2 -2
- package/build/cjs/index.cjs +388 -16
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/bin.d.ts +1 -1
- package/build/dts/bin.d.ts.map +1 -1
- package/build/dts/code-mode/index.d.ts +10 -0
- package/build/dts/code-mode/index.d.ts.map +1 -0
- package/build/dts/code-mode/index.js +150 -0
- package/build/dts/code-mode/index.js.map +1 -0
- package/build/dts/config/default-config.d.ts +1 -0
- package/build/dts/config/default-config.d.ts.map +1 -1
- package/build/dts/config/default-config.js +147 -2
- package/build/dts/config/default-config.js.map +1 -1
- package/build/dts/config/param-descriptions.d.ts +5 -0
- package/build/dts/config/param-descriptions.d.ts.map +1 -1
- package/build/dts/config/param-descriptions.js +7 -2
- package/build/dts/config/param-descriptions.js.map +1 -1
- package/build/dts/docs/docs.d.ts +1 -1
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +56 -2
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/docs/semanticSearch.d.ts.map +1 -1
- package/build/dts/docs/semanticSearch.js +3 -0
- package/build/dts/docs/semanticSearch.js.map +1 -1
- package/build/dts/docs/semanticSearch.test.js +33 -0
- package/build/dts/docs/semanticSearch.test.js.map +1 -1
- package/build/dts/index.d.ts +1 -0
- package/build/dts/index.d.ts.map +1 -1
- package/build/dts/index.js +2 -0
- package/build/dts/index.js.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +0 -7
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.js +6 -10
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
- package/build/esm/index.js +387 -16
- package/build/esm/index.js.map +4 -4
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -28720,6 +28720,8 @@ var runSemanticSearch = async (toolName, toolParams, maxResults = 20, rerank = f
|
|
|
28720
28720
|
kbNames.push("HEADLESS_KB_ID");
|
|
28721
28721
|
} else if (toolName === "VELO") {
|
|
28722
28722
|
kbNames.push("VELO_DOCS_KB_ID", "VELO_METHODS_KB_ID");
|
|
28723
|
+
} else if (toolName === "CLI") {
|
|
28724
|
+
kbNames.push("CLI_KB_ID");
|
|
28723
28725
|
}
|
|
28724
28726
|
logger2.log(
|
|
28725
28727
|
`[SemanticSearch] Tool: ${toolName}, KBs: [${kbNames.join(", ")}], Query: "${toolParams.searchTerm}"`
|
|
@@ -29217,7 +29219,8 @@ var defaultToolDescriptions = {
|
|
|
29217
29219
|
${SYSTEM_REMINDER}
|
|
29218
29220
|
`,
|
|
29219
29221
|
CallWixSiteAPI: dedent_default`
|
|
29220
|
-
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
|
|
29222
|
+
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.
|
|
29223
|
+
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"}}).
|
|
29221
29224
|
The API endpoint url param MUST ALWAYS be taken from the conversation context.
|
|
29222
29225
|
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.
|
|
29223
29226
|
Error Handling:
|
|
@@ -29234,6 +29237,7 @@ var defaultToolDescriptions = {
|
|
|
29234
29237
|
`,
|
|
29235
29238
|
ManageWixSite: dedent_default`
|
|
29236
29239
|
Use account level API in order to create a site, update a site and publish site.
|
|
29240
|
+
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"}}).
|
|
29237
29241
|
The API endpoint url param MUST ALWAYS be taken from the conversation context.
|
|
29238
29242
|
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.
|
|
29239
29243
|
${SYSTEM_REMINDER}
|
|
@@ -29311,6 +29315,148 @@ var defaultToolDescriptions = {
|
|
|
29311
29315
|
`,
|
|
29312
29316
|
VeloREADME: dedent_default`
|
|
29313
29317
|
This tool is set for providing Velo context in order to be used by the agent for executing Velo-related tasks.
|
|
29318
|
+
`,
|
|
29319
|
+
SearchWixCLIDocumentation: dedent_default`
|
|
29320
|
+
Searches the Wix CLI documentation for website development and CLI commands.
|
|
29321
|
+
Use this tool when you need information about Wix CLI commands, local development workflows, or CLI-based website development.
|
|
29322
|
+
Specify what you need information about (e.g., 'wix dev command', 'local development setup', 'CLI authentication', 'wix deploy').
|
|
29323
|
+
If you can't find what you need, try to rephrase your search term or use bigger maxResults value.
|
|
29324
|
+
${SYSTEM_REMINDER}
|
|
29325
|
+
`,
|
|
29326
|
+
SearchWixAPISpec: dedent_default`
|
|
29327
|
+
Search the Wix REST API documentation by writing JavaScript code that runs in a sandboxed environment.
|
|
29328
|
+
Your code has access to two globals:
|
|
29329
|
+
|
|
29330
|
+
**lightIndex** — Array of all Wix REST API resources (~330):
|
|
29331
|
+
\`\`\`typescript
|
|
29332
|
+
interface LightResource {
|
|
29333
|
+
name: string; // e.g. "Products V3", "Contact V4"
|
|
29334
|
+
resourceId: string;
|
|
29335
|
+
menuPath: string[]; // e.g. ["business-solutions", "stores", "catalog-v3", "products-v3"]
|
|
29336
|
+
methods: Array<{
|
|
29337
|
+
operationId: string; // e.g. "wix.stores.catalog.v3.CatalogApi.CreateProduct"
|
|
29338
|
+
summary: string; // e.g. "Create Product"
|
|
29339
|
+
httpMethod: string; // "get" | "post" | "patch" | "delete"
|
|
29340
|
+
path: string; // e.g. "/v3/products"
|
|
29341
|
+
description: string; // truncated to 200 chars
|
|
29342
|
+
}>;
|
|
29343
|
+
}
|
|
29344
|
+
\`\`\`
|
|
29345
|
+
|
|
29346
|
+
**getResourceSchema(resourceId)** — Async function returning the full schema for a resource:
|
|
29347
|
+
\`\`\`typescript
|
|
29348
|
+
interface FullSchema {
|
|
29349
|
+
title: string;
|
|
29350
|
+
description: string;
|
|
29351
|
+
fqdn: string;
|
|
29352
|
+
methods: Array<{
|
|
29353
|
+
summary: string;
|
|
29354
|
+
description: string;
|
|
29355
|
+
operationId: string;
|
|
29356
|
+
httpMethod: string;
|
|
29357
|
+
path: string;
|
|
29358
|
+
servers: Array<{ url: string }>; // Base URLs (e.g. "https://www.wixapis.com/...")
|
|
29359
|
+
requestBody: object | null;
|
|
29360
|
+
responses: object;
|
|
29361
|
+
parameters: Array<object>;
|
|
29362
|
+
permissions: string[];
|
|
29363
|
+
legacyExamples: Array<{ // Curl examples
|
|
29364
|
+
content: { title: string; request: string; response: string };
|
|
29365
|
+
}>;
|
|
29366
|
+
sdkData: { // JS SDK examples
|
|
29367
|
+
packageName: string;
|
|
29368
|
+
namespace: string;
|
|
29369
|
+
methodExamples: Array<{ title: string; content: string }>;
|
|
29370
|
+
};
|
|
29371
|
+
}>;
|
|
29372
|
+
components: { schemas: object };
|
|
29373
|
+
}
|
|
29374
|
+
\`\`\`
|
|
29375
|
+
|
|
29376
|
+
Your code MUST be an \`async function()\` expression that returns a value.
|
|
29377
|
+
|
|
29378
|
+
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.
|
|
29379
|
+
|
|
29380
|
+
Examples:
|
|
29381
|
+
|
|
29382
|
+
Find APIs by keyword:
|
|
29383
|
+
\`\`\`javascript
|
|
29384
|
+
async function() {
|
|
29385
|
+
return lightIndex.filter(r => r.methods.some(m => m.summary.toLowerCase().includes("query products")))
|
|
29386
|
+
.map(r => ({ name: r.name, methods: r.methods.map(m => m.summary + " (" + m.httpMethod.toUpperCase() + " " + m.path + ")") }));
|
|
29387
|
+
}
|
|
29388
|
+
\`\`\`
|
|
29389
|
+
|
|
29390
|
+
Get full schema with base URL, curl examples, and permissions:
|
|
29391
|
+
\`\`\`javascript
|
|
29392
|
+
async function() {
|
|
29393
|
+
const resource = lightIndex.find(r => r.name === "Contact V4");
|
|
29394
|
+
const schema = await getResourceSchema(resource.resourceId);
|
|
29395
|
+
const method = schema.methods.find(m => m.summary === "Query Contacts");
|
|
29396
|
+
return {
|
|
29397
|
+
baseUrl: method.servers?.find(s => s.url.includes("wixapis.com"))?.url,
|
|
29398
|
+
path: method.path,
|
|
29399
|
+
httpMethod: method.httpMethod,
|
|
29400
|
+
permissions: method.permissions,
|
|
29401
|
+
requestBody: method.requestBody,
|
|
29402
|
+
curlExample: method.legacyExamples?.[0]?.content,
|
|
29403
|
+
sdkExample: method.sdkData?.methodExamples?.[0]?.content
|
|
29404
|
+
};
|
|
29405
|
+
}
|
|
29406
|
+
\`\`\`
|
|
29407
|
+
|
|
29408
|
+
Browse a vertical:
|
|
29409
|
+
\`\`\`javascript
|
|
29410
|
+
async function() {
|
|
29411
|
+
return lightIndex.filter(r => r.menuPath[0] === "crm")
|
|
29412
|
+
.map(r => ({ name: r.name, path: r.menuPath.join(" > "), methods: r.methods.length }));
|
|
29413
|
+
}
|
|
29414
|
+
\`\`\`
|
|
29415
|
+
`,
|
|
29416
|
+
ExecuteWixAPI: dedent_default`
|
|
29417
|
+
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.
|
|
29418
|
+
|
|
29419
|
+
Available in your code:
|
|
29420
|
+
\`\`\`typescript
|
|
29421
|
+
interface WixRequestOptions {
|
|
29422
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
29423
|
+
url: string; // Full URL from schema servers field, e.g. "https://www.wixapis.com/contacts/v4/contacts"
|
|
29424
|
+
body?: unknown;
|
|
29425
|
+
headers?: Record<string, string>; // Do NOT set Authorization — it is injected automatically
|
|
29426
|
+
}
|
|
29427
|
+
|
|
29428
|
+
interface WixResponse<T = unknown> {
|
|
29429
|
+
status: number;
|
|
29430
|
+
data: T;
|
|
29431
|
+
}
|
|
29432
|
+
|
|
29433
|
+
declare const wix: {
|
|
29434
|
+
request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
|
|
29435
|
+
};
|
|
29436
|
+
|
|
29437
|
+
declare const siteId: string | undefined;
|
|
29438
|
+
\`\`\`
|
|
29439
|
+
|
|
29440
|
+
Your code MUST be an \`async function()\` expression that returns the result.
|
|
29441
|
+
|
|
29442
|
+
Example — query products then update one:
|
|
29443
|
+
\`\`\`javascript
|
|
29444
|
+
async function() {
|
|
29445
|
+
const list = await wix.request({
|
|
29446
|
+
method: "POST",
|
|
29447
|
+
url: "https://www.wixapis.com/stores/v1/products/query",
|
|
29448
|
+
body: { query: { paging: { limit: 5 } } }
|
|
29449
|
+
});
|
|
29450
|
+
const product = list.data.products[0];
|
|
29451
|
+
if (!product) return { error: "No products found" };
|
|
29452
|
+
const updated = await wix.request({
|
|
29453
|
+
method: "PATCH",
|
|
29454
|
+
url: \`https://www.wixapis.com/stores/v1/products/\${product.id}\`,
|
|
29455
|
+
body: { product: { name: "Updated Name" } }
|
|
29456
|
+
});
|
|
29457
|
+
return updated.data;
|
|
29458
|
+
}
|
|
29459
|
+
\`\`\`
|
|
29314
29460
|
`
|
|
29315
29461
|
};
|
|
29316
29462
|
var defaultReadmeDocs = [
|
|
@@ -29394,7 +29540,8 @@ function mergeConfig(base, overrides) {
|
|
|
29394
29540
|
toolHints: { ...base.toolHints, ...overrides.toolHints },
|
|
29395
29541
|
docsTools: overrides.docsTools ?? base.docsTools,
|
|
29396
29542
|
getToKnowWixEnabled: overrides.getToKnowWixEnabled ?? base.getToKnowWixEnabled,
|
|
29397
|
-
createWixBusinessGuideEnabled: overrides.createWixBusinessGuideEnabled ?? base.createWixBusinessGuideEnabled
|
|
29543
|
+
createWixBusinessGuideEnabled: overrides.createWixBusinessGuideEnabled ?? base.createWixBusinessGuideEnabled,
|
|
29544
|
+
codeModeEnabled: overrides.codeModeEnabled ?? base.codeModeEnabled
|
|
29398
29545
|
};
|
|
29399
29546
|
}
|
|
29400
29547
|
var defaultConfig = {
|
|
@@ -29628,7 +29775,7 @@ var paramDescriptions = {
|
|
|
29628
29775
|
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`
|
|
29629
29776
|
].join("\n"),
|
|
29630
29777
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
29631
|
-
body: 'The request body object. 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 "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.',
|
|
29778
|
+
body: 'The request body as a JSON object with all the required fields and values, including nested objects. Pass the actual object, 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 "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.',
|
|
29632
29779
|
reason: "One sentence explaining the original user request and why you are calling this API to complete it.",
|
|
29633
29780
|
sourceDocUrl: [
|
|
29634
29781
|
"The URL of the documentation or recipe where you found this API endpoint.",
|
|
@@ -29646,7 +29793,7 @@ var paramDescriptions = {
|
|
|
29646
29793
|
ManageWixSite: {
|
|
29647
29794
|
url: "The url of the api to call - ALWAYS get the information from the Wix REST docs DONT GUESS IT, the URL MUST BE ABSOLUTE URL",
|
|
29648
29795
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
29649
|
-
body: 'The request body object. YOU MUST NEVER MAKE UP A BODY - this should be based on 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 or from the "ReadFullDocsMethodSchema" tool - i.e based on the API docs. YOU MUST NEVER ASSUME YOU KNOW WHAT THE SCHEMA IS WITHOUT CONCRETE EXAMPLES OR SCHEMA DEFINITIONS FROM THE CONVERSATION CONTEXT.'
|
|
29796
|
+
body: 'The request body as a JSON object with all the required fields and values, including nested objects. Pass the actual object, NOT a JSON string. YOU MUST NEVER MAKE UP A BODY - this should be based on 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 or from the "ReadFullDocsMethodSchema" tool - i.e based on the API docs. YOU MUST NEVER ASSUME YOU KNOW WHAT THE SCHEMA IS WITHOUT CONCRETE EXAMPLES OR SCHEMA DEFINITIONS FROM THE CONVERSATION CONTEXT.'
|
|
29650
29797
|
},
|
|
29651
29798
|
SearchWixWDSDocumentation: {
|
|
29652
29799
|
searchTerm: "The search term to search for in the Wix Design System Documentation",
|
|
@@ -29677,6 +29824,11 @@ var paramDescriptions = {
|
|
|
29677
29824
|
searchTerm: "The search term to search for in the Velo Documentation",
|
|
29678
29825
|
maxResults: "The maximum number of results to return, default is 5, max is 15"
|
|
29679
29826
|
},
|
|
29827
|
+
SearchWixCLIDocumentation: {
|
|
29828
|
+
searchTerm: "The search term to search for in the Wix CLI Documentation",
|
|
29829
|
+
maxResults: "The maximum number of results to return, default is 5, max is 15",
|
|
29830
|
+
reason: "One sentence describing the original user request and the task you are trying to accomplish with this search."
|
|
29831
|
+
},
|
|
29680
29832
|
ReadFullDocsArticle: {
|
|
29681
29833
|
articleUrl: "The URL of the docs article or method article to fetch. Should be something like https://dev.wix.com/docs/.../.../..."
|
|
29682
29834
|
},
|
|
@@ -29715,7 +29867,8 @@ var VALID_DOCS_TOOLS = [
|
|
|
29715
29867
|
"BUILD_APPS",
|
|
29716
29868
|
"WIX_HEADLESS",
|
|
29717
29869
|
"VELO",
|
|
29718
|
-
"BUSINESS_SOLUTIONS"
|
|
29870
|
+
"BUSINESS_SOLUTIONS",
|
|
29871
|
+
"CLI"
|
|
29719
29872
|
];
|
|
29720
29873
|
var addDocsTools = (server, allowedTools = [
|
|
29721
29874
|
"WDS",
|
|
@@ -29723,7 +29876,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
29723
29876
|
"SDK",
|
|
29724
29877
|
"BUILD_APPS",
|
|
29725
29878
|
"WIX_HEADLESS",
|
|
29726
|
-
"BUSINESS_SOLUTIONS"
|
|
29879
|
+
"BUSINESS_SOLUTIONS",
|
|
29880
|
+
"CLI"
|
|
29727
29881
|
], options = {}) => {
|
|
29728
29882
|
const {
|
|
29729
29883
|
getToKnowWixEnabled = false,
|
|
@@ -30132,6 +30286,62 @@ var addDocsTools = (server, allowedTools = [
|
|
|
30132
30286
|
}
|
|
30133
30287
|
);
|
|
30134
30288
|
}
|
|
30289
|
+
if (allowedTools.includes("CLI") && !disableTools?.includes("SearchWixCLIDocumentation")) {
|
|
30290
|
+
server.tool(
|
|
30291
|
+
"SearchWixCLIDocumentation",
|
|
30292
|
+
getDescription(
|
|
30293
|
+
"SearchWixCLIDocumentation",
|
|
30294
|
+
defaultToolDescriptions.SearchWixCLIDocumentation ?? ""
|
|
30295
|
+
),
|
|
30296
|
+
(() => {
|
|
30297
|
+
const d = desc("SearchWixCLIDocumentation");
|
|
30298
|
+
return {
|
|
30299
|
+
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
30300
|
+
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(10),
|
|
30301
|
+
reason: external_exports.string().describe(d.reason)
|
|
30302
|
+
};
|
|
30303
|
+
})(),
|
|
30304
|
+
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
30305
|
+
async ({ searchTerm, maxResults, reason }, { panorama }) => {
|
|
30306
|
+
try {
|
|
30307
|
+
logger2.log(
|
|
30308
|
+
`[SearchWixCLIDocumentation] searchTerm="${searchTerm}", reason="${reason}"`
|
|
30309
|
+
);
|
|
30310
|
+
const result = await runSemanticSearchAndFormat({
|
|
30311
|
+
toolName: "CLI",
|
|
30312
|
+
toolParams: {
|
|
30313
|
+
searchTerm
|
|
30314
|
+
},
|
|
30315
|
+
maxResults: Math.max(1, Math.min(maxResults ?? 5, 15)),
|
|
30316
|
+
linesInEachResult: 15
|
|
30317
|
+
});
|
|
30318
|
+
return {
|
|
30319
|
+
content: [
|
|
30320
|
+
{
|
|
30321
|
+
type: "text",
|
|
30322
|
+
text: result
|
|
30323
|
+
}
|
|
30324
|
+
]
|
|
30325
|
+
};
|
|
30326
|
+
} catch (error2) {
|
|
30327
|
+
panorama.errorMonitor().reportError(error2);
|
|
30328
|
+
captureException(error2, {
|
|
30329
|
+
tags: {
|
|
30330
|
+
componentId: "SearchWixCLIDocumentation",
|
|
30331
|
+
toolName: "SearchWixCLIDocumentation"
|
|
30332
|
+
}
|
|
30333
|
+
});
|
|
30334
|
+
logger2.error(
|
|
30335
|
+
`Error searching for ${searchTerm} in Wix CLI: ${error2}`
|
|
30336
|
+
);
|
|
30337
|
+
return {
|
|
30338
|
+
isError: true,
|
|
30339
|
+
content: [{ type: "text", text: "Error: " + error2.message }]
|
|
30340
|
+
};
|
|
30341
|
+
}
|
|
30342
|
+
}
|
|
30343
|
+
);
|
|
30344
|
+
}
|
|
30135
30345
|
if (!disableTools?.includes("ReadFullDocsArticle")) {
|
|
30136
30346
|
server.tool(
|
|
30137
30347
|
"ReadFullDocsArticle",
|
|
@@ -30979,20 +31189,18 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
|
|
|
30979
31189
|
};
|
|
30980
31190
|
}
|
|
30981
31191
|
);
|
|
30982
|
-
const isCompactPrompt = options?.compactSitePrompt ?? true;
|
|
30983
|
-
const compactSuffix = " Keep the prompt short and concise, single page site if possible, do not add pages that are not explicitly requested.";
|
|
30984
|
-
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 : ""}`;
|
|
30985
|
-
const sitePromptDescription = `The prompt to build the site.${isCompactPrompt ? compactSuffix : ""} If not provided, the user will be asked to provide a prompt.`;
|
|
30986
31192
|
server.registerTool(
|
|
30987
31193
|
SITE_BUILDER_TOOL_NAME,
|
|
30988
31194
|
{
|
|
30989
31195
|
title: "Wix Site Builder",
|
|
30990
|
-
description:
|
|
31196
|
+
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.`,
|
|
30991
31197
|
inputSchema: {
|
|
30992
31198
|
jobId: external_exports.string().optional().describe(
|
|
30993
31199
|
"The job ID of the site build. If not provided, a new job will be created."
|
|
30994
31200
|
),
|
|
30995
|
-
sitePrompt: external_exports.string().describe(
|
|
31201
|
+
sitePrompt: external_exports.string().describe(
|
|
31202
|
+
`The prompt to build the site. If not provided, the user will be asked to provide a prompt.`
|
|
31203
|
+
)
|
|
30996
31204
|
},
|
|
30997
31205
|
_meta: toolMeta(),
|
|
30998
31206
|
annotations: {
|
|
@@ -31004,7 +31212,7 @@ function addCreateSiteWidgetTool(server, authStrategy, options) {
|
|
|
31004
31212
|
async (args, { setToolBiParams }) => {
|
|
31005
31213
|
console.log(
|
|
31006
31214
|
`[${SITE_BUILDER_TOOL_NAME}] \u{1F680} Start Building Your Site tool invoked!`,
|
|
31007
|
-
{ prompt: args.sitePrompt, jobId: args.jobId
|
|
31215
|
+
{ prompt: args.sitePrompt, jobId: args.jobId }
|
|
31008
31216
|
);
|
|
31009
31217
|
const accountHeaders = await getAccountAuthHeaders();
|
|
31010
31218
|
let jobId;
|
|
@@ -31087,9 +31295,7 @@ async function buildHarmonySite({
|
|
|
31087
31295
|
withScreenshots: true,
|
|
31088
31296
|
actionContext: "wix-mcp"
|
|
31089
31297
|
};
|
|
31090
|
-
console.log("[buildHarmonySite] request", {
|
|
31091
|
-
buildSiteRequest
|
|
31092
|
-
});
|
|
31298
|
+
console.log("[buildHarmonySite] request", { buildSiteRequest });
|
|
31093
31299
|
try {
|
|
31094
31300
|
const response = await httpClient.post(
|
|
31095
31301
|
"https://manage.wix.com/_api/harmony-site-builder/generate-harmony-site",
|
|
@@ -33622,6 +33828,170 @@ function createWixToolkit(options) {
|
|
|
33622
33828
|
}
|
|
33623
33829
|
};
|
|
33624
33830
|
}
|
|
33831
|
+
|
|
33832
|
+
// src/code-mode/index.ts
|
|
33833
|
+
var SEARCH_TOOL_NAME = "SearchWixAPISpec";
|
|
33834
|
+
var EXECUTE_TOOL_NAME = "ExecuteWixAPI";
|
|
33835
|
+
function addCodeModeTools(server, options) {
|
|
33836
|
+
const {
|
|
33837
|
+
codeModeBaseUrl,
|
|
33838
|
+
authStrategy,
|
|
33839
|
+
disableTools = [],
|
|
33840
|
+
toolDescriptions
|
|
33841
|
+
} = options;
|
|
33842
|
+
if (!disableTools.includes(SEARCH_TOOL_NAME)) {
|
|
33843
|
+
addSearchTool(server, codeModeBaseUrl, disableTools, toolDescriptions);
|
|
33844
|
+
}
|
|
33845
|
+
if (!disableTools.includes(EXECUTE_TOOL_NAME) && authStrategy) {
|
|
33846
|
+
addExecuteTool(
|
|
33847
|
+
server,
|
|
33848
|
+
codeModeBaseUrl,
|
|
33849
|
+
authStrategy,
|
|
33850
|
+
disableTools,
|
|
33851
|
+
toolDescriptions
|
|
33852
|
+
);
|
|
33853
|
+
}
|
|
33854
|
+
}
|
|
33855
|
+
function addSearchTool(server, codeModeBaseUrl, disableTools, toolDescriptions) {
|
|
33856
|
+
const searchUrl = `${codeModeBaseUrl}/api/code-mode/search`;
|
|
33857
|
+
server.tool(
|
|
33858
|
+
SEARCH_TOOL_NAME,
|
|
33859
|
+
toolDescriptions?.[SEARCH_TOOL_NAME] ?? defaultToolDescriptions.SearchWixAPISpec,
|
|
33860
|
+
{
|
|
33861
|
+
code: external_exports.string().describe(
|
|
33862
|
+
"JavaScript async function() expression to search the Wix API index. Has access to `lightIndex` (array of resources) and `getResourceSchema(resourceId)` (returns full schema)."
|
|
33863
|
+
)
|
|
33864
|
+
},
|
|
33865
|
+
{ readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
33866
|
+
async ({ code }) => {
|
|
33867
|
+
logger2.log(`[SearchWixAPISpec] Executing search (${code.length} chars)`);
|
|
33868
|
+
try {
|
|
33869
|
+
const resp = await fetch(searchUrl, {
|
|
33870
|
+
method: "POST",
|
|
33871
|
+
headers: { "Content-Type": "application/json" },
|
|
33872
|
+
body: JSON.stringify({ code })
|
|
33873
|
+
});
|
|
33874
|
+
if (!resp.ok) {
|
|
33875
|
+
const errorBody = await resp.text();
|
|
33876
|
+
logger2.log(`[SearchWixAPISpec] HTTP ${resp.status}: ${errorBody}`);
|
|
33877
|
+
return {
|
|
33878
|
+
content: [
|
|
33879
|
+
{
|
|
33880
|
+
type: "text",
|
|
33881
|
+
text: `Search error (${resp.status}): ${errorBody}`,
|
|
33882
|
+
isError: true
|
|
33883
|
+
}
|
|
33884
|
+
]
|
|
33885
|
+
};
|
|
33886
|
+
}
|
|
33887
|
+
const data = await resp.json();
|
|
33888
|
+
if (data.error) {
|
|
33889
|
+
return {
|
|
33890
|
+
content: [
|
|
33891
|
+
{
|
|
33892
|
+
type: "text",
|
|
33893
|
+
text: `Search error: ${data.error}`,
|
|
33894
|
+
isError: true
|
|
33895
|
+
}
|
|
33896
|
+
]
|
|
33897
|
+
};
|
|
33898
|
+
}
|
|
33899
|
+
const text = typeof data.result === "string" ? data.result : JSON.stringify(data.result, null, 2);
|
|
33900
|
+
return {
|
|
33901
|
+
content: [{ type: "text", text }]
|
|
33902
|
+
};
|
|
33903
|
+
} catch (err) {
|
|
33904
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
33905
|
+
logger2.log(`[SearchWixAPISpec] Error: ${message}`);
|
|
33906
|
+
return {
|
|
33907
|
+
content: [
|
|
33908
|
+
{ type: "text", text: `Search error: ${message}`, isError: true }
|
|
33909
|
+
]
|
|
33910
|
+
};
|
|
33911
|
+
}
|
|
33912
|
+
}
|
|
33913
|
+
);
|
|
33914
|
+
}
|
|
33915
|
+
function addExecuteTool(server, codeModeBaseUrl, authStrategy, disableTools, toolDescriptions) {
|
|
33916
|
+
const executeUrl = `${codeModeBaseUrl}/api/code-mode/execute`;
|
|
33917
|
+
server.tool(
|
|
33918
|
+
EXECUTE_TOOL_NAME,
|
|
33919
|
+
toolDescriptions?.[EXECUTE_TOOL_NAME] ?? defaultToolDescriptions.ExecuteWixAPI,
|
|
33920
|
+
{
|
|
33921
|
+
code: external_exports.string().describe(
|
|
33922
|
+
"JavaScript async function() expression to execute against the Wix REST API. Has access to `wix.request({ method, url, body, headers })` and `siteId`."
|
|
33923
|
+
),
|
|
33924
|
+
siteId: external_exports.string().optional().describe(
|
|
33925
|
+
"Wix site ID to execute against. You can find site IDs using the ListWixSites tool or by querying the Wix API."
|
|
33926
|
+
)
|
|
33927
|
+
},
|
|
33928
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
33929
|
+
async ({ code, siteId }) => {
|
|
33930
|
+
if (!siteId) {
|
|
33931
|
+
return {
|
|
33932
|
+
content: [
|
|
33933
|
+
{
|
|
33934
|
+
type: "text",
|
|
33935
|
+
text: "Error: siteId is required. You can list available sites using the ListWixSites tool or by querying the Wix Sites API.",
|
|
33936
|
+
isError: true
|
|
33937
|
+
}
|
|
33938
|
+
]
|
|
33939
|
+
};
|
|
33940
|
+
}
|
|
33941
|
+
logger2.log(
|
|
33942
|
+
`[ExecuteWixAPI] Executing code (${code.length} chars), siteId=${siteId}`
|
|
33943
|
+
);
|
|
33944
|
+
try {
|
|
33945
|
+
const authHeaders = await authStrategy.getSiteAuthHeaders(siteId);
|
|
33946
|
+
const resp = await fetch(executeUrl, {
|
|
33947
|
+
method: "POST",
|
|
33948
|
+
headers: {
|
|
33949
|
+
"Content-Type": "application/json",
|
|
33950
|
+
...authHeaders
|
|
33951
|
+
},
|
|
33952
|
+
body: JSON.stringify({ code, siteId })
|
|
33953
|
+
});
|
|
33954
|
+
if (!resp.ok) {
|
|
33955
|
+
const errorBody = await resp.text();
|
|
33956
|
+
logger2.log(`[ExecuteWixAPI] HTTP ${resp.status}: ${errorBody}`);
|
|
33957
|
+
return {
|
|
33958
|
+
content: [
|
|
33959
|
+
{
|
|
33960
|
+
type: "text",
|
|
33961
|
+
text: `Execute error (${resp.status}): ${errorBody}`,
|
|
33962
|
+
isError: true
|
|
33963
|
+
}
|
|
33964
|
+
]
|
|
33965
|
+
};
|
|
33966
|
+
}
|
|
33967
|
+
const data = await resp.json();
|
|
33968
|
+
if (data.error) {
|
|
33969
|
+
return {
|
|
33970
|
+
content: [
|
|
33971
|
+
{
|
|
33972
|
+
type: "text",
|
|
33973
|
+
text: `Execute error: ${data.error}`,
|
|
33974
|
+
isError: true
|
|
33975
|
+
}
|
|
33976
|
+
]
|
|
33977
|
+
};
|
|
33978
|
+
}
|
|
33979
|
+
const text = typeof data.result === "string" ? data.result : JSON.stringify(data.result, null, 2);
|
|
33980
|
+
return {
|
|
33981
|
+
content: [{ type: "text", text }]
|
|
33982
|
+
};
|
|
33983
|
+
} catch (err) {
|
|
33984
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
33985
|
+
logger2.log(`[ExecuteWixAPI] Error: ${message}`);
|
|
33986
|
+
return {
|
|
33987
|
+
content: [
|
|
33988
|
+
{ type: "text", text: `Execute error: ${message}`, isError: true }
|
|
33989
|
+
]
|
|
33990
|
+
};
|
|
33991
|
+
}
|
|
33992
|
+
}
|
|
33993
|
+
);
|
|
33994
|
+
}
|
|
33625
33995
|
export {
|
|
33626
33996
|
MENU_CONTENT_THRESHOLD,
|
|
33627
33997
|
RECIPES_INDEX_URL,
|
|
@@ -33629,6 +33999,7 @@ export {
|
|
|
33629
33999
|
VALID_DOCS_TOOLS,
|
|
33630
34000
|
WixMcpServer,
|
|
33631
34001
|
addApiCallTool,
|
|
34002
|
+
addCodeModeTools,
|
|
33632
34003
|
addCreateSiteWidgetTool,
|
|
33633
34004
|
addDocsResources,
|
|
33634
34005
|
addDocsTools,
|