@wix/mcp 1.0.23 → 1.0.24
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 +714 -252
- package/build/bin-standalone.js.map +4 -4
- package/build/cjs/index.cjs +1137 -362
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/api-call/index.d.ts +7 -1
- package/build/dts/api-call/index.d.ts.map +1 -1
- package/build/dts/api-call/index.js +110 -42
- package/build/dts/api-call/index.js.map +1 -1
- package/build/dts/api-call/upload-image-tool.d.ts +8 -0
- package/build/dts/api-call/upload-image-tool.d.ts.map +1 -0
- package/build/dts/api-call/upload-image-tool.js +150 -0
- package/build/dts/api-call/upload-image-tool.js.map +1 -0
- package/build/dts/api-call/validation.d.ts +1 -0
- package/build/dts/api-call/validation.d.ts.map +1 -1
- package/build/dts/api-call/validation.js +7 -7
- package/build/dts/api-call/validation.js.map +1 -1
- package/build/dts/cli-tools/cli.d.ts.map +1 -1
- package/build/dts/cli-tools/cli.js +6 -4
- package/build/dts/cli-tools/cli.js.map +1 -1
- package/build/dts/config/default-config.d.ts +41 -0
- package/build/dts/config/default-config.d.ts.map +1 -0
- package/build/dts/config/default-config.js +169 -0
- package/build/dts/config/default-config.js.map +1 -0
- package/build/dts/docs/docs.d.ts +12 -2
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +27 -101
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/docs/fetch-article.d.ts +1 -1
- package/build/dts/docs/fetch-article.d.ts.map +1 -1
- package/build/dts/docs/fetch-article.js +39 -1
- package/build/dts/docs/fetch-article.js.map +1 -1
- package/build/dts/docs/get-to-know.d.ts +9 -4
- package/build/dts/docs/get-to-know.d.ts.map +1 -1
- package/build/dts/docs/get-to-know.js +76 -81
- package/build/dts/docs/get-to-know.js.map +1 -1
- package/build/dts/docs/semanticSearch.d.ts.map +1 -1
- package/build/dts/docs/semanticSearch.js +4 -1
- package/build/dts/docs/semanticSearch.js.map +1 -1
- package/build/dts/docs/semanticSearch.test.js +5 -14
- package/build/dts/docs/semanticSearch.test.js.map +1 -1
- package/build/dts/index.d.ts +4 -3
- package/build/dts/index.d.ts.map +1 -1
- package/build/dts/index.js +4 -2
- package/build/dts/index.js.map +1 -1
- package/build/dts/infra/logger.d.ts +1 -0
- package/build/dts/infra/logger.d.ts.map +1 -1
- package/build/dts/infra/logger.js +4 -0
- package/build/dts/infra/logger.js.map +1 -1
- package/build/dts/infra/widget-payload.d.ts +11 -0
- package/build/dts/infra/widget-payload.d.ts.map +1 -0
- package/build/dts/infra/widget-payload.js +2 -0
- package/build/dts/infra/widget-payload.js.map +1 -0
- package/build/dts/site-widget-tools/constants.d.ts +4 -0
- package/build/dts/site-widget-tools/constants.d.ts.map +1 -0
- package/build/dts/site-widget-tools/constants.js +6 -0
- package/build/dts/site-widget-tools/constants.js.map +1 -0
- package/build/dts/site-widget-tools/edit-site-tool/index.d.ts +4 -0
- package/build/dts/site-widget-tools/edit-site-tool/index.d.ts.map +1 -0
- package/build/dts/site-widget-tools/edit-site-tool/index.js +171 -0
- package/build/dts/site-widget-tools/edit-site-tool/index.js.map +1 -0
- package/build/dts/site-widget-tools/index.d.ts +4 -0
- package/build/dts/site-widget-tools/index.d.ts.map +1 -0
- package/build/dts/site-widget-tools/index.js +4 -0
- package/build/dts/site-widget-tools/index.js.map +1 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts +4 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.d.ts.map +1 -0
- package/build/dts/{pull-site-creation-job-tool → site-widget-tools/pull-site-creation-job-tool}/index.js +60 -27
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/index.js.map +1 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/types.d.ts +52 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/types.d.ts.map +1 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/types.js +2 -0
- package/build/dts/site-widget-tools/pull-site-creation-job-tool/types.js.map +1 -0
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts +4 -0
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -0
- package/build/dts/{site-builder-tool → site-widget-tools/site-builder-tool}/index.js +13 -16
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -0
- package/build/dts/support/index.d.ts.map +1 -1
- package/build/dts/support/index.js +10 -16
- package/build/dts/support/index.js.map +1 -1
- package/build/dts/wix-mcp-server.d.ts +2 -0
- package/build/dts/wix-mcp-server.d.ts.map +1 -1
- package/build/dts/wix-mcp-server.js +8 -0
- package/build/dts/wix-mcp-server.js.map +1 -1
- package/build/esm/index.js +1129 -362
- package/build/esm/index.js.map +4 -4
- package/package.json +28 -25
- package/build/dts/pull-site-creation-job-tool/constants.d.ts +0 -3
- package/build/dts/pull-site-creation-job-tool/constants.d.ts.map +0 -1
- package/build/dts/pull-site-creation-job-tool/constants.js +0 -3
- package/build/dts/pull-site-creation-job-tool/constants.js.map +0 -1
- package/build/dts/pull-site-creation-job-tool/index.d.ts +0 -21
- package/build/dts/pull-site-creation-job-tool/index.d.ts.map +0 -1
- package/build/dts/pull-site-creation-job-tool/index.js.map +0 -1
- package/build/dts/site-builder-tool/constants.d.ts +0 -7
- package/build/dts/site-builder-tool/constants.d.ts.map +0 -1
- package/build/dts/site-builder-tool/constants.js +0 -7
- package/build/dts/site-builder-tool/constants.js.map +0 -1
- package/build/dts/site-builder-tool/index.d.ts +0 -4
- package/build/dts/site-builder-tool/index.d.ts.map +0 -1
- package/build/dts/site-builder-tool/index.js.map +0 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createHttpClient } from '@wix/http-client';
|
|
3
|
+
import { getWidgetHtml } from '../../widget-manifest.js';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import { EDIT_SITE_TOOL_NAME } from '../constants.js';
|
|
6
|
+
const httpClient = createHttpClient();
|
|
7
|
+
const EDIT_SITE_WIDGET_URI = 'ui://widget/edit-site.html';
|
|
8
|
+
export function addEditSiteWidgetTool(server, authStrategy) {
|
|
9
|
+
const { getAccountAuthHeaders } = authStrategy;
|
|
10
|
+
const toolMeta = (widgetPayload) => {
|
|
11
|
+
return {
|
|
12
|
+
'openai/toolInvocation/invoking': 'Editing your website...',
|
|
13
|
+
'openai/toolInvocation/invoked': 'Website editing in progress...',
|
|
14
|
+
'openai/outputTemplate': EDIT_SITE_WIDGET_URI,
|
|
15
|
+
'openai/widgetAccessible': true,
|
|
16
|
+
'openai/resultCanProduceWidget': true,
|
|
17
|
+
'openai/widgetCSP': {
|
|
18
|
+
connect_domains: [
|
|
19
|
+
'https://*.wix.com',
|
|
20
|
+
'https://*.wixsite.com',
|
|
21
|
+
'https://static.parastorage.com',
|
|
22
|
+
'https://cdn.openai.com'
|
|
23
|
+
],
|
|
24
|
+
resource_domains: [
|
|
25
|
+
'https://*.wix.com',
|
|
26
|
+
'https://*.wixsite.com',
|
|
27
|
+
'https://static.parastorage.com',
|
|
28
|
+
'https://cdn.openai.com'
|
|
29
|
+
],
|
|
30
|
+
frame_domains: ['https://*.wix.com', 'https://*.wixsite.com'],
|
|
31
|
+
redirect_domains: ['https://*.wix.com', 'https://*.wixsite.com']
|
|
32
|
+
},
|
|
33
|
+
'openai/widgetDescription': "Displays a live progress showing your editing progress, including site editing status and a link to the editor. When it's ready, it will show a live preview of the website.",
|
|
34
|
+
...(widgetPayload ? { widgetPayload } : {})
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
// Add edit site widget resource
|
|
38
|
+
server.registerResource(`${EDIT_SITE_TOOL_NAME}_RESOURCE`, EDIT_SITE_WIDGET_URI, {}, async (uri) => {
|
|
39
|
+
return {
|
|
40
|
+
contents: [
|
|
41
|
+
{
|
|
42
|
+
uri: uri.href,
|
|
43
|
+
_meta: toolMeta(),
|
|
44
|
+
mimeType: 'text/html+skybridge',
|
|
45
|
+
text: getWidgetHtml({ widgetId: 'editWixSite' })
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
// Add edit site tool that communicates with the widget
|
|
51
|
+
server.registerTool(EDIT_SITE_TOOL_NAME, {
|
|
52
|
+
title: 'Edit Site',
|
|
53
|
+
description: `A tool that edits a Wix site. Use this ONLY when the user explicitly asks to edit/modify/update a site/website/application visually or by adding/removing/editing components inside the page. The widget resource is available at ${EDIT_SITE_WIDGET_URI}`,
|
|
54
|
+
inputSchema: {
|
|
55
|
+
jobId: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('The job ID of the site editing. If not provided, a new job will be created.'),
|
|
59
|
+
siteId: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe('The site ID to edit. If not provided, the user will be asked to provide a site ID.'),
|
|
62
|
+
editPrompt: z
|
|
63
|
+
.string()
|
|
64
|
+
.describe('The prompt to edit the site. If not provided, the user will be asked to provide a prompt.')
|
|
65
|
+
},
|
|
66
|
+
_meta: toolMeta(),
|
|
67
|
+
annotations: {
|
|
68
|
+
readOnlyHint: true,
|
|
69
|
+
destructiveHint: false,
|
|
70
|
+
openWorldHint: false
|
|
71
|
+
}
|
|
72
|
+
}, async (args, { setToolBiParams }) => {
|
|
73
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] 🚀 Start Editing Your Site tool invoked!`);
|
|
74
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] Site ID:`, args.siteId);
|
|
75
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] Edit prompt:`, args.editPrompt);
|
|
76
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] JobId (if provided):`, args.jobId);
|
|
77
|
+
const accountHeaders = await getAccountAuthHeaders();
|
|
78
|
+
let jobId;
|
|
79
|
+
// Priority: 1. Explicit jobId from args, 2. Last saved jobId, 3. Create new job
|
|
80
|
+
if (args.jobId) {
|
|
81
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] Using provided jobId:`, args.jobId);
|
|
82
|
+
jobId = args.jobId;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Create new job
|
|
86
|
+
const { success, jobId: newJobId, message } = await editHarmonySite({
|
|
87
|
+
userPrompt: args.editPrompt,
|
|
88
|
+
siteId: args.siteId,
|
|
89
|
+
accountHeaders
|
|
90
|
+
});
|
|
91
|
+
setToolBiParams({ jobId: newJobId });
|
|
92
|
+
if (!success || !newJobId) {
|
|
93
|
+
return {
|
|
94
|
+
isError: true,
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: message
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
structuredContent: {
|
|
102
|
+
success: false,
|
|
103
|
+
status: message,
|
|
104
|
+
jobId: null
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
jobId = newJobId;
|
|
109
|
+
console.log(`[${EDIT_SITE_TOOL_NAME}] Created new job:`, jobId);
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: 'Respond only with a confirmation that the website editing has started and that progress is available in the widget. No other content is allowed. DO NOT mention jobId.'
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
structuredContent: {
|
|
119
|
+
success: true,
|
|
120
|
+
status: 'Respond only with a confirmation that the website editing has started and that progress is available in the widget. No other content is allowed. DO NOT mention jobId.',
|
|
121
|
+
jobId // Return jobId so model can use it in future calls
|
|
122
|
+
},
|
|
123
|
+
_meta: toolMeta({ jobId })
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
async function editHarmonySite({ userPrompt, siteId, accountHeaders }) {
|
|
128
|
+
const editorUrl = getEditorUrl(siteId);
|
|
129
|
+
const editSiteRequest = {
|
|
130
|
+
userPrompt,
|
|
131
|
+
siteId,
|
|
132
|
+
editorUrl,
|
|
133
|
+
withScreenshots: true,
|
|
134
|
+
actionContext: 'wix-mcp'
|
|
135
|
+
};
|
|
136
|
+
console.log('[editHarmonySite] request', {
|
|
137
|
+
editSiteRequest
|
|
138
|
+
});
|
|
139
|
+
try {
|
|
140
|
+
const response = await httpClient.post('https://manage.wix.com/_api/harmony-site-builder/edit-harmony-site', editSiteRequest, { headers: accountHeaders });
|
|
141
|
+
console.log('[editHarmonySite]: response:', response);
|
|
142
|
+
if (response.data.success) {
|
|
143
|
+
return {
|
|
144
|
+
success: true,
|
|
145
|
+
message: 'Successfully started editing your website',
|
|
146
|
+
jobId: response.data.jobId
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
message: response.data.message ||
|
|
153
|
+
'Failed to start editing your website using Harmony',
|
|
154
|
+
jobId: ''
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
console.error('[editHarmonySite]: error:', error);
|
|
160
|
+
return {
|
|
161
|
+
success: false,
|
|
162
|
+
message: `Failed to start editing your website using Harmony: ${error}`,
|
|
163
|
+
jobId: ''
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function getEditorUrl(siteId) {
|
|
168
|
+
const fakeInstanceId = uuidv4();
|
|
169
|
+
return `https://editor.wix.com/edit/od/${fakeInstanceId}?metaSiteId=${siteId}`;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/site-widget-tools/edit-site-tool/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,C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AE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/site-widget-tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpAuthenticationStrategy } from '../../auth/index.js';
|
|
2
|
+
import { WixMcpServer } from '../../wix-mcp-server.js';
|
|
3
|
+
export declare function addPullSiteJobTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy): void;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/site-widget-tools/pull-site-creation-job-tool/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQvD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,yBAAyB,QAmKxC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { createHttpClient } from '@wix/http-client';
|
|
2
2
|
import z from 'zod';
|
|
3
|
-
import { PULL_SITE_CREATION_JOB_TOOL_NAME } from './constants.js';
|
|
4
|
-
import { logger } from '../infra/logger.js';
|
|
5
3
|
import { siteCreatedUsingWixMcpSrc39Evid1608 } from '@wix/bi-logger-wix-code-data/v2';
|
|
4
|
+
import { PULL_SITE_JOB_TOOL_NAME } from '../constants.js';
|
|
6
5
|
const httpClient = createHttpClient();
|
|
7
|
-
export function
|
|
6
|
+
export function addPullSiteJobTool(server, authStrategy) {
|
|
8
7
|
const { getAccountAuthHeaders, getSiteAuthHeaders } = authStrategy;
|
|
9
|
-
server.registerTool(
|
|
10
|
-
title: 'Pull Site
|
|
11
|
-
description: 'Pull the status of a site
|
|
8
|
+
server.registerTool(PULL_SITE_JOB_TOOL_NAME, {
|
|
9
|
+
title: 'Pull Site Job',
|
|
10
|
+
description: 'Pull the status of a site job',
|
|
12
11
|
inputSchema: {
|
|
13
12
|
jobId: z.string().describe('The job ID to pull')
|
|
14
13
|
},
|
|
15
14
|
annotations: {
|
|
16
|
-
readOnlyHint: true
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
openWorldHint: false
|
|
17
18
|
},
|
|
18
19
|
_meta: {
|
|
19
20
|
'openai/toolInvocation/invoking': 'Fetching codegen job',
|
|
@@ -23,7 +24,7 @@ export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
|
23
24
|
}, async (args, { biLogger, setToolBiParams }) => {
|
|
24
25
|
const { jobId } = args;
|
|
25
26
|
if (!jobId) {
|
|
26
|
-
|
|
27
|
+
console.log(`[pullSiteJob] Missing jobId, returning empty jobs`);
|
|
27
28
|
return {
|
|
28
29
|
content: [{ type: 'text', text: 'No job ID provided' }],
|
|
29
30
|
structuredContent: { job: null }
|
|
@@ -33,7 +34,7 @@ export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
|
33
34
|
try {
|
|
34
35
|
const headers = await getAccountAuthHeaders();
|
|
35
36
|
const response = await httpClient.post('https://manage.wix.com/_api/harmony-site-builder/pull-job', { jobId }, { headers });
|
|
36
|
-
|
|
37
|
+
console.log('[pullSiteJob] Response:', response.data);
|
|
37
38
|
if (!response.data.success) {
|
|
38
39
|
return {
|
|
39
40
|
isError: true,
|
|
@@ -45,27 +46,39 @@ export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
const job = response.data.job;
|
|
49
|
+
const isEditJob = job.type === 'EDIT_SITE';
|
|
48
50
|
const pullJobMessage = job.status === 'COMPLETED'
|
|
49
51
|
? `Job completed. previewUrl: ${job.data?.previewUrl} editorUrl: ${job.data?.editorUrl} siteId: ${job.data?.siteId}`
|
|
50
52
|
: 'Job in progress';
|
|
51
53
|
if (job.status === 'COMPLETED' && job.data?.siteId) {
|
|
54
|
+
console.log(`[pullSiteJob] job is completed ${jobId}`);
|
|
52
55
|
try {
|
|
53
56
|
const siteHeaders = await getSiteAuthHeaders(job.data?.siteId);
|
|
54
57
|
let publishedSiteUrl;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
siteId: job.data?.siteId,
|
|
58
|
-
jobId
|
|
59
|
-
});
|
|
60
|
-
if (!publishedSiteUrl) {
|
|
58
|
+
if (!job.isPublished) {
|
|
59
|
+
console.log(`[pullSiteJob] site is not published ${jobId}, publishing...`, { job });
|
|
61
60
|
// Avoid duplicate publishing and reporting, by checking if the site not already published
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
if (isEditJob) {
|
|
62
|
+
// TODO: Add site updated event
|
|
63
|
+
// biLogger.report(
|
|
64
|
+
// siteUpdatedUsingWixMcpSrc39Evid1608({
|
|
65
|
+
// jobId,
|
|
66
|
+
// msid: job.data?.siteId,
|
|
67
|
+
// builderType: 'Harmony',
|
|
68
|
+
// duration: job.durationMs,
|
|
69
|
+
// sitePrompt: job.userPrompt
|
|
70
|
+
// })
|
|
71
|
+
// );
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
biLogger.report(siteCreatedUsingWixMcpSrc39Evid1608({
|
|
75
|
+
jobId,
|
|
76
|
+
msid: job.data?.siteId,
|
|
77
|
+
builderType: 'Harmony',
|
|
78
|
+
duration: job.durationInMinutes,
|
|
79
|
+
sitePrompt: job.userPrompt
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
69
82
|
publishedSiteUrl = await publishSite({
|
|
70
83
|
siteLevelToken: siteHeaders.Authorization,
|
|
71
84
|
siteId: job.data?.siteId,
|
|
@@ -74,10 +87,24 @@ export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
|
74
87
|
}
|
|
75
88
|
if (publishedSiteUrl) {
|
|
76
89
|
job.data.previewUrl = publishedSiteUrl;
|
|
90
|
+
try {
|
|
91
|
+
await httpClient.post('https://manage.wix.com/_api/harmony-site-builder/update-job', {
|
|
92
|
+
jobId,
|
|
93
|
+
job: {
|
|
94
|
+
isPublished: true,
|
|
95
|
+
data: {
|
|
96
|
+
previewUrl: publishedSiteUrl
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, { headers });
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(`[pullSiteJob] Failed to update job published status ${jobId}`, { jobId, error: error.message });
|
|
103
|
+
}
|
|
77
104
|
}
|
|
78
105
|
}
|
|
79
106
|
catch (error) {
|
|
80
|
-
|
|
107
|
+
console.error(`[pullSiteJob] Failed to publish site for job ${jobId}`, { jobId, error: error.message });
|
|
81
108
|
}
|
|
82
109
|
}
|
|
83
110
|
return {
|
|
@@ -92,7 +119,10 @@ export function addPullSiteCreationJobTool(server, authStrategy) {
|
|
|
92
119
|
}
|
|
93
120
|
catch (error) {
|
|
94
121
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
95
|
-
|
|
122
|
+
console.error(`[pullSiteJob] Error pulling job for job ${jobId}`, {
|
|
123
|
+
jobId,
|
|
124
|
+
error: errorMessage
|
|
125
|
+
});
|
|
96
126
|
return {
|
|
97
127
|
isError: true,
|
|
98
128
|
content: [{ type: 'text', text: 'Failed to pull job' }],
|
|
@@ -109,7 +139,10 @@ async function publishSite({ siteLevelToken, siteId, jobId }) {
|
|
|
109
139
|
}
|
|
110
140
|
});
|
|
111
141
|
if (response.status !== 200) {
|
|
112
|
-
|
|
142
|
+
console.error(`[publishSite] Failed to publish site for job ${jobId}`, {
|
|
143
|
+
jobId,
|
|
144
|
+
error: response.statusText
|
|
145
|
+
});
|
|
113
146
|
return;
|
|
114
147
|
}
|
|
115
148
|
const publishedSiteUrl = await getPublishedSiteUrl({
|
|
@@ -118,7 +151,7 @@ async function publishSite({ siteLevelToken, siteId, jobId }) {
|
|
|
118
151
|
jobId
|
|
119
152
|
});
|
|
120
153
|
if (!publishedSiteUrl) {
|
|
121
|
-
|
|
154
|
+
console.error(`[publishSite] Failed to get published site url for job ${jobId}`);
|
|
122
155
|
return;
|
|
123
156
|
}
|
|
124
157
|
return publishedSiteUrl;
|
|
@@ -137,7 +170,7 @@ async function getPublishedSiteUrl({ siteLevelToken, siteId, jobId }) {
|
|
|
137
170
|
}
|
|
138
171
|
}
|
|
139
172
|
catch (error) {
|
|
140
|
-
|
|
173
|
+
console.error(`[pullSiteJob] Failed to get published site urls for job ${jobId}`, { jobId, error: error.message });
|
|
141
174
|
}
|
|
142
175
|
return;
|
|
143
176
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/site-widget-tools/pull-site-creation-job-tool/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC,MAAM,UAAU,kBAAkB,CAChC,MAAoB,EACpB,YAAuC;IAEvC,MAAM,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC;IAEnE,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,+BAA+B;QAC5C,WAAW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QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAElC,4DAA4D,EAAE;YAC/D,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,cAAc,EAAE;gBACzC,aAAa,EAAE,MAAM;aACtB;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YACxB,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnE,OAAO,UAAU,EAAE,GAAG,IAAI,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CACX,2DAA2D,KAAK,EAAE,EAClE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAChC,CAAC;IACJ,CAAC;IACD,OAAO;AACT,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface GenerateHarmonySiteRequest {
|
|
2
|
+
userPrompt: string;
|
|
3
|
+
jobId?: string;
|
|
4
|
+
withScreenshots?: boolean;
|
|
5
|
+
actionContext?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GenerateHarmonySiteResponse {
|
|
8
|
+
success: boolean;
|
|
9
|
+
message?: string;
|
|
10
|
+
jobId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EditHarmonySiteRequest {
|
|
13
|
+
userPrompt: string;
|
|
14
|
+
jobId?: string;
|
|
15
|
+
siteId: string;
|
|
16
|
+
editorUrl: string;
|
|
17
|
+
withScreenshots?: boolean;
|
|
18
|
+
actionContext?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EditHarmonySiteResponse {
|
|
21
|
+
success: boolean;
|
|
22
|
+
message?: string;
|
|
23
|
+
jobId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PullJobResponse {
|
|
26
|
+
success: boolean;
|
|
27
|
+
message?: string;
|
|
28
|
+
job: Job;
|
|
29
|
+
}
|
|
30
|
+
export interface UpdateJobResponse {
|
|
31
|
+
success: boolean;
|
|
32
|
+
message?: string;
|
|
33
|
+
job?: Job;
|
|
34
|
+
}
|
|
35
|
+
export interface Job {
|
|
36
|
+
id: string;
|
|
37
|
+
status: 'STARTED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
38
|
+
errorMessage?: string;
|
|
39
|
+
isPublished?: boolean;
|
|
40
|
+
createdAt?: Date;
|
|
41
|
+
updatedAt?: Date;
|
|
42
|
+
durationInMinutes?: number;
|
|
43
|
+
userPrompt: string;
|
|
44
|
+
progress?: string;
|
|
45
|
+
data?: {
|
|
46
|
+
editorUrl?: string;
|
|
47
|
+
siteId?: string;
|
|
48
|
+
previewUrl?: string;
|
|
49
|
+
};
|
|
50
|
+
type?: 'GENERATE_SITE' | 'EDIT_SITE';
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/site-widget-tools/pull-site-creation-job-tool/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IAEzC,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,sBAAsB;IAErC,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAElB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;CACV;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/site-widget-tools/pull-site-creation-job-tool/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpAuthenticationStrategy } from '../../auth/index.js';
|
|
2
|
+
import { WixMcpServer } from '../../wix-mcp-server.js';
|
|
3
|
+
export declare function addCreateSiteWidgetTool(server: WixMcpServer, authStrategy: McpAuthenticationStrategy): void;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/site-widget-tools/site-builder-tool/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAc,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAWvD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,yBAAyB,QAqJxC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createHttpClient } from '@wix/http-client';
|
|
3
|
-
import { getWidgetHtml } from '
|
|
3
|
+
import { getWidgetHtml } from '../../widget-manifest.js';
|
|
4
|
+
import { SITE_BUILDER_TOOL_NAME } from '../constants.js';
|
|
4
5
|
const httpClient = createHttpClient();
|
|
5
6
|
const CREATE_SITE_WIDGET_URI = 'ui://widget/wix-site-builder.html';
|
|
6
|
-
const WIDGET_NAME = 'WixSiteBuilder';
|
|
7
7
|
export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
8
8
|
const { getAccountAuthHeaders } = authStrategy;
|
|
9
9
|
const toolMeta = (widgetPayload) => {
|
|
@@ -29,13 +29,12 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
29
29
|
frame_domains: ['https://*.wix.com', 'https://*.wixsite.com'],
|
|
30
30
|
redirect_domains: ['https://*.wix.com', 'https://*.wixsite.com']
|
|
31
31
|
},
|
|
32
|
-
'openai/widgetDomain': 'wix',
|
|
33
32
|
'openai/widgetDescription': "Displays a live progress showing your website being built, including site generation status and a link to the editor. When it's ready, it will show a live preview of the website.",
|
|
34
33
|
...(widgetPayload ? { widgetPayload } : {})
|
|
35
34
|
};
|
|
36
35
|
};
|
|
37
36
|
// Add site builder widget resource
|
|
38
|
-
server.registerResource(`${
|
|
37
|
+
server.registerResource(`${SITE_BUILDER_TOOL_NAME}_RESOURCE`, CREATE_SITE_WIDGET_URI, {}, async (uri) => {
|
|
39
38
|
return {
|
|
40
39
|
contents: [
|
|
41
40
|
{
|
|
@@ -48,9 +47,10 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
48
47
|
};
|
|
49
48
|
});
|
|
50
49
|
// Add site builder tool that communicates with the widget
|
|
51
|
-
server.registerTool(
|
|
50
|
+
server.registerTool(SITE_BUILDER_TOOL_NAME, {
|
|
52
51
|
title: 'Wix Site Builder',
|
|
53
|
-
description: `A tool that builds a site using Wix. Use this ONLY when the user explicitly asks to build/create/generate a site/website/application. The widget resource is available at ${CREATE_SITE_WIDGET_URI}
|
|
52
|
+
description: `A tool that builds a site using Wix. Use this ONLY when the user explicitly asks to build/create/generate a site/website/application. The widget resource is available at ${CREATE_SITE_WIDGET_URI}.
|
|
53
|
+
Keep the prompt short and concise, single page site if possible, do not add pages that are not explicitly requested. `,
|
|
54
54
|
inputSchema: {
|
|
55
55
|
jobId: z
|
|
56
56
|
.string()
|
|
@@ -58,7 +58,7 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
58
58
|
.describe('The job ID of the site build. If not provided, a new job will be created.'),
|
|
59
59
|
sitePrompt: z
|
|
60
60
|
.string()
|
|
61
|
-
.describe('The prompt to build the site. If not provided, the user will be asked to provide a prompt.')
|
|
61
|
+
.describe('The prompt to build the site. Keep the prompt short and concise, single page site if possible, do not add pages that are not explicitly requested. If not provided, the user will be asked to provide a prompt.')
|
|
62
62
|
},
|
|
63
63
|
_meta: toolMeta(),
|
|
64
64
|
annotations: {
|
|
@@ -67,14 +67,12 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
67
67
|
openWorldHint: false
|
|
68
68
|
}
|
|
69
69
|
}, async (args, { setToolBiParams }) => {
|
|
70
|
-
console.log(`[${
|
|
71
|
-
console.log(`[${WIDGET_NAME}] Site prompt:`, args.sitePrompt);
|
|
72
|
-
console.log(`[${WIDGET_NAME}] JobId (if provided):`, args.jobId);
|
|
70
|
+
console.log(`[${SITE_BUILDER_TOOL_NAME}] 🚀 Start Building Your Site tool invoked!`, { prompt: args.sitePrompt, jobId: args.jobId });
|
|
73
71
|
const accountHeaders = await getAccountAuthHeaders();
|
|
74
72
|
let jobId;
|
|
75
73
|
// Priority: 1. Explicit jobId from args, 2. Last saved jobId, 3. Create new job
|
|
76
74
|
if (args.jobId) {
|
|
77
|
-
console.log(`[${
|
|
75
|
+
console.log(`[${SITE_BUILDER_TOOL_NAME}] Using provided jobId:`, args.jobId);
|
|
78
76
|
jobId = args.jobId;
|
|
79
77
|
}
|
|
80
78
|
else {
|
|
@@ -101,7 +99,7 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
101
99
|
};
|
|
102
100
|
}
|
|
103
101
|
jobId = newJobId;
|
|
104
|
-
console.log(`[${
|
|
102
|
+
console.log(`[${SITE_BUILDER_TOOL_NAME}] Created new job:`, jobId);
|
|
105
103
|
}
|
|
106
104
|
return {
|
|
107
105
|
content: [
|
|
@@ -115,16 +113,15 @@ export function addCreateSiteWidgetTool(server, authStrategy) {
|
|
|
115
113
|
status: 'Respond only with a confirmation that the website build has started and that progress is available in the widget. No other content is allowed. DO NOT mention jobId.',
|
|
116
114
|
jobId // Return jobId so model can use it in future calls
|
|
117
115
|
},
|
|
118
|
-
_meta: toolMeta({ jobId })
|
|
116
|
+
_meta: toolMeta({ jobId, extras: server.getWidgetExtras() })
|
|
119
117
|
};
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
120
|
async function buildHarmonySite({ userPrompt, accountHeaders }) {
|
|
123
121
|
const buildSiteRequest = {
|
|
124
122
|
userPrompt,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
withScreenshots: true
|
|
123
|
+
withScreenshots: true,
|
|
124
|
+
actionContext: 'wix-mcp'
|
|
128
125
|
};
|
|
129
126
|
console.log('[buildHarmonySite] request', {
|
|
130
127
|
buildSiteRequest
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/site-widget-tools/site-builder-tool/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC,MAAM,sBAAsB,GAAG,mCAAmC,CAAC;AAEnE,MAAM,UAAU,uBAAuB,CACrC,MAAoB,EACpB,YAAuC;IAEvC,MAAM,EAAE,qBAAqB,EAAE,GAAG,YAAY,CAAC;IAE/C,MAAM,QAAQ,GAAG,CAAC,aAAgD,EAAE,EAAE;QACpE,OAAO;YACL,gCAAgC,EAAE,0BAA0B;YAC5D,+BAA+B,EAAE,iCAAiC;YAClE,uBAAuB,EAAE,sBAAsB;YAC/C,yBAAyB,EAAE,IAAI;YAC/B,+BAA+B,EAAE,IAAI;YACrC,kBAAkB,EAAE;gBAClB,eAAe,EAAE;oBACf,mBAAmB;oBACnB,uBAAuB;oBACvB,gCAAgC;oBAChC,wBAAwB;iBACzB;gBACD,gBAAgB,EAAE;oBAChB,mBAAmB;oBACnB,uBAAuB;oBACvB,gCAAgC;oBAChC,wBAAwB;iBACzB;gBACD,aAAa,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;gBAC7D,gBAAgB,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;aACjE;YACD,0BAA0B,EACxB,oLAAoL;YACtL,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE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AAM,gBAAgB,GAAG;QACvB,UAAU;QACV,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,SAAS;KACzB,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE;QACxC,gBAAgB;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAKpC,wEAAwE,EACxE,gBAAgB,EAChB,EAAE,OAAO,EAAE,cAAc,EAAE,CAC5B,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,4CAA4C;gBACrD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;aAC3B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EACL,QAAQ,CAAC,IAAI,CAAC,OAAO;oBACrB,qDAAqD;gBACvD,KAAK,EAAE,EAAE;aACV,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,wDAAwD,KAAK,EAAE;YACxE,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,YAAY,GAAE,MAAM,EAAO,EAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAoC1C"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { defaultToolDescriptions } from '../config/default-config.js';
|
|
2
3
|
export function addSupportTool(server, disableTools = [], toolDescriptions) {
|
|
3
4
|
if (disableTools.includes('SupportAndFeedback')) {
|
|
4
5
|
return;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'for example they used the tools provided, and they reflected satisfaction or dissatisfaction with the tools.',
|
|
9
|
-
'Also, if you encounter too many errors tyring to call the Wix API, you can also suggest the user to provide feedback to Wix using this tool.',
|
|
10
|
-
'**IMPORTANT NOTE**',
|
|
11
|
-
'This tool is not sending the message, but formats it in order to another tool to actually send it'
|
|
12
|
-
].join('\n');
|
|
13
|
-
server.tool('SupportAndFeedback', toolDescriptions?.['SupportAndFeedback'] ?? defaultSupportDesc, {
|
|
7
|
+
server.tool('SupportAndFeedback', toolDescriptions?.['SupportAndFeedback'] ??
|
|
8
|
+
defaultToolDescriptions.SupportAndFeedback, {
|
|
14
9
|
requestId: z
|
|
15
10
|
.string()
|
|
16
11
|
.optional()
|
|
@@ -21,14 +16,13 @@ export function addSupportTool(server, disableTools = [], toolDescriptions) {
|
|
|
21
16
|
content: [
|
|
22
17
|
{
|
|
23
18
|
type: 'text',
|
|
24
|
-
text:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'Once you have the details, you can use the `ManageWixSite` (if site id is in context) or `CallWixSiteAPI` (if site id is not in context) tool to call the API and send the feedback to Wix.'
|
|
19
|
+
text: [
|
|
20
|
+
`${message} ${requestId ? `request id: ${requestId}` : ''}`,
|
|
21
|
+
'You should present the user with the formatted message above and ask if they would like to send it to Wix. ' +
|
|
22
|
+
'If the user confirms, you can get the details about send feedback API from the article `https://dev.wix.com/docs/kb-only/MCP_REST_RECIPES_KB_ID/TRAIN_send_mcp_feedback_to_wix_from_user`. ' +
|
|
23
|
+
'You can use the `ReadFullDocsArticle` tool to fetch the article and get the details about the API call. ' +
|
|
24
|
+
'Once you have the details, you can use the `ManageWixSite` (if site id is in context) or `CallWixSiteAPI` (if site id is not in context) tool to call the API and send the feedback to Wix.'
|
|
25
|
+
].join('\n\n')
|
|
32
26
|
}
|
|
33
27
|
]
|
|
34
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,UAAU,cAAc,CAC5B,MAAoB,EACpB,eAAyB,EAAE,EAC3B,gBAAyC;IAEzC,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,gBAAgB,EAAE,CAAC,oBAAoB,CAAC;QACtC,uBAAuB,CAAC,kBAAkB,EAC5C;QACE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,oEAAoE,CACrE;QACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;KAC3D,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,EACpE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QAC/B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,GAAG,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC3D,6GAA6G;4BAC3G,6LAA6L;4BAC7L,0GAA0G;4BAC1G,6LAA6L;qBAChM,CAAC,IAAI,CAAC,MAAM,CAAC;iBACf;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|