@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/README.md
CHANGED
|
@@ -122,7 +122,7 @@ Set logging output:
|
|
|
122
122
|
- `VELO`: Velo Documentation (`SearchWixVeloDocumentation`)
|
|
123
123
|
- `BUSINESS_SOLUTIONS`: Business solutions recipes (`WixBusinessFlowsDocumentation`)
|
|
124
124
|
- `CLI`: Wix CLI Documentation (`SearchWixCLIDocumentation`)
|
|
125
|
-
- `OVERVIEW`: Wix
|
|
125
|
+
- `OVERVIEW`: Wix Development Documentation (`SearchDevelopmentDocumentation`)
|
|
126
126
|
|
|
127
127
|
**Experimental Tools:**
|
|
128
128
|
|
package/build/bin-standalone.js
CHANGED
|
@@ -71550,6 +71550,9 @@ function rethrowIfUnauthorized(error2) {
|
|
|
71550
71550
|
}
|
|
71551
71551
|
}
|
|
71552
71552
|
|
|
71553
|
+
// src/config/api-request-rules.ts
|
|
71554
|
+
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).";
|
|
71555
|
+
|
|
71553
71556
|
// src/config/default-config.ts
|
|
71554
71557
|
var AGENT_GOAL = dedent_default`
|
|
71555
71558
|
You are an agent that helps the user manage their Wix site.
|
|
@@ -71649,6 +71652,8 @@ var SITE_CREATION_COPY = {
|
|
|
71649
71652
|
var SITE_GUIDANCE = dedent_default`
|
|
71650
71653
|
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.
|
|
71651
71654
|
|
|
71655
|
+
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.
|
|
71656
|
+
|
|
71652
71657
|
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.
|
|
71653
71658
|
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.
|
|
71654
71659
|
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.
|
|
@@ -71671,11 +71676,13 @@ var EXECUTE_WIX_API_INTRO = dedent_default`
|
|
|
71671
71676
|
CODE CONTRACT:
|
|
71672
71677
|
- Pass an async function expression: \`async function() { ... }\` or \`async () => { ... }\`. Put every declaration, \`await\`, and \`return\` inside it, and do not invoke it yourself.
|
|
71673
71678
|
- Use only \`wix.request({ method, url, body })\` and in-memory JavaScript. Node.js modules, filesystem access, and downloadable-file creation are unavailable.
|
|
71679
|
+
- 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.
|
|
71674
71680
|
|
|
71675
71681
|
CONFIRM API CONTRACTS:
|
|
71676
71682
|
- 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.
|
|
71677
71683
|
- Prefer \`method.publicUrl\` from SearchWixAPISpec; never use \`method.servers[0]\`. Pass all supporting documentation URLs through \`sourceDocUrls\`.
|
|
71678
71684
|
- 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.
|
|
71685
|
+
- ${ARRAY_QUERY_PARAMS_RULE}
|
|
71679
71686
|
- 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.
|
|
71680
71687
|
`;
|
|
71681
71688
|
var EXECUTE_WIX_API_OUTPUT_AND_ERRORS = dedent_default`
|
|
@@ -71691,6 +71698,7 @@ var ACCOUNT_SITE_EXECUTE_SCOPE = dedent_default`
|
|
|
71691
71698
|
SCOPE AND SITE TARGETING:
|
|
71692
71699
|
- 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.
|
|
71693
71700
|
- If \`scope\` is omitted it defaults to site when either the ExecuteWixAPI call or \`wix.request\` provides a \`siteId\`; otherwise it defaults to account.
|
|
71701
|
+
- 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.
|
|
71694
71702
|
- \`scope: "account"\` ignores any \`siteId\` you pass, so a site-level endpoint called that way fails.
|
|
71695
71703
|
- Authentication is injected automatically; never set Authorization, wix-site-id, or wix-account-id headers.
|
|
71696
71704
|
- For one named site, prefer GetSiteContext. If it is unavailable, resolve the exact site and perform the action in the same invocation.
|
|
@@ -71978,7 +71986,8 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
71978
71986
|
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.
|
|
71979
71987
|
`,
|
|
71980
71988
|
"import-claude-design-from-url": dedent_default`
|
|
71981
|
-
Import a design into Wix
|
|
71989
|
+
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.
|
|
71990
|
+
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.
|
|
71982
71991
|
`,
|
|
71983
71992
|
RunWixCliCommand: dedent_default`
|
|
71984
71993
|
Executes Wix CLI commands for Wix app development and management.
|
|
@@ -72011,8 +72020,10 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
72011
72020
|
SearchBuildAppsDocumentation: dedent_default`
|
|
72012
72021
|
Searches the Wix Build Apps documentation.
|
|
72013
72022
|
`,
|
|
72014
|
-
|
|
72015
|
-
|
|
72023
|
+
SearchDevelopmentDocumentation: dedent_default`
|
|
72024
|
+
Broad Wix development documentation (platform concepts, developer guides, getting started). **Last resort — development tasks only.**
|
|
72025
|
+
Skip it entirely for general, business, support, or Wix-editor questions.
|
|
72026
|
+
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.
|
|
72016
72027
|
`,
|
|
72017
72028
|
SearchWixHeadlessDocumentation: dedent_default`
|
|
72018
72029
|
Searches the Wix Headless documentation.
|
|
@@ -72377,6 +72388,7 @@ function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true)
|
|
|
72377
72388
|
CreateWixBusinessGuide: dedent_default`
|
|
72378
72389
|
Provides comprehensive documentation for creating a new Wix business (site, app, etc.).
|
|
72379
72390
|
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\`.
|
|
72391
|
+
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.
|
|
72380
72392
|
|
|
72381
72393
|
## What This Tool Contains
|
|
72382
72394
|
|
|
@@ -72627,14 +72639,20 @@ function renderApps(apps, knownApps) {
|
|
|
72627
72639
|
}
|
|
72628
72640
|
function renderProperties(props) {
|
|
72629
72641
|
const sections = [];
|
|
72630
|
-
const
|
|
72631
|
-
if (props.language)
|
|
72632
|
-
if (props.locale?.country)
|
|
72633
|
-
|
|
72634
|
-
if (props.
|
|
72635
|
-
if (
|
|
72636
|
-
|
|
72637
|
-
|
|
72642
|
+
const regionalFormat = [];
|
|
72643
|
+
if (props.language) regionalFormat.push(`- Language: **${props.language}**`);
|
|
72644
|
+
if (props.locale?.country)
|
|
72645
|
+
regionalFormat.push(`- Locale region: **${props.locale.country}**`);
|
|
72646
|
+
if (props.timeZone) regionalFormat.push(`- Timezone: **${props.timeZone}**`);
|
|
72647
|
+
if (props.paymentCurrency)
|
|
72648
|
+
regionalFormat.push(`- Currency: **${props.paymentCurrency}**`);
|
|
72649
|
+
if (regionalFormat.length) {
|
|
72650
|
+
sections.push(`**Regional Format**
|
|
72651
|
+
${regionalFormat.join("\n")}`);
|
|
72652
|
+
}
|
|
72653
|
+
if (props.address?.country) {
|
|
72654
|
+
sections.push(`**Location**
|
|
72655
|
+
- Country: **${props.address.country}**`);
|
|
72638
72656
|
}
|
|
72639
72657
|
const contact = [];
|
|
72640
72658
|
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
@@ -72781,6 +72799,7 @@ var known_apps_default = {
|
|
|
72781
72799
|
"225dd912-7dea-4738-8688-4b8c6955ffc2": "Wix Forms",
|
|
72782
72800
|
"d80111c5-a0f4-47a8-b63a-65b54d774a27": "Wix Gift Cards",
|
|
72783
72801
|
"148c2287-c669-d849-d153-463c7486a694": "Wix Groups",
|
|
72802
|
+
"14bca956-e09f-f4d6-14d7-466cb3f09103": "Wix Hotels",
|
|
72784
72803
|
"13ee94c1-b635-8505-3391-97919052c16f": "Wix Invoices",
|
|
72785
72804
|
"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9": "Wix Members Area",
|
|
72786
72805
|
"14d84998-ae09-1abf-c6fc-3f3cace5bf19": "Wix Multilingual",
|
|
@@ -72798,7 +72817,16 @@ var known_apps_default = {
|
|
|
72798
72817
|
"1480c568-5cbd-9392-5604-1148f5faffa0": "Promote SEO",
|
|
72799
72818
|
"ff5d6eb1-65e4-4f9a-8b14-64d34c12cc2e": "Wix Rentals"
|
|
72800
72819
|
};
|
|
72801
|
-
var
|
|
72820
|
+
var DYNAMIC_CONTEXT_PATH = "/_api/dynamic-context/v1/dynamic-context";
|
|
72821
|
+
var DYNAMIC_CONTEXT_URL = `https://dev.wix.com${DYNAMIC_CONTEXT_PATH}`;
|
|
72822
|
+
var isWixHost = (hostname3) => hostname3 === "wix.com" || hostname3.endsWith(".wix.com");
|
|
72823
|
+
var dynamicContextUrl = () => {
|
|
72824
|
+
if (typeof window === "undefined") {
|
|
72825
|
+
return DYNAMIC_CONTEXT_URL;
|
|
72826
|
+
}
|
|
72827
|
+
const hostname3 = window.location?.hostname;
|
|
72828
|
+
return typeof hostname3 === "string" && isWixHost(hostname3) ? DYNAMIC_CONTEXT_PATH : DYNAMIC_CONTEXT_URL;
|
|
72829
|
+
};
|
|
72802
72830
|
var COUNT_SITES_URL = "https://www.wixapis.com/site-list/v2/sites/count";
|
|
72803
72831
|
var MAX_SITES_FOR_DYNAMIC_CONTEXT = 10;
|
|
72804
72832
|
var DYNAMIC_CONTEXT_PETRI_OVERRIDE = "shouldReturnDynamicContextInMCP#B";
|
|
@@ -72815,8 +72843,8 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
72815
72843
|
partnerContextEnabled: options,
|
|
72816
72844
|
includeAccountContext: options
|
|
72817
72845
|
} : options;
|
|
72818
|
-
const includePartnerContext = contextOptions?.partnerContextEnabled ??
|
|
72819
|
-
const includeAccountContext = contextOptions?.includeAccountContext ??
|
|
72846
|
+
const includePartnerContext = contextOptions?.partnerContextEnabled ?? true;
|
|
72847
|
+
const includeAccountContext = contextOptions?.includeAccountContext ?? true;
|
|
72820
72848
|
try {
|
|
72821
72849
|
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
72822
72850
|
const noFilter = !filter?.siteId && !filter?.siteName;
|
|
@@ -72850,7 +72878,7 @@ async function getDynamicContext(auth, httpClient, filter, options) {
|
|
|
72850
72878
|
if (filter?.siteId) body.site_id = filter.siteId;
|
|
72851
72879
|
else if (filter?.siteName) body.site_name = filter.siteName;
|
|
72852
72880
|
const dynamicContextPromise = httpClient.request({
|
|
72853
|
-
url:
|
|
72881
|
+
url: dynamicContextUrl(),
|
|
72854
72882
|
method: "POST",
|
|
72855
72883
|
headers: {
|
|
72856
72884
|
...accountHeaders,
|
|
@@ -72930,7 +72958,8 @@ var paramDescriptions = {
|
|
|
72930
72958
|
"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",
|
|
72931
72959
|
'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',
|
|
72932
72960
|
`Allowed API urls are: ${ALLOWED_HOSTNAMES.join(", ")}`,
|
|
72933
|
-
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool
|
|
72961
|
+
`Docs urls like https://dev.wix.com/docs/... are not API urls, if you want to read the docs, use the "ReadFullDocsArticle" tool`,
|
|
72962
|
+
ARRAY_QUERY_PARAMS_RULE
|
|
72934
72963
|
].join("\n"),
|
|
72935
72964
|
method: "The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)",
|
|
72936
72965
|
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.',
|
|
@@ -73003,8 +73032,8 @@ var paramDescriptions = {
|
|
|
73003
73032
|
searchTerm: "The search term to search for in the Build Apps Documentation",
|
|
73004
73033
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
73005
73034
|
},
|
|
73006
|
-
|
|
73007
|
-
searchTerm: "The search term
|
|
73035
|
+
SearchDevelopmentDocumentation: {
|
|
73036
|
+
searchTerm: "The development-related search term. Use only after a more specific docs search (REST/SDK/CLI/Build Apps/Headless/WDS) came back empty.",
|
|
73008
73037
|
maxResults: "The maximum number of results to return, default is 10, max is 15"
|
|
73009
73038
|
},
|
|
73010
73039
|
SearchWixHeadlessDocumentation: {
|
|
@@ -73811,15 +73840,15 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73811
73840
|
}
|
|
73812
73841
|
);
|
|
73813
73842
|
}
|
|
73814
|
-
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("
|
|
73843
|
+
if (allowedTools.includes("OVERVIEW") && !disableTools?.includes("SearchDevelopmentDocumentation")) {
|
|
73815
73844
|
server2.tool(
|
|
73816
|
-
"
|
|
73845
|
+
"SearchDevelopmentDocumentation",
|
|
73817
73846
|
getDescription(
|
|
73818
|
-
"
|
|
73819
|
-
defaultToolDescriptions.
|
|
73847
|
+
"SearchDevelopmentDocumentation",
|
|
73848
|
+
defaultToolDescriptions.SearchDevelopmentDocumentation ?? ""
|
|
73820
73849
|
),
|
|
73821
73850
|
(() => {
|
|
73822
|
-
const d = desc("
|
|
73851
|
+
const d = desc("SearchDevelopmentDocumentation");
|
|
73823
73852
|
return {
|
|
73824
73853
|
searchTerm: external_exports.string().describe(d.searchTerm),
|
|
73825
73854
|
maxResults: external_exports.number().describe(d.maxResults).min(1).max(15).optional().default(15)
|
|
@@ -73849,8 +73878,8 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
73849
73878
|
panorama.errorMonitor().reportError(error2);
|
|
73850
73879
|
captureException(error2, {
|
|
73851
73880
|
tags: {
|
|
73852
|
-
componentId: "
|
|
73853
|
-
toolName: "
|
|
73881
|
+
componentId: "SearchDevelopmentDocumentation",
|
|
73882
|
+
toolName: "SearchDevelopmentDocumentation"
|
|
73854
73883
|
}
|
|
73855
73884
|
});
|
|
73856
73885
|
logger2.error(
|
|
@@ -85265,7 +85294,7 @@ function extractText(result) {
|
|
|
85265
85294
|
return result.content.filter((content) => content.type === "text" && content.text != null).map((content) => content.text).join("\n");
|
|
85266
85295
|
}
|
|
85267
85296
|
var TOOL_RESULT_PREVIEW_MAX_CHARS = 4e3;
|
|
85268
|
-
function formatToolResultAdditionalFields(result) {
|
|
85297
|
+
function formatToolResultAdditionalFields(result, extras) {
|
|
85269
85298
|
const resultText = extractText(result);
|
|
85270
85299
|
const contentTypes = [
|
|
85271
85300
|
...new Set(
|
|
@@ -85281,7 +85310,8 @@ function formatToolResultAdditionalFields(result) {
|
|
|
85281
85310
|
resultPreview: resultText.slice(0, TOOL_RESULT_PREVIEW_MAX_CHARS),
|
|
85282
85311
|
resultTextLength: resultText.length,
|
|
85283
85312
|
resultPreviewTruncated: resultText.length > TOOL_RESULT_PREVIEW_MAX_CHARS,
|
|
85284
|
-
resultContentTypes: contentTypes
|
|
85313
|
+
resultContentTypes: contentTypes,
|
|
85314
|
+
...extras
|
|
85285
85315
|
});
|
|
85286
85316
|
}
|
|
85287
85317
|
function createToolBiEvent(params) {
|
|
@@ -85339,6 +85369,11 @@ var WixMcpServer = class extends McpServer {
|
|
|
85339
85369
|
isMcpAppsInMcpEnabled() {
|
|
85340
85370
|
return this.mcpAppsInMcpEnabled;
|
|
85341
85371
|
}
|
|
85372
|
+
/** Microsoft 365 Copilot ("sydney" at runtime) or Copilot Cowork ("copilot"). */
|
|
85373
|
+
isMicrosoftCopilotClient() {
|
|
85374
|
+
const clientName = this.getClientName?.()?.toLowerCase() ?? "";
|
|
85375
|
+
return clientName.includes("sydney") || clientName.includes("copilot");
|
|
85376
|
+
}
|
|
85342
85377
|
shouldRenderMcpApps() {
|
|
85343
85378
|
const clientName = this.getClientName?.()?.toLowerCase();
|
|
85344
85379
|
const isOpenAi = clientName?.includes("openai") ?? false;
|
|
@@ -85454,7 +85489,10 @@ var WixMcpServer = class extends McpServer {
|
|
|
85454
85489
|
if (!toolSucceeded) {
|
|
85455
85490
|
errorBody = extractText(cbResult);
|
|
85456
85491
|
} else {
|
|
85457
|
-
additionalFields = formatToolResultAdditionalFields(cbResult
|
|
85492
|
+
additionalFields = formatToolResultAdditionalFields(cbResult, {
|
|
85493
|
+
returnedRows: toolBiParams.returnedRows,
|
|
85494
|
+
originalLength: toolBiParams.originalLength
|
|
85495
|
+
});
|
|
85458
85496
|
}
|
|
85459
85497
|
if (toolSucceeded && !isDevEnvironment) {
|
|
85460
85498
|
panorama.transaction(toolName).finish({ toolInvocationId });
|
|
@@ -85982,6 +86020,19 @@ var MAX_ALLOWED_RESPONSE_CHARS = 2e6;
|
|
|
85982
86020
|
|
|
85983
86021
|
// src/api-call/index.ts
|
|
85984
86022
|
var DEFAULT_MAX_RESPONSE_SIZE = 5e4;
|
|
86023
|
+
function extractReturnedRows(responseData) {
|
|
86024
|
+
if (responseData === null || typeof responseData !== "object") {
|
|
86025
|
+
return void 0;
|
|
86026
|
+
}
|
|
86027
|
+
const data = responseData;
|
|
86028
|
+
const block = data.pagingMetadata ?? data.cursorPagingMetadata ?? data.pagingOffsetMetadata ?? data.metaData ?? data.metadata;
|
|
86029
|
+
const raw = block?.count;
|
|
86030
|
+
if (typeof raw !== "number" && (typeof raw !== "string" || raw.trim() === "")) {
|
|
86031
|
+
return void 0;
|
|
86032
|
+
}
|
|
86033
|
+
const count2 = Number(raw);
|
|
86034
|
+
return Number.isFinite(count2) ? count2 : void 0;
|
|
86035
|
+
}
|
|
85985
86036
|
function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_SIZE) {
|
|
85986
86037
|
if (typeof responseData === "string" && responseData.trim().startsWith("<!DOCTYPE")) {
|
|
85987
86038
|
return {
|
|
@@ -85989,13 +86040,15 @@ function formatApiResponse(responseData, maxResponseSize = DEFAULT_MAX_RESPONSE_
|
|
|
85989
86040
|
isError: true
|
|
85990
86041
|
};
|
|
85991
86042
|
}
|
|
86043
|
+
const returnedRows = extractReturnedRows(responseData);
|
|
85992
86044
|
let responseText = JSON.stringify(responseData);
|
|
86045
|
+
const originalLength = responseText.length;
|
|
85993
86046
|
const effectiveMax = Math.min(maxResponseSize, MAX_ALLOWED_RESPONSE_CHARS);
|
|
85994
86047
|
if (responseText.length > effectiveMax) {
|
|
85995
86048
|
responseText = responseText.slice(0, effectiveMax) + `
|
|
85996
86049
|
...[TRUNCATED - response was ${responseText.length} chars, showing first ${effectiveMax}]`;
|
|
85997
86050
|
}
|
|
85998
|
-
return { text: responseText, isError: false };
|
|
86051
|
+
return { text: responseText, isError: false, originalLength, returnedRows };
|
|
85999
86052
|
}
|
|
86000
86053
|
function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "ListWixSites", "ManageWixSite"], disableTools = [], enableTools = [], toolDescriptions, toolHints, maxResponseSize) {
|
|
86001
86054
|
const effectiveAllowedTools = [
|
|
@@ -86058,9 +86111,14 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86058
86111
|
data: method === "GET" ? void 0 : body
|
|
86059
86112
|
});
|
|
86060
86113
|
const requestId = response.headers?.["x-wix-request-id"];
|
|
86061
|
-
setToolBiParams({ requestId, siteId });
|
|
86062
86114
|
const responseData = await handleWixAPIResponse(response);
|
|
86063
86115
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
86116
|
+
setToolBiParams({
|
|
86117
|
+
requestId,
|
|
86118
|
+
siteId,
|
|
86119
|
+
returnedRows: formatted.returnedRows,
|
|
86120
|
+
originalLength: formatted.originalLength
|
|
86121
|
+
});
|
|
86064
86122
|
if (formatted.isError) {
|
|
86065
86123
|
return {
|
|
86066
86124
|
content: [
|
|
@@ -86199,7 +86257,7 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86199
86257
|
destructiveHint: true,
|
|
86200
86258
|
openWorldHint: false
|
|
86201
86259
|
}),
|
|
86202
|
-
async ({ url, body, method, reason }, { httpClient }) => {
|
|
86260
|
+
async ({ url, body, method, reason }, { httpClient, setToolBiParams }) => {
|
|
86203
86261
|
logger2.log(
|
|
86204
86262
|
`Calling Wix Account level API: ${url}, reason="${reason}", body: ${JSON.stringify(body)}`
|
|
86205
86263
|
);
|
|
@@ -86228,6 +86286,10 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
86228
86286
|
});
|
|
86229
86287
|
const responseData = await handleWixAPIResponse(response);
|
|
86230
86288
|
const formatted = formatApiResponse(responseData, maxResponseSize);
|
|
86289
|
+
setToolBiParams({
|
|
86290
|
+
returnedRows: formatted.returnedRows,
|
|
86291
|
+
originalLength: formatted.originalLength
|
|
86292
|
+
});
|
|
86231
86293
|
if (formatted.isError) {
|
|
86232
86294
|
return {
|
|
86233
86295
|
content: [
|