@wix/mcp 1.0.78 → 1.0.80
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/build/bin-standalone.js +43 -9
- package/build/cjs/index.cjs +384 -175
- package/build/cjs/toolkit.cjs +52 -15
- package/build/dts/account-tools/get-profile-tool.d.ts +5 -0
- package/build/dts/account-tools/get-profile-tool.js +49 -0
- package/build/dts/code-mode/index.d.ts +5 -4
- package/build/dts/code-mode/index.js +6 -68
- package/build/dts/config/default-config.d.ts +2 -2
- package/build/dts/config/default-config.js +32 -8
- package/build/dts/index.d.ts +1 -0
- package/build/dts/index.js +1 -0
- package/build/dts/toolkit-entry.d.cts +2 -0
- package/build/dts/toolkit-entry.d.ts +2 -0
- package/build/dts/toolkit.d.ts +2 -0
- package/build/dts/toolkit.js +14 -20
- package/build/esm/index.js +299 -117
- package/build/esm/toolkit.js +52 -15
- package/package.json +3 -2
package/build/cjs/toolkit.cjs
CHANGED
|
@@ -17658,7 +17658,7 @@ var DISCOVERY_FLOWS = [
|
|
|
17658
17658
|
"- METHOD CODE EXAMPLE BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() to get method code examples -> call API using CallWixSiteAPI() based on the method code examples",
|
|
17659
17659
|
"- FULL SCHEMA BASED: BrowseWixRESTDocsMenu() or SearchWixRESTDocumentation() -> find relevant method -> read method article using ReadFullDocsArticle() -> no method code examples found -> inspect the method schema using SearchWixAPISpec or ReadFullDocsMethodSchema -> call API using CallWixSiteAPI() based on the schema"
|
|
17660
17660
|
];
|
|
17661
|
-
function buildSystemReminderGuidelines(includeReadme) {
|
|
17661
|
+
function buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance) {
|
|
17662
17662
|
const exception = includeReadme ? "**Exception:** " : "";
|
|
17663
17663
|
const lines = [];
|
|
17664
17664
|
if (includeReadme) {
|
|
@@ -17670,9 +17670,13 @@ function buildSystemReminderGuidelines(includeReadme) {
|
|
|
17670
17670
|
);
|
|
17671
17671
|
}
|
|
17672
17672
|
lines.push(
|
|
17673
|
-
`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? "skip WixREADME and " : ""}call ListWixSites directly
|
|
17674
|
-
`${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? "WixREADME and " : ""}all docs/schema/API flows \u2014 call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`
|
|
17673
|
+
`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? "skip WixREADME and " : ""}call ListWixSites directly.`
|
|
17675
17674
|
);
|
|
17675
|
+
if (includeImageUploadGuidance) {
|
|
17676
|
+
lines.push(
|
|
17677
|
+
`${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? "WixREADME and " : ""}all docs/schema/API flows \u2014 call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`
|
|
17678
|
+
);
|
|
17679
|
+
}
|
|
17676
17680
|
if (includeReadme) {
|
|
17677
17681
|
lines.push(
|
|
17678
17682
|
"If the WixREADME tool is not available to you, you should use the other flows as described without using the WixREADME tool until the task is completed."
|
|
@@ -17699,9 +17703,15 @@ function buildSystemReminderFlows(includeReadme) {
|
|
|
17699
17703
|
lines.push(...DISCOVERY_FLOWS);
|
|
17700
17704
|
return lines.join("\n");
|
|
17701
17705
|
}
|
|
17702
|
-
var SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(
|
|
17703
|
-
|
|
17704
|
-
|
|
17706
|
+
var SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(
|
|
17707
|
+
true,
|
|
17708
|
+
true
|
|
17709
|
+
);
|
|
17710
|
+
function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
|
|
17711
|
+
const guidelines = buildSystemReminderGuidelines(
|
|
17712
|
+
includeReadme,
|
|
17713
|
+
includeImageUploadGuidance
|
|
17714
|
+
);
|
|
17705
17715
|
const flows = buildSystemReminderFlows(includeReadme);
|
|
17706
17716
|
return dedent_default`
|
|
17707
17717
|
<agent-mandatory-instructions>
|
|
@@ -17912,8 +17922,11 @@ var executeWixApiDescription = dedent_default`
|
|
|
17912
17922
|
|
|
17913
17923
|
${EXECUTE_WIX_API_MULTI_SITE_EXAMPLE}
|
|
17914
17924
|
`;
|
|
17915
|
-
function buildToolDescriptions(includeReadme) {
|
|
17916
|
-
const reminder = buildSystemReminder(
|
|
17925
|
+
function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true) {
|
|
17926
|
+
const reminder = buildSystemReminder(
|
|
17927
|
+
includeReadme,
|
|
17928
|
+
includeImageUploadGuidance
|
|
17929
|
+
);
|
|
17917
17930
|
return {
|
|
17918
17931
|
WixREADME: dedent_default`
|
|
17919
17932
|
# Tool: WixREADME
|
|
@@ -17964,6 +17977,7 @@ function buildToolDescriptions(includeReadme) {
|
|
|
17964
17977
|
**Prefer this tool over CallWixSiteAPI for listing sites.** Call this tool directly — it already knows the correct API and handles everything needed. Only fall back to CallWixSiteAPI if the user needs advanced filtering or specific site details beyond what this tool provides.
|
|
17965
17978
|
${reminder}
|
|
17966
17979
|
`,
|
|
17980
|
+
get_profile: "Returns the authenticated user's email address",
|
|
17967
17981
|
GetSiteContext: dedent_default`
|
|
17968
17982
|
Fetches deep context for a specific Wix site and returns it as structured markdown.
|
|
17969
17983
|
|
|
@@ -18200,7 +18214,27 @@ function buildToolDescriptions(includeReadme) {
|
|
|
18200
18214
|
|
|
18201
18215
|
Your code MUST be an \`async function()\` expression that returns a value.
|
|
18202
18216
|
|
|
18203
|
-
Top-level verticals
|
|
18217
|
+
Top-level verticals and their subcategories. This is a shallow orientation snapshot, NOT the full tree: every subcategory below contains many more resources, and each resource its methods — none of them listed here. Filter lightIndex by menuPath for the complete live tree:
|
|
18218
|
+
wix-apis
|
|
18219
|
+
├── account-level
|
|
18220
|
+
│ └── accounts, ai-credits, b2b-site-management, domains, enterprise, resellers, sites, studio-workspace, user-management
|
|
18221
|
+
├── app-management
|
|
18222
|
+
│ └── app-billing, app-extensions, app-installations, app-instance, app-permissions, app-tools, bi-event, companion-apps, embedded-scripts, market-listing, oauth-2, site-plugins
|
|
18223
|
+
├── assets
|
|
18224
|
+
│ └── media, pro-gallery, rich-content
|
|
18225
|
+
├── business-management
|
|
18226
|
+
│ └── ai-site-chat, analytics, app-installation, async-job, automations, branches, calendar, captcha, cookie-consent-policy, custom-embeds, dashboard, data-extension-schema, faq-app, functions, get-paid, google-business-profile, headless, locations, marketing, multilingual, notifications, online-programs, payments, secrets, seo, site-properties, site-search, site-urls, tags
|
|
18227
|
+
├── business-solutions
|
|
18228
|
+
│ └── benefit-programs, blog, bookings, cms, coupons, donations, e-commerce, events, forum, gift-cards, meetings, portfolio, pricing-plans, restaurants, stores, suppliers-hub
|
|
18229
|
+
├── crm
|
|
18230
|
+
│ └── communication, community, crm, forms, loyalty-program, members-contacts
|
|
18231
|
+
├── mobile
|
|
18232
|
+
│ └── containers-app
|
|
18233
|
+
├── site
|
|
18234
|
+
│ └── accessibility, viewer
|
|
18235
|
+
└── tools
|
|
18236
|
+
└── dynamic-site-context, semantic-search
|
|
18237
|
+
(each leaf above expands into resources → methods; explore via lightIndex, e.g. lightIndex.filter(r => r.menuPath[1] === "e-commerce"))
|
|
18204
18238
|
|
|
18205
18239
|
Important schema guidance:
|
|
18206
18240
|
- For ExecuteWixAPI, ALWAYS use \`method.publicUrl\`. It is the complete, executable \`https://www.wixapis.com/...\` URL for that method. When \`publicUrl\` is present, never build the execution URL by hand and never expose any other field as "the endpoint".
|
|
@@ -21587,13 +21621,13 @@ function createWixToolkit(options) {
|
|
|
21587
21621
|
clientName,
|
|
21588
21622
|
hooks,
|
|
21589
21623
|
conversationId,
|
|
21590
|
-
includeReadmeMentions = false
|
|
21624
|
+
includeReadmeMentions = false,
|
|
21625
|
+
includeImageUploadGuidance = false
|
|
21591
21626
|
} = options;
|
|
21592
21627
|
const authStrategy = normalizeAuth(auth);
|
|
21593
21628
|
const executeWixApiRequested = isExecuteWixApiRequested(api);
|
|
21594
|
-
|
|
21629
|
+
const descriptionsWithoutReadme = buildToolDescriptions(includeReadmeMentions, includeImageUploadGuidance);
|
|
21595
21630
|
if (!includeReadmeMentions) {
|
|
21596
|
-
descriptionsWithoutReadme = buildToolDescriptions(false);
|
|
21597
21631
|
delete descriptionsWithoutReadme.WixREADME;
|
|
21598
21632
|
}
|
|
21599
21633
|
const sessionId = v4_default();
|
|
@@ -21610,13 +21644,16 @@ function createWixToolkit(options) {
|
|
|
21610
21644
|
authStrategy,
|
|
21611
21645
|
dynamicContextEnabled: true,
|
|
21612
21646
|
// README-free defaults first so consumer overrides still win.
|
|
21613
|
-
toolDescriptions:
|
|
21647
|
+
toolDescriptions: {
|
|
21648
|
+
...descriptionsWithoutReadme,
|
|
21649
|
+
...docsOptions.toolDescriptions
|
|
21650
|
+
}
|
|
21614
21651
|
});
|
|
21615
21652
|
} else {
|
|
21616
21653
|
addDocsTools(server, void 0, {
|
|
21617
21654
|
authStrategy,
|
|
21618
21655
|
dynamicContextEnabled: true,
|
|
21619
|
-
|
|
21656
|
+
toolDescriptions: descriptionsWithoutReadme
|
|
21620
21657
|
});
|
|
21621
21658
|
}
|
|
21622
21659
|
if (api) {
|
|
@@ -21629,7 +21666,7 @@ function createWixToolkit(options) {
|
|
|
21629
21666
|
maxResponseSize,
|
|
21630
21667
|
codeModeBaseUrl = "https://mcp.wix.com"
|
|
21631
21668
|
} = api;
|
|
21632
|
-
const effectiveToolDescriptions =
|
|
21669
|
+
const effectiveToolDescriptions = {
|
|
21633
21670
|
...descriptionsWithoutReadme,
|
|
21634
21671
|
...executeWixApiRequested ? executeCodeModeToolDescriptions : {},
|
|
21635
21672
|
...toolDescriptions
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type McpAuthenticationStrategy } from '../auth/index.js';
|
|
2
|
+
import type { WixMcpServer } from '../wix-mcp-server.js';
|
|
3
|
+
import type { ToolHintsConfig } from '../api-call/index.js';
|
|
4
|
+
export declare function addGetProfileTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy, disableTools?: string[], toolDescriptions?: Record<string, string>, toolHints?: Record<string, ToolHintsConfig>): void;
|
|
5
|
+
//# sourceMappingURL=get-profile-tool.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { rethrowIfUnauthorized } from '../auth/index.js';
|
|
2
|
+
import { defaultToolDescriptions } from '../config/default-config.js';
|
|
3
|
+
import { createHttpClient } from '@wix/http-client';
|
|
4
|
+
import { getTeamMember } from '@wix/ambassador-identity-account-v1-user/http';
|
|
5
|
+
const WIX_APIS_BASE_URL = 'https://www.wixapis.com';
|
|
6
|
+
const GET_PROFILE_TOOL_NAME = 'get_profile';
|
|
7
|
+
export function addGetProfileTool(server, authStrategy, disableTools = [], toolDescriptions, toolHints) {
|
|
8
|
+
if (disableTools.includes(GET_PROFILE_TOOL_NAME)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const cache = {};
|
|
12
|
+
const hints = toolHints?.[GET_PROFILE_TOOL_NAME];
|
|
13
|
+
server.tool(GET_PROFILE_TOOL_NAME, toolDescriptions?.[GET_PROFILE_TOOL_NAME] ??
|
|
14
|
+
defaultToolDescriptions[GET_PROFILE_TOOL_NAME], {}, {
|
|
15
|
+
readOnlyHint: hints?.readOnlyHint ?? true,
|
|
16
|
+
destructiveHint: hints?.destructiveHint ?? false,
|
|
17
|
+
openWorldHint: hints?.openWorldHint ?? false
|
|
18
|
+
}, async () => {
|
|
19
|
+
const profilePromise = (cache.profilePromise ??= (async () => {
|
|
20
|
+
const accountAuthHeaders = await authStrategy.getAccountAuthHeaders();
|
|
21
|
+
const httpClient = createHttpClient({
|
|
22
|
+
baseURL: WIX_APIS_BASE_URL,
|
|
23
|
+
headers: accountAuthHeaders
|
|
24
|
+
});
|
|
25
|
+
const response = await httpClient.request(getTeamMember({}));
|
|
26
|
+
const email = response.data.user?.email;
|
|
27
|
+
if (!email) {
|
|
28
|
+
throw new Error('The current Wix user profile has no email address.');
|
|
29
|
+
}
|
|
30
|
+
return { email };
|
|
31
|
+
})());
|
|
32
|
+
const profile = await profilePromise.catch(async (error) => {
|
|
33
|
+
cache.profilePromise = undefined;
|
|
34
|
+
rethrowIfUnauthorized(error);
|
|
35
|
+
await authStrategy.enforceValidWixToken?.(error);
|
|
36
|
+
throw error;
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: 'text',
|
|
42
|
+
text: profile.email
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
structuredContent: profile
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=get-profile-tool.js.map
|
|
@@ -19,10 +19,11 @@ export interface CodeModeOptions {
|
|
|
19
19
|
export declare const EXECUTE_TOOL_NAME = "ExecuteWixAPI";
|
|
20
20
|
export declare function addCodeModeTools(server: WixMcpServer, options: CodeModeOptions): Promise<void>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* Register SearchWixAPISpec. The description must stay a byte-stable
|
|
23
|
+
* constant: tool descriptions sit at the head of consumers' LLM prompt-cache
|
|
24
|
+
* prefix, so any variance invalidates their entire cache. The verticals
|
|
25
|
+
* snapshot lives in default-config.ts; agents see the live tree via
|
|
26
|
+
* lightIndex.
|
|
26
27
|
*/
|
|
27
28
|
export declare function addSearchCodeModeTool(server: WixMcpServer, options: CodeModeOptions): void;
|
|
28
29
|
export declare function addExecuteCodeModeTool(server: WixMcpServer, options: CodeModeOptions): void;
|
|
@@ -10,9 +10,7 @@ const SEARCH_TOOL_NAME = 'SearchWixAPISpec';
|
|
|
10
10
|
export const EXECUTE_TOOL_NAME = 'ExecuteWixAPI';
|
|
11
11
|
export async function addCodeModeTools(server, options) {
|
|
12
12
|
const { codeModeBaseUrl, authStrategy, disableTools = [], toolDescriptions, maxResponseSize } = options;
|
|
13
|
-
|
|
14
|
-
await addSearchTool(server, codeModeBaseUrl, disableTools, toolDescriptions, maxResponseSize, authStrategy);
|
|
15
|
-
}
|
|
13
|
+
addSearchCodeModeTool(server, options);
|
|
16
14
|
if (!disableTools.includes(EXECUTE_TOOL_NAME) && authStrategy) {
|
|
17
15
|
addExecuteCodeModeTool(server, {
|
|
18
16
|
codeModeBaseUrl,
|
|
@@ -24,10 +22,11 @@ export async function addCodeModeTools(server, options) {
|
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
25
|
+
* Register SearchWixAPISpec. The description must stay a byte-stable
|
|
26
|
+
* constant: tool descriptions sit at the head of consumers' LLM prompt-cache
|
|
27
|
+
* prefix, so any variance invalidates their entire cache. The verticals
|
|
28
|
+
* snapshot lives in default-config.ts; agents see the live tree via
|
|
29
|
+
* lightIndex.
|
|
31
30
|
*/
|
|
32
31
|
export function addSearchCodeModeTool(server, options) {
|
|
33
32
|
const { codeModeBaseUrl, authStrategy, disableTools = [], toolDescriptions, maxResponseSize } = options;
|
|
@@ -51,67 +50,6 @@ export function addExecuteCodeModeTool(server, options) {
|
|
|
51
50
|
maxResponseSize
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
const CATEGORY_TREE_CODE = `async function() {
|
|
55
|
-
const tree = {};
|
|
56
|
-
lightIndex.forEach(r => {
|
|
57
|
-
const top = r.menuPath[0];
|
|
58
|
-
const sub = r.menuPath[1];
|
|
59
|
-
if (!tree[top]) tree[top] = {};
|
|
60
|
-
if (sub) { if (!tree[top][sub]) tree[top][sub] = 0; tree[top][sub]++; }
|
|
61
|
-
});
|
|
62
|
-
return Object.entries(tree).map(([cat, subs]) => {
|
|
63
|
-
const total = Object.values(subs).reduce((a, b) => a + b, 0);
|
|
64
|
-
return cat + ' [' + total + ' resources]: ' + Object.keys(subs).join(', ');
|
|
65
|
-
}).join('\\n');
|
|
66
|
-
}`;
|
|
67
|
-
async function fetchCategoryTree(codeModeBaseUrl, authorization) {
|
|
68
|
-
// Precomputed by the server's spec-sync cron. The legacy path below ran
|
|
69
|
-
// CATEGORY_TREE_CODE in a Dynamic Worker on every tool registration —
|
|
70
|
-
// one billable isolate per MCP session; keep it only as a fallback for
|
|
71
|
-
// servers that predate the category-tree endpoint.
|
|
72
|
-
try {
|
|
73
|
-
const resp = await fetch(`${codeModeBaseUrl}/api/code-mode/category-tree`, {
|
|
74
|
-
headers: authorization ? { Authorization: authorization } : {}
|
|
75
|
-
});
|
|
76
|
-
if (resp.ok) {
|
|
77
|
-
const data = (await resp.json());
|
|
78
|
-
if (typeof data.result === 'string')
|
|
79
|
-
return data.result;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// fall through to the search-based fallback
|
|
84
|
-
}
|
|
85
|
-
return fetchCategoryTreeViaSearch(`${codeModeBaseUrl}/api/code-mode/search`, authorization);
|
|
86
|
-
}
|
|
87
|
-
async function fetchCategoryTreeViaSearch(searchUrl, authorization) {
|
|
88
|
-
try {
|
|
89
|
-
const resp = await fetch(searchUrl, {
|
|
90
|
-
method: 'POST',
|
|
91
|
-
headers: {
|
|
92
|
-
'Content-Type': 'application/json',
|
|
93
|
-
...(authorization ? { Authorization: authorization } : {})
|
|
94
|
-
},
|
|
95
|
-
body: JSON.stringify({ code: CATEGORY_TREE_CODE })
|
|
96
|
-
});
|
|
97
|
-
if (!resp.ok)
|
|
98
|
-
return null;
|
|
99
|
-
const data = (await resp.json());
|
|
100
|
-
return typeof data.result === 'string' ? data.result : null;
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
async function addSearchTool(server, codeModeBaseUrl, _disableTools, toolDescriptions, maxResponseSize, authStrategy) {
|
|
107
|
-
let description = toolDescriptions?.[SEARCH_TOOL_NAME] ??
|
|
108
|
-
defaultToolDescriptions.SearchWixAPISpec;
|
|
109
|
-
const categoryTree = await fetchCategoryTree(codeModeBaseUrl, await resolveLoopbackAuthorization(authStrategy));
|
|
110
|
-
if (categoryTree) {
|
|
111
|
-
description = description.replace(/Top-level verticals:.*$/m, categoryTree);
|
|
112
|
-
}
|
|
113
|
-
registerSearchTool(server, codeModeBaseUrl, description, maxResponseSize, authStrategy);
|
|
114
|
-
}
|
|
115
53
|
const SEARCH_MAX_RESPONSE_CHARS = 64_000;
|
|
116
54
|
/**
|
|
117
55
|
* Search needs no auth of its own; without a header the call is bucketed by the
|
|
@@ -21,7 +21,7 @@ export interface ModeDefaultConfig {
|
|
|
21
21
|
skillsPrOverrideEnabled?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare const SYSTEM_REMINDER_GUIDELINES: string;
|
|
24
|
-
export declare function buildSystemReminder(includeReadme: boolean): string;
|
|
24
|
+
export declare function buildSystemReminder(includeReadme: boolean, includeImageUploadGuidance?: boolean): string;
|
|
25
25
|
export declare const SYSTEM_REMINDER: string;
|
|
26
26
|
export declare const SITE_CREATION_COPY: {
|
|
27
27
|
readonly templatePick: {
|
|
@@ -40,7 +40,7 @@ export declare const SITE_CREATION_COPY: {
|
|
|
40
40
|
/** Rewrites non-widget copy into its widget form; a no-op on text that carries no divergence. */
|
|
41
41
|
export declare const toWidget: (text: string) => string;
|
|
42
42
|
export declare const executeWixApiDescription: string;
|
|
43
|
-
export declare function buildToolDescriptions(includeReadme: boolean): Record<string, string>;
|
|
43
|
+
export declare function buildToolDescriptions(includeReadme: boolean, includeImageUploadGuidance?: boolean): Record<string, string>;
|
|
44
44
|
/**
|
|
45
45
|
* Canonical (README-inclusive) tool descriptions used by the live MCP server and
|
|
46
46
|
* all existing importers.
|
|
@@ -13,13 +13,16 @@ const DISCOVERY_FLOWS = [
|
|
|
13
13
|
];
|
|
14
14
|
// README-only lines and site-creation routing are added only when includeReadme
|
|
15
15
|
// is true (README-free consumers like aria don't do site creation).
|
|
16
|
-
function buildSystemReminderGuidelines(includeReadme) {
|
|
16
|
+
function buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance) {
|
|
17
17
|
const exception = includeReadme ? '**Exception:** ' : '';
|
|
18
18
|
const lines = [];
|
|
19
19
|
if (includeReadme) {
|
|
20
20
|
lines.push('if the WixREADME tool is available to you, YOU MUST USE IT AT THE BEGINNING OF ANY CONVERSATION and then continue with calling the other tools and calling the Wix APIs until the task is completed.', '**Exception — creating a new Wix site/website:** For a normal creation request — and only then — skip WixREADME and the docs search, and route straight to the Wix site-creation tools available to you; their descriptions carry the routing rules. Everything else starts with WixREADME as usual.', "If the user explicitly asks for a headless site, Wix Classic Editor site, or manual account/API-based site creation, call CreateWixBusinessGuide right away — these don't need the site's purpose first.", "Never default to AI or search templates unless the user explicitly requests it. When the user named no creation method - let the user make that choice as the site-creation tools' descriptions direct. Never route normal site creation through ManageWixSite, CallWixSiteAPI, or ExecuteWixAPI.");
|
|
21
21
|
}
|
|
22
|
-
lines.push(`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? 'skip WixREADME and ' : ''}call ListWixSites directly
|
|
22
|
+
lines.push(`${exception}If the user asks to list, show, or find their Wix sites, ${includeReadme ? 'skip WixREADME and ' : ''}call ListWixSites directly.`);
|
|
23
|
+
if (includeImageUploadGuidance) {
|
|
24
|
+
lines.push(`${exception}If the user wants to upload local or attached image files to a Wix site, skip ${includeReadme ? 'WixREADME and ' : ''}all docs/schema/API flows — call UploadImageToWixSite directly. Do NOT use ExecuteWixAPI, SearchWixAPISpec, or any Media Manager REST API for image uploads.`);
|
|
25
|
+
}
|
|
23
26
|
if (includeReadme) {
|
|
24
27
|
lines.push('If the WixREADME tool is not available to you, you should use the other flows as described without using the WixREADME tool until the task is completed.');
|
|
25
28
|
}
|
|
@@ -34,9 +37,9 @@ function buildSystemReminderFlows(includeReadme) {
|
|
|
34
37
|
lines.push(...DISCOVERY_FLOWS);
|
|
35
38
|
return lines.join('\n');
|
|
36
39
|
}
|
|
37
|
-
export const SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(true);
|
|
38
|
-
export function buildSystemReminder(includeReadme) {
|
|
39
|
-
const guidelines = buildSystemReminderGuidelines(includeReadme);
|
|
40
|
+
export const SYSTEM_REMINDER_GUIDELINES = buildSystemReminderGuidelines(true, true);
|
|
41
|
+
export function buildSystemReminder(includeReadme, includeImageUploadGuidance = true) {
|
|
42
|
+
const guidelines = buildSystemReminderGuidelines(includeReadme, includeImageUploadGuidance);
|
|
40
43
|
const flows = buildSystemReminderFlows(includeReadme);
|
|
41
44
|
return dedent `
|
|
42
45
|
<agent-mandatory-instructions>
|
|
@@ -254,8 +257,8 @@ export const executeWixApiDescription = dedent `
|
|
|
254
257
|
|
|
255
258
|
${EXECUTE_WIX_API_MULTI_SITE_EXAMPLE}
|
|
256
259
|
`;
|
|
257
|
-
export function buildToolDescriptions(includeReadme) {
|
|
258
|
-
const reminder = buildSystemReminder(includeReadme);
|
|
260
|
+
export function buildToolDescriptions(includeReadme, includeImageUploadGuidance = true) {
|
|
261
|
+
const reminder = buildSystemReminder(includeReadme, includeImageUploadGuidance);
|
|
259
262
|
return {
|
|
260
263
|
WixREADME: dedent `
|
|
261
264
|
# Tool: WixREADME
|
|
@@ -306,6 +309,7 @@ export function buildToolDescriptions(includeReadme) {
|
|
|
306
309
|
**Prefer this tool over CallWixSiteAPI for listing sites.** Call this tool directly — it already knows the correct API and handles everything needed. Only fall back to CallWixSiteAPI if the user needs advanced filtering or specific site details beyond what this tool provides.
|
|
307
310
|
${reminder}
|
|
308
311
|
`,
|
|
312
|
+
get_profile: "Returns the authenticated user's email address",
|
|
309
313
|
GetSiteContext: dedent `
|
|
310
314
|
Fetches deep context for a specific Wix site and returns it as structured markdown.
|
|
311
315
|
|
|
@@ -542,7 +546,27 @@ export function buildToolDescriptions(includeReadme) {
|
|
|
542
546
|
|
|
543
547
|
Your code MUST be an \`async function()\` expression that returns a value.
|
|
544
548
|
|
|
545
|
-
Top-level verticals
|
|
549
|
+
Top-level verticals and their subcategories. This is a shallow orientation snapshot, NOT the full tree: every subcategory below contains many more resources, and each resource its methods — none of them listed here. Filter lightIndex by menuPath for the complete live tree:
|
|
550
|
+
wix-apis
|
|
551
|
+
├── account-level
|
|
552
|
+
│ └── accounts, ai-credits, b2b-site-management, domains, enterprise, resellers, sites, studio-workspace, user-management
|
|
553
|
+
├── app-management
|
|
554
|
+
│ └── app-billing, app-extensions, app-installations, app-instance, app-permissions, app-tools, bi-event, companion-apps, embedded-scripts, market-listing, oauth-2, site-plugins
|
|
555
|
+
├── assets
|
|
556
|
+
│ └── media, pro-gallery, rich-content
|
|
557
|
+
├── business-management
|
|
558
|
+
│ └── ai-site-chat, analytics, app-installation, async-job, automations, branches, calendar, captcha, cookie-consent-policy, custom-embeds, dashboard, data-extension-schema, faq-app, functions, get-paid, google-business-profile, headless, locations, marketing, multilingual, notifications, online-programs, payments, secrets, seo, site-properties, site-search, site-urls, tags
|
|
559
|
+
├── business-solutions
|
|
560
|
+
│ └── benefit-programs, blog, bookings, cms, coupons, donations, e-commerce, events, forum, gift-cards, meetings, portfolio, pricing-plans, restaurants, stores, suppliers-hub
|
|
561
|
+
├── crm
|
|
562
|
+
│ └── communication, community, crm, forms, loyalty-program, members-contacts
|
|
563
|
+
├── mobile
|
|
564
|
+
│ └── containers-app
|
|
565
|
+
├── site
|
|
566
|
+
│ └── accessibility, viewer
|
|
567
|
+
└── tools
|
|
568
|
+
└── dynamic-site-context, semantic-search
|
|
569
|
+
(each leaf above expands into resources → methods; explore via lightIndex, e.g. lightIndex.filter(r => r.menuPath[1] === "e-commerce"))
|
|
546
570
|
|
|
547
571
|
Important schema guidance:
|
|
548
572
|
- For ExecuteWixAPI, ALWAYS use \`method.publicUrl\`. It is the complete, executable \`https://www.wixapis.com/...\` URL for that method. When \`publicUrl\` is present, never build the execution URL by hand and never expose any other field as "the endpoint".
|
package/build/dts/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { addApiCallTool, ToolHintsConfig } from './api-call/index.js';
|
|
|
5
5
|
export { handleWixAPIResponse } from './tool-utils.js';
|
|
6
6
|
export { addDocsResources } from './resources/docs.js';
|
|
7
7
|
export { addSupportTool } from './support/index.js';
|
|
8
|
+
export { addGetProfileTool } from './account-tools/get-profile-tool.js';
|
|
8
9
|
export { addCreateSiteWidgetTool, addEditSiteWidgetTool, addPullSiteJobTool, addClaimSiteTool, addSiteCreationWidgetTools, addWixSiteCreationTool, addSearchSiteTemplatesTool, addCreateSiteFromTemplateTool, type SiteWidgetToolOptions } from './site-widget-tools/index.js';
|
|
9
10
|
export * from './wixel/index.js';
|
|
10
11
|
export { addImportClaudeDesignTool, type ImportClaudeDesignToolOptions } from './import-claude-design-tool/index.js';
|
package/build/dts/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { addApiCallTool } from './api-call/index.js';
|
|
|
5
5
|
export { handleWixAPIResponse } from './tool-utils.js';
|
|
6
6
|
export { addDocsResources } from './resources/docs.js';
|
|
7
7
|
export { addSupportTool } from './support/index.js';
|
|
8
|
+
export { addGetProfileTool } from './account-tools/get-profile-tool.js';
|
|
8
9
|
export { addCreateSiteWidgetTool, addEditSiteWidgetTool, addPullSiteJobTool, addClaimSiteTool, addSiteCreationWidgetTools, addWixSiteCreationTool, addSearchSiteTemplatesTool, addCreateSiteFromTemplateTool } from './site-widget-tools/index.js';
|
|
9
10
|
export * from './wixel/index.js';
|
|
10
11
|
export { addImportClaudeDesignTool } from './import-claude-design-tool/index.js';
|
|
@@ -289,6 +289,8 @@ export interface WixToolkitOptions {
|
|
|
289
289
|
* MCP server's text. Only affects description text — never the tool set itself.
|
|
290
290
|
*/
|
|
291
291
|
includeReadmeMentions?: boolean;
|
|
292
|
+
/** Keep image-upload routing guidance in tool descriptions. Defaults to `false`. */
|
|
293
|
+
includeImageUploadGuidance?: boolean;
|
|
292
294
|
}
|
|
293
295
|
/**
|
|
294
296
|
* Create a WixToolkit that provides pre-wired tool objects for in-process use.
|
|
@@ -289,6 +289,8 @@ export interface WixToolkitOptions {
|
|
|
289
289
|
* MCP server's text. Only affects description text — never the tool set itself.
|
|
290
290
|
*/
|
|
291
291
|
includeReadmeMentions?: boolean;
|
|
292
|
+
/** Keep image-upload routing guidance in tool descriptions. Defaults to `false`. */
|
|
293
|
+
includeImageUploadGuidance?: boolean;
|
|
292
294
|
}
|
|
293
295
|
/**
|
|
294
296
|
* Create a WixToolkit that provides pre-wired tool objects for in-process use.
|
package/build/dts/toolkit.d.ts
CHANGED
|
@@ -151,6 +151,8 @@ export interface WixToolkitOptions {
|
|
|
151
151
|
* MCP server's text. Only affects description text — never the tool set itself.
|
|
152
152
|
*/
|
|
153
153
|
includeReadmeMentions?: boolean;
|
|
154
|
+
/** Keep image-upload routing guidance in tool descriptions. Defaults to `false`. */
|
|
155
|
+
includeImageUploadGuidance?: boolean;
|
|
154
156
|
}
|
|
155
157
|
export { extractText, formatToolResultAdditionalFields };
|
|
156
158
|
/**
|
package/build/dts/toolkit.js
CHANGED
|
@@ -148,14 +148,13 @@ export { extractText, formatToolResultAdditionalFields };
|
|
|
148
148
|
* schema manipulation (defaults) internally.
|
|
149
149
|
*/
|
|
150
150
|
export function createWixToolkit(options) {
|
|
151
|
-
const { auth, docs, api, defaults = {}, exclude = [], clientName, hooks, conversationId, includeReadmeMentions = false } = options;
|
|
151
|
+
const { auth, docs, api, defaults = {}, exclude = [], clientName, hooks, conversationId, includeReadmeMentions = false, includeImageUploadGuidance = false } = options;
|
|
152
152
|
const authStrategy = normalizeAuth(auth);
|
|
153
153
|
const executeWixApiRequested = isExecuteWixApiRequested(api);
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
|
|
154
|
+
// Apply both description flags consistently. WixREADME is left out when
|
|
155
|
+
// mentions are disabled so its own description keeps its default text.
|
|
156
|
+
const descriptionsWithoutReadme = buildToolDescriptions(includeReadmeMentions, includeImageUploadGuidance);
|
|
157
157
|
if (!includeReadmeMentions) {
|
|
158
|
-
descriptionsWithoutReadme = buildToolDescriptions(false);
|
|
159
158
|
delete descriptionsWithoutReadme.WixREADME;
|
|
160
159
|
}
|
|
161
160
|
const sessionId = uuidv4();
|
|
@@ -177,9 +176,10 @@ export function createWixToolkit(options) {
|
|
|
177
176
|
authStrategy,
|
|
178
177
|
dynamicContextEnabled: true,
|
|
179
178
|
// README-free defaults first so consumer overrides still win.
|
|
180
|
-
toolDescriptions:
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
toolDescriptions: {
|
|
180
|
+
...descriptionsWithoutReadme,
|
|
181
|
+
...docsOptions.toolDescriptions
|
|
182
|
+
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
@@ -187,24 +187,18 @@ export function createWixToolkit(options) {
|
|
|
187
187
|
addDocsTools(server, undefined, {
|
|
188
188
|
authStrategy,
|
|
189
189
|
dynamicContextEnabled: true,
|
|
190
|
-
|
|
191
|
-
? { toolDescriptions: descriptionsWithoutReadme }
|
|
192
|
-
: {})
|
|
190
|
+
toolDescriptions: descriptionsWithoutReadme
|
|
193
191
|
});
|
|
194
192
|
}
|
|
195
193
|
// Register API tools
|
|
196
194
|
if (api) {
|
|
197
195
|
const { tools: apiTools, disableTools, enableTools, toolDescriptions, toolHints, maxResponseSize, codeModeBaseUrl = 'https://mcp.wix.com' } = api;
|
|
198
196
|
// Precedence (low → high): README-free defaults, code-mode variant, consumer overrides.
|
|
199
|
-
const effectiveToolDescriptions =
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
...descriptionsWithoutReadme,
|
|
205
|
-
...(executeWixApiRequested ? executeCodeModeToolDescriptions : {}),
|
|
206
|
-
...toolDescriptions
|
|
207
|
-
};
|
|
197
|
+
const effectiveToolDescriptions = {
|
|
198
|
+
...descriptionsWithoutReadme,
|
|
199
|
+
...(executeWixApiRequested ? executeCodeModeToolDescriptions : {}),
|
|
200
|
+
...toolDescriptions
|
|
201
|
+
};
|
|
208
202
|
addApiCallTool(server, authStrategy, apiTools, disableTools, enableTools, effectiveToolDescriptions, toolHints, maxResponseSize);
|
|
209
203
|
const requestedTools = new Set([
|
|
210
204
|
...(apiTools ?? []),
|