@wix/mcp 1.0.80 → 1.0.82
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 +93 -31
- package/build/cjs/index.cjs +151 -380
- package/build/cjs/toolkit.cjs +97 -33
- 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.js +13 -3
- 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/import-claude-design-tool/index.js +2 -2
- package/build/dts/infra/tool-bi.d.ts +1 -1
- package/build/dts/infra/tool-bi.js +3 -2
- package/build/dts/site-widget-tools/constants.d.ts +12 -5
- package/build/dts/site-widget-tools/constants.js +20 -11
- package/build/dts/site-widget-tools/site-builder-tool/index.js +1 -1
- package/build/dts/site-widget-tools/site-creation-tool/index.js +3 -2
- package/build/dts/site-widget-tools/suggested-domain-tool/index.js +23 -5
- package/build/dts/toolkit-entry.d.cts +1 -1
- package/build/dts/toolkit-entry.d.ts +1 -1
- package/build/dts/toolkit.js +4 -1
- package/build/dts/wix-mcp-server.d.ts +4 -0
- package/build/dts/wix-mcp-server.js +9 -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 +151 -377
- package/build/esm/toolkit.js +97 -33
- package/package.json +3 -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/cjs/toolkit.cjs
CHANGED
|
@@ -17648,6 +17648,9 @@ function rethrowIfUnauthorized(error) {
|
|
|
17648
17648
|
}
|
|
17649
17649
|
}
|
|
17650
17650
|
|
|
17651
|
+
// src/config/api-request-rules.ts
|
|
17652
|
+
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).";
|
|
17653
|
+
|
|
17651
17654
|
// src/config/default-config.ts
|
|
17652
17655
|
var AGENT_GOAL = dedent_default`
|
|
17653
17656
|
You are an agent that helps the user manage their Wix site.
|
|
@@ -17747,6 +17750,8 @@ var SITE_CREATION_COPY = {
|
|
|
17747
17750
|
var SITE_GUIDANCE = dedent_default`
|
|
17748
17751
|
A new-site request has two things to settle: what the site is for, and how to build it. The how is AI generation vs. starting from a template, so naming templates, a template id or Wix Studio (Wix Studio is also the template side) already settles it.
|
|
17749
17752
|
|
|
17753
|
+
One case skips all of this: the user ALREADY HAS the finished site as files — hand-written HTML/CSS/JS, a zip, or the export of an AI builder. There is nothing to build, so don't offer AI or templates and don't call any site-creation tool. Send them to https://www.wix.com/headless/drop?utm_campaign=mcp — they drag the files in and get a live Wix-hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
17754
|
+
|
|
17750
17755
|
Settle what the site is for first: its purpose, topic, business type, audience, or main visitor action. Naming a method is not a description of the site, and neither is the business or industry on its own.
|
|
17751
17756
|
If you can't tell yet, ask the preferred question below and nothing else — one question, no creation-method question in the same reply, and no internal tool names.
|
|
17752
17757
|
Once the purpose is clear, unless the user already named a method, ${SITE_CREATION_COPY.unstatedMethod.nonWidget}. A method they named is settled — never re-open it. Never default to AI or to templates, and never ask the user to choose between Harmony and Wix Studio; infer that from their words.
|
|
@@ -17769,11 +17774,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
|
17769
17774
|
CODE CONTRACT:
|
|
17770
17775
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
17771
17776
|
- Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
|
|
17777
|
+
- 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.
|
|
17772
17778
|
|
|
17773
17779
|
CONFIRM API CONTRACTS:
|
|
17774
17780
|
- 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.
|
|
17775
17781
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
17776
17782
|
- 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.
|
|
17783
|
+
- ${ARRAY_QUERY_PARAMS_RULE}
|
|
17777
17784
|
- 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.
|
|
17778
17785
|
`;
|
|
17779
17786
|
var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
|
|
@@ -17789,6 +17796,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
17789
17796
|
SCOPE AND SITE TARGETING:
|
|
17790
17797
|
- 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.
|
|
17791
17798
|
- If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
|
|
17799
|
+
- 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.
|
|
17792
17800
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
17793
17801
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
17794
17802
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -18076,7 +18084,8 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18076
18084
|
After calling, you MUST speak the message provided in the tool result to the user as your reply — do not stay silent and do not replace it with a one-line pointer to the widget. Write out ALL of it, word for word: its opening line (the "Ready to set up your … site?" question INCLUDING "Choose your path in the widget above:"), BOTH of its option bullets, and its "Next up:" line, each on its own line and in that order. Do not summarize, shorten, drop any line, invent your own opener, rename the options, or add an intro or outro.
|
|
18077
18085
|
`,
|
|
18078
18086
|
"import-claude-design-from-url": dedent_default`
|
|
18079
|
-
Import a design into Wix
|
|
18087
|
+
Import a design created in Claude's design tool into Wix. Takes the signed claudeusercontent.com URL Claude Design produces for its self-contained HTML bundle (all images, fonts, and styles inlined); any other host is rejected. Creates a live Wix-hosted site and returns its URL.
|
|
18088
|
+
NOT for site files the user provides themselves (their own HTML/CSS/JS, a zip, another builder's export) — for those, don't call this tool: send the user to https://www.wix.com/headless/drop?utm_campaign=mcp, where they upload the files and get a live hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
18080
18089
|
`,
|
|
18081
18090
|
RunWixCliCommand: dedent_default`
|
|
18082
18091
|
Executes Wix CLI commands for Wix app development and management.
|
|
@@ -18109,8 +18118,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18109
18118
|
SearchBuildAppsDocumentation: dedent_default`
|
|
18110
18119
|
Searches the Wix Build Apps documentation.
|
|
18111
18120
|
`,
|
|
18112
|
-
|
|
18113
|
-
|
|
18121
|
+
SearchDevelopmentDocumentation: dedent_default`
|
|
18122
|
+
Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
|
|
18123
|
+
Skip it entirely for general, business, support, or Wix-editor questions.
|
|
18124
|
+
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.
|
|
18114
18125
|
`,
|
|
18115
18126
|
SearchWixHeadlessDocumentation: dedent_default`
|
|
18116
18127
|
Searches the Wix Headless documentation.
|
|
@@ -18475,6 +18486,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
18475
18486
|
CreateWixBusinessGuide: dedent_default`
|
|
18476
18487
|
Provides comprehensive documentation for creating a new Wix business (site, app, etc.).
|
|
18477
18488
|
Call this ONLY when the user explicitly asks for a headless site, a Wix Classic Editor site, or manual/advanced account/API-based site creation — these don't need the site's purpose first. For normal site-creation ${SITE_CREATION_COPY.normalCreationRoute.nonWidget}; for a specific template id, call \`CreateSiteFromTemplate\`.
|
|
18489
|
+
Exception, even when the user says "headless": if they ALREADY HAVE the finished site as files (their own HTML/CSS/JS, a zip, an AI-builder export) and want those files hosted, don't call this tool — send them to https://www.wix.com/headless/drop?utm_campaign=mcp to upload the files and get a live hosted site (give that URL exactly, keeping the utm_campaign=mcp parameter). This guide's CLI flow is for BUILDING a headless frontend, not for hosting ready-made files.
|
|
18478
18490
|
|
|
18479
18491
|
## What This Tool Contains
|
|
18480
18492
|
|
|
@@ -18762,14 +18774,20 @@ function renderApps(apps, knownApps) {
|
|
|
18762
18774
|
}
|
|
18763
18775
|
function renderProperties(props) {
|
|
18764
18776
|
const sections = [];
|
|
18765
|
-
const
|
|
18766
|
-
if (props.language)
|
|
18767
|
-
if (props.locale?.country)
|
|
18768
|
-
|
|
18769
|
-
if (props.
|
|
18770
|
-
if (
|
|
18771
|
-
|
|
18772
|
-
|
|
18777
|
+
const regionalFormat = [];
|
|
18778
|
+
if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
|
|
18779
|
+
if (props.locale?.country)
|
|
18780
|
+
regionalFormat.push(`- Locale region: **${props.locale.country}**`);
|
|
18781
|
+
if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
|
|
18782
|
+
if (props.paymentCurrency)
|
|
18783
|
+
regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
|
|
18784
|
+
if (regionalFormat.length) {
|
|
18785
|
+
sections.push(`**Regional Format**
|
|
18786
|
+
${regionalFormat.join("\n")}`);
|
|
18787
|
+
}
|
|
18788
|
+
if (props.address?.country) {
|
|
18789
|
+
sections.push(`**Location**
|
|
18790
|
+
- Country: **${props.address.country}**`);
|
|
18773
18791
|
}
|
|
18774
18792
|
const contact = [];
|
|
18775
18793
|
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
@@ -18916,6 +18934,7 @@ var known_apps_default = {
|
|
|
18916
18934
|
"225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
|
|
18917
18935
|
"d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
|
|
18918
18936
|
"148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
|
|
18937
|
+
"14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
|
|
18919
18938
|
"13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
|
|
18920
18939
|
"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
|
|
18921
18940
|
"14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
|
|
@@ -18933,7 +18952,16 @@ var known_apps_default = {
|
|
|
18933
18952
|
"1480c568-5cbd-9392-5604-1148f5faffa0": "Promote SEO",
|
|
18934
18953
|
"ff5d6eb1-65e4-4f9a-8b14-64d34c12cc2e": "Wix Rentals"
|
|
18935
18954
|
};
|
|
18936
|
-
var
|
|
18955
|
+
var DYNAMIC_CONTEXT_PATH = "/_api/dynamic-context/v1/dynamic-context";
|
|
18956
|
+
var DYNAMIC_CONTEXT_URL = `https://dev.wix.com${DYNAMIC_CONTEXT_PATH}`;
|
|
18957
|
+
var isWixHost = (hostname) => hostname === "wix.com" || hostname.endsWith(".wix.com");
|
|
18958
|
+
var dynamicContextUrl = () => {
|
|
18959
|
+
if (typeof window === "undefined") {
|
|
18960
|
+
return DYNAMIC_CONTEXT_URL;
|
|
18961
|
+
}
|
|
18962
|
+
const hostname = window.location?.hostname;
|
|
18963
|
+
return typeof hostname === "string" && isWixHost(hostname) ? DYNAMIC_CONTEXT_PATH : DYNAMIC_CONTEXT_URL;
|
|
18964
|
+
};
|
|
18937
18965
|
var COUNT_SITES_URL = "https://www.wixapis.com/site-list/v2/sites/count";
|
|
18938
18966
|
var MAX_SITES_FOR_DYNAMIC_CONTEXT = 10;
|
|
18939
18967
|
var DYNAMIC_CONTEXT_PETRI_OVERRIDE = "shouldReturnDynamicContextInMCP#B";
|
|
@@ -18950,8 +18978,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
18950
18978
|
partnerContextEnabled: options,
|
|
18951
18979
|
includeAccountContext: options
|
|
18952
18980
|
} : options;
|
|
18953
|
-
const includePartnerContext = contextOptions?.partnerContextEnabled ??
|
|
18954
|
-
const includeAccountContext = contextOptions?.includeAccountContext ??
|
|
18981
|
+
const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
|
|
18982
|
+
const includeAccountContext = contextOptions?.includeAccountContext ?? true;
|
|
18955
18983
|
try {
|
|
18956
18984
|
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
18957
18985
|
const noFilter = !filter?.siteId && !filter?.siteName;
|
|
@@ -18985,7 +19013,7 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
18985
19013
|
if (filter?.siteId) body.site_id = filter.siteId;
|
|
18986
19014
|
else if (filter?.siteName) body.site_name = filter.siteName;
|
|
18987
19015
|
const dynamicContextPromise = httpClient.request({
|
|
18988
|
-
url:
|
|
19016
|
+
url: dynamicContextUrl(),
|
|
18989
19017
|
method: "POST",
|
|
18990
19018
|
headers: {
|
|
18991
19019
|
...accountHeaders,
|
|
@@ -19065,7 +19093,8 @@ var paramDescriptions = {
|
|
|
19065
19093
|
"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",
|
|
19066
19094
|
'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',
|
|
19067
19095
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
|
|
19068
|
-
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
|
|
19096
|
+
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
|
|
19097
|
+
ARRAY_QUERY_PARAMS_RULE
|
|
19069
19098
|
].join("\n"),
|
|
19070
19099
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
19071
19100
|
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.',
|
|
@@ -19138,8 +19167,8 @@ var paramDescriptions = {
|
|
|
19138
19167
|
searchTerm: "The search term to search for in the Build Apps Documentation",
|
|
19139
19168
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
19140
19169
|
},
|
|
19141
|
-
|
|
19142
|
-
searchTerm: "The search term
|
|
19170
|
+
SearchDevelopmentDocumentation: {
|
|
19171
|
+
searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
|
|
19143
19172
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
19144
19173
|
},
|
|
19145
19174
|
SearchWixHeadlessDocumentation: {
|
|
@@ -19935,15 +19964,15 @@ var addDocsTools = (server, allowedTools = [
|
|
|
19935
19964
|
}
|
|
19936
19965
|
);
|
|
19937
19966
|
}
|
|
19938
|
-
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("
|
|
19967
|
+
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
|
|
19939
19968
|
server.tool(
|
|
19940
|
-
"
|
|
19969
|
+
"SearchDevelopmentDocumentation",
|
|
19941
19970
|
getDescription(
|
|
19942
|
-
"
|
|
19943
|
-
defaultToolDescriptions.
|
|
19971
|
+
"SearchDevelopmentDocumentation",
|
|
19972
|
+
defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
|
|
19944
19973
|
),
|
|
19945
19974
|
(() => {
|
|
19946
|
-
const d = desc("
|
|
19975
|
+
const d = desc("SearchDevelopmentDocumentation");
|
|
19947
19976
|
return {
|
|
19948
19977
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
19949
19978
|
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
|
|
@@ -19973,8 +20002,8 @@ var addDocsTools = (server, allowedTools = [
|
|
|
19973
20002
|
panorama.errorMonitor().reportError(error);
|
|
19974
20003
|
captureException(error, {
|
|
19975
20004
|
tags: {
|
|
19976
|
-
componentId: "
|
|
19977
|
-
toolName: "
|
|
20005
|
+
componentId: "SearchDevelopmentDocumentation",
|
|
20006
|
+
toolName: "SearchDevelopmentDocumentation"
|
|
19978
20007
|
}
|
|
19979
20008
|
});
|
|
19980
20009
|
logger.error(
|
|
@@ -20838,6 +20867,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
|
|
|
20838
20867
|
|
|
20839
20868
|
// src/api-call/index.ts
|
|
20840
20869
|
var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
|
|
20870
|
+
function extractReturnedRows(responseData) {
|
|
20871
|
+
if (responseData === null || typeof responseData !== "object") {
|
|
20872
|
+
return void 0;
|
|
20873
|
+
}
|
|
20874
|
+
const data = responseData;
|
|
20875
|
+
const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
|
|
20876
|
+
const raw = block?.count;
|
|
20877
|
+
if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
|
|
20878
|
+
return void 0;
|
|
20879
|
+
}
|
|
20880
|
+
const count = Number(raw);
|
|
20881
|
+
return Number.isFinite(count) ? count : void 0;
|
|
20882
|
+
}
|
|
20841
20883
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
20842
20884
|
if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
|
|
20843
20885
|
return {
|
|
@@ -20845,13 +20887,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
20845
20887
|
isError: true
|
|
20846
20888
|
};
|
|
20847
20889
|
}
|
|
20890
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
20848
20891
|
let responseText = JSON.stringify(responseData);
|
|
20892
|
+
const originalLength = responseText.length;
|
|
20849
20893
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
20850
20894
|
if (responseText.length > effectiveMax) {
|
|
20851
20895
|
responseText = responseText.slice(0, effectiveMax) + `
|
|
20852
20896
|
...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
20853
20897
|
}
|
|
20854
|
-
return { text: responseText, isError: false };
|
|
20898
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
20855
20899
|
}
|
|
20856
20900
|
function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
20857
20901
|
const effectiveAllowedTools = [
|
|
@@ -20914,9 +20958,14 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
20914
20958
|
data: method === "GET" ? void 0 : body
|
|
20915
20959
|
});
|
|
20916
20960
|
const requestId = response.headers?.["x-wix-request-id"];
|
|
20917
|
-
setToolBiParams({ requestId, siteId });
|
|
20918
20961
|
const responseData = await handleWixAPIResponse(response);
|
|
20919
20962
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
20963
|
+
setToolBiParams({
|
|
20964
|
+
requestId,
|
|
20965
|
+
siteId,
|
|
20966
|
+
returnedRows: formatted.returnedRows,
|
|
20967
|
+
originalLength: formatted.originalLength
|
|
20968
|
+
});
|
|
20920
20969
|
if (formatted.isError) {
|
|
20921
20970
|
return {
|
|
20922
20971
|
content: [
|
|
@@ -21055,7 +21104,7 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
21055
21104
|
destructiveHint: true,
|
|
21056
21105
|
openWorldHint: false
|
|
21057
21106
|
}),
|
|
21058
|
-
async ({ url, body, method, reason }, { httpClient }) => {
|
|
21107
|
+
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
21059
21108
|
logger.log(
|
|
21060
21109
|
`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
|
|
21061
21110
|
);
|
|
@@ -21084,6 +21133,10 @@ function addApiCallTool(server, strategy, allowedTools = ["CallWixSiteAPI", "Lis
|
|
|
21084
21133
|
});
|
|
21085
21134
|
const responseData = await handleWixAPIResponse(response);
|
|
21086
21135
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
21136
|
+
setToolBiParams({
|
|
21137
|
+
returnedRows: formatted.returnedRows,
|
|
21138
|
+
originalLength: formatted.originalLength
|
|
21139
|
+
});
|
|
21087
21140
|
if (formatted.isError) {
|
|
21088
21141
|
return {
|
|
21089
21142
|
content: [
|
|
@@ -21306,10 +21359,13 @@ function executeTextResult(message) {
|
|
|
21306
21359
|
content: [{ type: "text", text: message }]
|
|
21307
21360
|
};
|
|
21308
21361
|
}
|
|
21309
|
-
function formatExecuteResult(data, maxResponseSize) {
|
|
21362
|
+
function formatExecuteResult(data, maxResponseSize, reportBi) {
|
|
21310
21363
|
if (data.error) {
|
|
21311
21364
|
return executeErrorResult(data.error);
|
|
21312
21365
|
}
|
|
21366
|
+
reportBi?.({
|
|
21367
|
+
originalLength: typeof data.result === "string" ? data.result.length : JSON.stringify(data.result)?.length
|
|
21368
|
+
});
|
|
21313
21369
|
return {
|
|
21314
21370
|
content: [
|
|
21315
21371
|
{ type: "text", text: truncateResponse(data.result, maxResponseSize) }
|
|
@@ -21419,7 +21475,11 @@ function addExecuteTool(server, options) {
|
|
|
21419
21475
|
status: data.authErrorStatus
|
|
21420
21476
|
});
|
|
21421
21477
|
}
|
|
21422
|
-
return formatExecuteResult(
|
|
21478
|
+
return formatExecuteResult(
|
|
21479
|
+
data,
|
|
21480
|
+
maxResponseSize,
|
|
21481
|
+
extra?.setToolBiParams
|
|
21482
|
+
);
|
|
21423
21483
|
} catch (err) {
|
|
21424
21484
|
const message = err instanceof Error ? err.message : String(err);
|
|
21425
21485
|
logger.log(
|
|
@@ -21511,7 +21571,7 @@ function extractText(result) {
|
|
|
21511
21571
|
return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
|
|
21512
21572
|
}
|
|
21513
21573
|
var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
|
|
21514
|
-
function formatToolResultAdditionalFields(result) {
|
|
21574
|
+
function formatToolResultAdditionalFields(result, extras) {
|
|
21515
21575
|
const resultText = extractText(result);
|
|
21516
21576
|
const contentTypes = [
|
|
21517
21577
|
...new Set(
|
|
@@ -21527,7 +21587,8 @@ function formatToolResultAdditionalFields(result) {
|
|
|
21527
21587
|
resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
|
|
21528
21588
|
resultTextLength: resultText.length,
|
|
21529
21589
|
resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
|
|
21530
|
-
resultContentTypes: contentTypes
|
|
21590
|
+
resultContentTypes: contentTypes,
|
|
21591
|
+
...extras
|
|
21531
21592
|
});
|
|
21532
21593
|
}
|
|
21533
21594
|
function createToolBiEvent(params) {
|
|
@@ -21765,7 +21826,10 @@ function createWixToolkit(options) {
|
|
|
21765
21826
|
if (!toolSucceeded) {
|
|
21766
21827
|
errorBody = extractText(cbResult);
|
|
21767
21828
|
} else {
|
|
21768
|
-
additionalFields = formatToolResultAdditionalFields(cbResult
|
|
21829
|
+
additionalFields = formatToolResultAdditionalFields(cbResult, {
|
|
21830
|
+
returnedRows: toolBiParams.returnedRows,
|
|
21831
|
+
originalLength: toolBiParams.originalLength
|
|
21832
|
+
});
|
|
21769
21833
|
}
|
|
21770
21834
|
if (!isDevEnvironment) {
|
|
21771
21835
|
if (toolSucceeded) {
|
|
@@ -10,6 +10,32 @@ import { desc } from '../config/param-descriptions.js';
|
|
|
10
10
|
import { MAX_ALLOWED_RESPONSE_CHARS } from '../infra/response-size-limits.js';
|
|
11
11
|
export { addUploadImageTool } from './upload-image-tool.js';
|
|
12
12
|
const DEFAULT_MAX_RESPONSE_SIZE = 50000; // ~50KB cap
|
|
13
|
+
/**
|
|
14
|
+
* Rows the API actually served, read before truncation. Endpoints often return
|
|
15
|
+
* fewer than asked for, so an offset advance that does not match
|
|
16
|
+
* offset + requested limit can still be correct -- without this, BI cannot tell
|
|
17
|
+
* a paging defect from a short page.
|
|
18
|
+
*/
|
|
19
|
+
function extractReturnedRows(responseData) {
|
|
20
|
+
if (responseData === null || typeof responseData !== 'object') {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const data = responseData;
|
|
24
|
+
const block = (data.pagingMetadata ??
|
|
25
|
+
data.cursorPagingMetadata ??
|
|
26
|
+
data.pagingOffsetMetadata ??
|
|
27
|
+
data.metaData ??
|
|
28
|
+
data.metadata);
|
|
29
|
+
const raw = block?.count;
|
|
30
|
+
// A blank string coerces to 0, which would report a page size the endpoint
|
|
31
|
+
// never sent -- worse than reporting nothing.
|
|
32
|
+
if (typeof raw !== 'number' &&
|
|
33
|
+
(typeof raw !== 'string' || raw.trim() === '')) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const count = Number(raw);
|
|
37
|
+
return Number.isFinite(count) ? count : undefined;
|
|
38
|
+
}
|
|
13
39
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
14
40
|
// Detect if response is HTML (likely wrong endpoint or auth redirect)
|
|
15
41
|
if (typeof responseData === 'string' &&
|
|
@@ -19,14 +45,16 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
19
45
|
isError: true
|
|
20
46
|
};
|
|
21
47
|
}
|
|
48
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
22
49
|
let responseText = JSON.stringify(responseData);
|
|
50
|
+
const originalLength = responseText.length;
|
|
23
51
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
24
52
|
if (responseText.length > effectiveMax) {
|
|
25
53
|
responseText =
|
|
26
54
|
responseText.slice(0, effectiveMax) +
|
|
27
55
|
`\n...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
28
56
|
}
|
|
29
|
-
return { text: responseText, isError: false };
|
|
57
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
30
58
|
}
|
|
31
59
|
export function addApiCallTool(server, strategy, allowedTools = ['CallWixSiteAPI', 'ListWixSites', 'ManageWixSite'], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
32
60
|
// Compute effective allowed tools: (default + enableTools) - disableTools
|
|
@@ -89,9 +117,15 @@ export function addApiCallTool(server, strategy, allowedTools = ['CallWixSiteAPI
|
|
|
89
117
|
data: method === 'GET' ? undefined : body
|
|
90
118
|
});
|
|
91
119
|
const requestId = response.headers?.['x-wix-request-id'];
|
|
92
|
-
setToolBiParams({ requestId, siteId });
|
|
93
120
|
const responseData = await handleWixAPIResponse(response);
|
|
94
121
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
122
|
+
// One call only -- setToolBiParams replaces rather than merges.
|
|
123
|
+
setToolBiParams({
|
|
124
|
+
requestId,
|
|
125
|
+
siteId,
|
|
126
|
+
returnedRows: formatted.returnedRows,
|
|
127
|
+
originalLength: formatted.originalLength
|
|
128
|
+
});
|
|
95
129
|
if (formatted.isError) {
|
|
96
130
|
return {
|
|
97
131
|
content: [
|
|
@@ -222,7 +256,7 @@ export function addApiCallTool(server, strategy, allowedTools = ['CallWixSiteAPI
|
|
|
222
256
|
readOnlyHint: false,
|
|
223
257
|
destructiveHint: true,
|
|
224
258
|
openWorldHint: false
|
|
225
|
-
}), async ({ url, body, method, reason }, { httpClient }) => {
|
|
259
|
+
}), async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
226
260
|
logger.log(`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`);
|
|
227
261
|
const { isAllowed, error: urlError } = isApiUrlAllowed(url);
|
|
228
262
|
if (!isAllowed) {
|
|
@@ -251,6 +285,10 @@ export function addApiCallTool(server, strategy, allowedTools = ['CallWixSiteAPI
|
|
|
251
285
|
});
|
|
252
286
|
const responseData = await handleWixAPIResponse(response);
|
|
253
287
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
288
|
+
setToolBiParams({
|
|
289
|
+
returnedRows: formatted.returnedRows,
|
|
290
|
+
originalLength: formatted.originalLength
|
|
291
|
+
});
|
|
254
292
|
if (formatted.isError) {
|
|
255
293
|
return {
|
|
256
294
|
content: [
|
|
@@ -162,10 +162,16 @@ function executeTextResult(message) {
|
|
|
162
162
|
content: [{ type: 'text', text: message }]
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function formatExecuteResult(data, maxResponseSize) {
|
|
165
|
+
function formatExecuteResult(data, maxResponseSize, reportBi) {
|
|
166
166
|
if (data.error) {
|
|
167
167
|
return executeErrorResult(data.error);
|
|
168
168
|
}
|
|
169
|
+
// Before the slice -- resultTextLength is measured after it and saturates.
|
|
170
|
+
reportBi?.({
|
|
171
|
+
originalLength: typeof data.result === 'string'
|
|
172
|
+
? data.result.length
|
|
173
|
+
: JSON.stringify(data.result)?.length
|
|
174
|
+
});
|
|
169
175
|
return {
|
|
170
176
|
content: [
|
|
171
177
|
{ type: 'text', text: truncateResponse(data.result, maxResponseSize) }
|
|
@@ -293,7 +299,7 @@ function addExecuteTool(server, options) {
|
|
|
293
299
|
status: data.authErrorStatus
|
|
294
300
|
});
|
|
295
301
|
}
|
|
296
|
-
return formatExecuteResult(data, maxResponseSize);
|
|
302
|
+
return formatExecuteResult(data, maxResponseSize, extra?.setToolBiParams);
|
|
297
303
|
}
|
|
298
304
|
catch (err) {
|
|
299
305
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-shape rules shared by every tool that lets an agent write a Wix REST
|
|
3
|
+
* URL by hand (ExecuteWixAPI's `wix.request` and CallWixSiteAPI's `url`).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The Wix API gateway deserializes enum-typed array query params only when the
|
|
7
|
+
* parameter is repeated once per value. Comma-joined values are read as a
|
|
8
|
+
* single unknown enum member and rejected with HTTP 400.
|
|
9
|
+
*/
|
|
10
|
+
export declare const 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).";
|
|
11
|
+
//# sourceMappingURL=api-request-rules.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-shape rules shared by every tool that lets an agent write a Wix REST
|
|
3
|
+
* URL by hand (ExecuteWixAPI's `wix.request` and CallWixSiteAPI's `url`).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The Wix API gateway deserializes enum-typed array query params only when the
|
|
7
|
+
* parameter is repeated once per value. Comma-joined values are read as a
|
|
8
|
+
* single unknown enum member and rejected with HTTP 400.
|
|
9
|
+
*/
|
|
10
|
+
export const 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).';
|
|
11
|
+
//# sourceMappingURL=api-request-rules.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dedent from 'dedent';
|
|
2
|
+
import { ARRAY_QUERY_PARAMS_RULE } from './api-request-rules.js';
|
|
2
3
|
/**
|
|
3
4
|
* Common agent goal - used in both SYSTEM_REMINDER and defaultReadmeDocs
|
|
4
5
|
*/
|
|
@@ -79,6 +80,8 @@ export const SITE_CREATION_COPY = {
|
|
|
79
80
|
const SITE_GUIDANCE = dedent `
|
|
80
81
|
A new-site request has two things to settle: what the site is for, and how to build it. The how is AI generation vs. starting from a template, so naming templates, a template id or Wix Studio (Wix Studio is also the template side) already settles it.
|
|
81
82
|
|
|
83
|
+
One case skips all of this: the user ALREADY HAS the finished site as files — hand-written HTML/CSS/JS, a zip, or the export of an AI builder. There is nothing to build, so don't offer AI or templates and don't call any site-creation tool. Send them to https://www.wix.com/headless/drop?utm_campaign=mcp — they drag the files in and get a live Wix-hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
84
|
+
|
|
82
85
|
Settle what the site is for first: its purpose, topic, business type, audience, or main visitor action. Naming a method is not a description of the site, and neither is the business or industry on its own.
|
|
83
86
|
If you can't tell yet, ask the preferred question below and nothing else — one question, no creation-method question in the same reply, and no internal tool names.
|
|
84
87
|
Once the purpose is clear, unless the user already named a method, ${SITE_CREATION_COPY.unstatedMethod.nonWidget}. A method they named is settled — never re-open it. Never default to AI or to templates, and never ask the user to choose between Harmony and Wix Studio; infer that from their words.
|
|
@@ -104,11 +107,13 @@ const EXECUTE_WIX_API_INTRO = dedent `
|
|
|
104
107
|
CODE CONTRACT:
|
|
105
108
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
106
109
|
- Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
|
|
110
|
+
- 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.
|
|
107
111
|
|
|
108
112
|
CONFIRM API CONTRACTS:
|
|
109
113
|
- 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.
|
|
110
114
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
111
115
|
- 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.
|
|
116
|
+
- ${ARRAY_QUERY_PARAMS_RULE}
|
|
112
117
|
- 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.
|
|
113
118
|
`;
|
|
114
119
|
const EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent `
|
|
@@ -124,6 +129,7 @@ const ACCOUNT_SITE_EXECUTE_SCOPE = dedent `
|
|
|
124
129
|
SCOPE AND SITE TARGETING:
|
|
125
130
|
- 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.
|
|
126
131
|
- If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
|
|
132
|
+
- 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.
|
|
127
133
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
128
134
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
129
135
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -408,7 +414,8 @@ export function buildToolDescriptions(includeReadme, includeImageUploadGuidance
|
|
|
408
414
|
After calling, you MUST speak the message provided in the tool result to the user as your reply — do not stay silent and do not replace it with a one-line pointer to the widget. Write out ALL of it, word for word: its opening line (the "Ready to set up your … site?" question INCLUDING "Choose your path in the widget above:"), BOTH of its option bullets, and its "Next up:" line, each on its own line and in that order. Do not summarize, shorten, drop any line, invent your own opener, rename the options, or add an intro or outro.
|
|
409
415
|
`,
|
|
410
416
|
'import-claude-design-from-url': dedent `
|
|
411
|
-
Import a design into Wix
|
|
417
|
+
Import a design created in Claude's design tool into Wix. Takes the signed claudeusercontent.com URL Claude Design produces for its self-contained HTML bundle (all images, fonts, and styles inlined); any other host is rejected. Creates a live Wix-hosted site and returns its URL.
|
|
418
|
+
NOT for site files the user provides themselves (their own HTML/CSS/JS, a zip, another builder's export) — for those, don't call this tool: send the user to https://www.wix.com/headless/drop?utm_campaign=mcp, where they upload the files and get a live hosted site. Give that URL exactly as written, keeping the utm_campaign=mcp parameter.
|
|
412
419
|
`,
|
|
413
420
|
RunWixCliCommand: dedent `
|
|
414
421
|
Executes Wix CLI commands for Wix app development and management.
|
|
@@ -441,8 +448,10 @@ export function buildToolDescriptions(includeReadme, includeImageUploadGuidance
|
|
|
441
448
|
SearchBuildAppsDocumentation: dedent `
|
|
442
449
|
Searches the Wix Build Apps documentation.
|
|
443
450
|
`,
|
|
444
|
-
|
|
445
|
-
|
|
451
|
+
SearchDevelopmentDocumentation: dedent `
|
|
452
|
+
Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
|
|
453
|
+
Skip it entirely for general, business, support, or Wix-editor questions.
|
|
454
|
+
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.
|
|
446
455
|
`,
|
|
447
456
|
SearchWixHeadlessDocumentation: dedent `
|
|
448
457
|
Searches the Wix Headless documentation.
|
|
@@ -807,6 +816,7 @@ export function buildToolDescriptions(includeReadme, includeImageUploadGuidance
|
|
|
807
816
|
CreateWixBusinessGuide: dedent `
|
|
808
817
|
Provides comprehensive documentation for creating a new Wix business (site, app, etc.).
|
|
809
818
|
Call this ONLY when the user explicitly asks for a headless site, a Wix Classic Editor site, or manual/advanced account/API-based site creation — these don't need the site's purpose first. For normal site-creation ${SITE_CREATION_COPY.normalCreationRoute.nonWidget}; for a specific template id, call \`CreateSiteFromTemplate\`.
|
|
819
|
+
Exception, even when the user says "headless": if they ALREADY HAVE the finished site as files (their own HTML/CSS/JS, a zip, an AI-builder export) and want those files hosted, don't call this tool — send them to https://www.wix.com/headless/drop?utm_campaign=mcp to upload the files and get a live hosted site (give that URL exactly, keeping the utm_campaign=mcp parameter). This guide's CLI flow is for BUILDING a headless frontend, not for hosting ready-made files.
|
|
810
820
|
|
|
811
821
|
## What This Tool Contains
|
|
812
822
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ALLOWED_HOSTNAMES } from '../api-call/validation.js';
|
|
2
|
+
import { ARRAY_QUERY_PARAMS_RULE } from './api-request-rules.js';
|
|
2
3
|
/**
|
|
3
4
|
* Centralized parameter descriptions organized by tool.
|
|
4
5
|
* Each tool has all its parameter descriptions in one place.
|
|
@@ -10,7 +11,8 @@ export const paramDescriptions = {
|
|
|
10
11
|
'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',
|
|
11
12
|
'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',
|
|
12
13
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(', ')}`,
|
|
13
|
-
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
|
|
14
|
+
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
|
|
15
|
+
ARRAY_QUERY_PARAMS_RULE
|
|
14
16
|
].join('\n'),
|
|
15
17
|
method: 'The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)',
|
|
16
18
|
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.',
|
|
@@ -83,8 +85,8 @@ export const paramDescriptions = {
|
|
|
83
85
|
searchTerm: 'The search term to search for in the Build Apps Documentation',
|
|
84
86
|
maxResults: 'The maximum number of results to return, default is 10, max is 15'
|
|
85
87
|
},
|
|
86
|
-
|
|
87
|
-
searchTerm: 'The search term
|
|
88
|
+
SearchDevelopmentDocumentation: {
|
|
89
|
+
searchTerm: 'The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.',
|
|
88
90
|
maxResults: 'The maximum number of results to return, default is 10, max is 15'
|
|
89
91
|
},
|
|
90
92
|
SearchWixHeadlessDocumentation: {
|
package/build/dts/docs/docs.js
CHANGED
|
@@ -399,11 +399,11 @@ export const addDocsTools = (server, allowedTools = [
|
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
-
//
|
|
402
|
+
// Development Documentation
|
|
403
403
|
if (allowedTools.includes('OVERVIEW') &&
|
|
404
|
-
!disableTools?.includes('
|
|
405
|
-
server.tool('
|
|
406
|
-
const d = desc('
|
|
404
|
+
!disableTools?.includes('SearchDevelopmentDocumentation')) {
|
|
405
|
+
server.tool('SearchDevelopmentDocumentation', getDescription('SearchDevelopmentDocumentation', defaultToolDescriptions.SearchDevelopmentDocumentation ?? ''), (() => {
|
|
406
|
+
const d = desc('SearchDevelopmentDocumentation');
|
|
407
407
|
return {
|
|
408
408
|
searchTerm: z.string().describe(d.searchTerm),
|
|
409
409
|
maxResults: z
|
|
@@ -438,8 +438,8 @@ export const addDocsTools = (server, allowedTools = [
|
|
|
438
438
|
panorama.errorMonitor().reportError(error);
|
|
439
439
|
captureException(error, {
|
|
440
440
|
tags: {
|
|
441
|
-
componentId: '
|
|
442
|
-
toolName: '
|
|
441
|
+
componentId: 'SearchDevelopmentDocumentation',
|
|
442
|
+
toolName: 'SearchDevelopmentDocumentation'
|
|
443
443
|
}
|
|
444
444
|
});
|
|
445
445
|
logger.error(`Error searching for ${searchTerm} in Wix Overview: ${error}`);
|
|
@@ -86,11 +86,11 @@ export function addImportClaudeDesignTool(server, authStrategy, options) {
|
|
|
86
86
|
designUrl = new URL(args.url);
|
|
87
87
|
}
|
|
88
88
|
catch {
|
|
89
|
-
return errorResult('Invalid design URL.');
|
|
89
|
+
return errorResult('Invalid design URL — this tool only accepts the claudeusercontent.com URL produced by Claude Design. For site files the user provided themselves, do not retry: send the user to https://www.wix.com/headless/drop?utm_campaign=mcp to upload them and get a live hosted site.');
|
|
90
90
|
}
|
|
91
91
|
if (designUrl.protocol !== 'https:' ||
|
|
92
92
|
!designUrl.hostname.endsWith(CLAUDE_USER_CONTENT_HOST_SUFFIX)) {
|
|
93
|
-
return errorResult('Invalid design URL.');
|
|
93
|
+
return errorResult('Invalid design URL — this tool only accepts the claudeusercontent.com URL produced by Claude Design. For site files the user provided themselves, do not retry: send the user to https://www.wix.com/headless/drop?utm_campaign=mcp to upload them and get a live hosted site.');
|
|
94
94
|
}
|
|
95
95
|
// Resolve the caller's account identity BEFORE the design fetch — the
|
|
96
96
|
// design URL is single-use, so an unauthenticated caller must fail
|
|
@@ -6,7 +6,7 @@ import { wixMcpRequestSrc39Evid1607, executeWixApiToolRequestSrc39Evid1612 } fro
|
|
|
6
6
|
* and concatenates text blocks with newlines.
|
|
7
7
|
*/
|
|
8
8
|
export declare function extractText(result: WixToolCallResult): string;
|
|
9
|
-
export declare function formatToolResultAdditionalFields(result: WixToolCallResult): string | undefined;
|
|
9
|
+
export declare function formatToolResultAdditionalFields(result: WixToolCallResult, extras?: Record<string, unknown>): string | undefined;
|
|
10
10
|
export declare function createToolBiEvent(params: Parameters<typeof wixMcpRequestSrc39Evid1607>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").wixMcpRequestSrc39Evid1607Params>;
|
|
11
11
|
export declare function createExecuteWixAPICallToolBiEvent(params: Parameters<typeof executeWixApiToolRequestSrc39Evid1612>[0]): import("@wix/bi-logger-api-infra-data/v2/types").LogObject<import("@wix/bi-logger-api-infra-data/v2/types").executeWixApiToolRequestSrc39Evid1612Params>;
|
|
12
12
|
//# sourceMappingURL=tool-bi.d.ts.map
|