@wplaunchify/ml-mcp-server 1.0.0
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/LICENSE +22 -0
- package/README.md +220 -0
- package/build/cli.d.ts +2 -0
- package/build/cli.js +52 -0
- package/build/server.d.ts +2 -0
- package/build/server.js +97 -0
- package/build/tools/comments.d.ts +212 -0
- package/build/tools/comments.js +181 -0
- package/build/tools/fluent-affiliate.d.ts +2 -0
- package/build/tools/fluent-affiliate.js +3 -0
- package/build/tools/fluent-cart.d.ts +706 -0
- package/build/tools/fluent-cart.js +642 -0
- package/build/tools/fluent-community-BACKUP.d.ts +364 -0
- package/build/tools/fluent-community-BACKUP.js +883 -0
- package/build/tools/fluent-community-MINIMAL.d.ts +69 -0
- package/build/tools/fluent-community-MINIMAL.js +92 -0
- package/build/tools/fluent-community-design.d.ts +3 -0
- package/build/tools/fluent-community-design.js +150 -0
- package/build/tools/fluent-community-layout.d.ts +119 -0
- package/build/tools/fluent-community-layout.js +88 -0
- package/build/tools/fluent-community.d.ts +364 -0
- package/build/tools/fluent-community.js +528 -0
- package/build/tools/fluent-crm.d.ts +3 -0
- package/build/tools/fluent-crm.js +392 -0
- package/build/tools/index.d.ts +2205 -0
- package/build/tools/index.js +54 -0
- package/build/tools/media.d.ts +135 -0
- package/build/tools/media.js +168 -0
- package/build/tools/ml-canvas.d.ts +91 -0
- package/build/tools/ml-canvas.js +109 -0
- package/build/tools/ml-image-editor.d.ts +230 -0
- package/build/tools/ml-image-editor.js +270 -0
- package/build/tools/ml-media-hub.d.ts +575 -0
- package/build/tools/ml-media-hub.js +714 -0
- package/build/tools/plugin-repository.d.ts +62 -0
- package/build/tools/plugin-repository.js +149 -0
- package/build/tools/plugins.d.ts +129 -0
- package/build/tools/plugins.js +148 -0
- package/build/tools/unified-content.d.ts +313 -0
- package/build/tools/unified-content.js +615 -0
- package/build/tools/unified-taxonomies.d.ts +229 -0
- package/build/tools/unified-taxonomies.js +479 -0
- package/build/tools/users.d.ts +227 -0
- package/build/tools/users.js +182 -0
- package/build/types/wordpress-types.d.ts +151 -0
- package/build/types/wordpress-types.js +2 -0
- package/build/wordpress.d.ts +26 -0
- package/build/wordpress.js +223 -0
- package/package.json +67 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
3
|
+
/**
|
|
4
|
+
* FluentCRM Tools - Email Marketing & CRM
|
|
5
|
+
* Uses FluentCRM's native REST API at /fluent-crm/v2/
|
|
6
|
+
* Documentation: https://fluentcrm.com/docs/rest-api/
|
|
7
|
+
*/
|
|
8
|
+
// ==================== ZOD SCHEMA DEFINITIONS ====================
|
|
9
|
+
// Contact schemas
|
|
10
|
+
const listContactsSchema = z.object({
|
|
11
|
+
page: z.number().optional(),
|
|
12
|
+
per_page: z.number().optional(),
|
|
13
|
+
search: z.string().optional(),
|
|
14
|
+
status: z.enum(['subscribed', 'unsubscribed', 'bounced', 'complained']).optional(),
|
|
15
|
+
tags: z.array(z.number()).optional(),
|
|
16
|
+
lists: z.array(z.number()).optional(),
|
|
17
|
+
});
|
|
18
|
+
const createContactSchema = z.object({
|
|
19
|
+
email: z.string().email(),
|
|
20
|
+
first_name: z.string().optional(),
|
|
21
|
+
last_name: z.string().optional(),
|
|
22
|
+
status: z.enum(['subscribed', 'unsubscribed', 'pending']).optional(),
|
|
23
|
+
tags: z.array(z.number()).optional(),
|
|
24
|
+
lists: z.array(z.number()).optional(),
|
|
25
|
+
custom_fields: z.record(z.any()).optional(),
|
|
26
|
+
});
|
|
27
|
+
// List schemas
|
|
28
|
+
const listListsSchema = z.object({
|
|
29
|
+
page: z.number().optional(),
|
|
30
|
+
per_page: z.number().optional(),
|
|
31
|
+
search: z.string().optional(),
|
|
32
|
+
});
|
|
33
|
+
const createListSchema = z.object({
|
|
34
|
+
title: z.string(),
|
|
35
|
+
slug: z.string().optional(),
|
|
36
|
+
description: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
// Tag schemas
|
|
39
|
+
const listTagsSchema = z.object({
|
|
40
|
+
page: z.number().optional(),
|
|
41
|
+
per_page: z.number().optional(),
|
|
42
|
+
search: z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
const createTagSchema = z.object({
|
|
45
|
+
title: z.string(),
|
|
46
|
+
slug: z.string().optional(),
|
|
47
|
+
description: z.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
// Campaign schemas
|
|
50
|
+
const listCampaignsSchema = z.object({
|
|
51
|
+
page: z.number().optional(),
|
|
52
|
+
per_page: z.number().optional(),
|
|
53
|
+
status: z.enum(['draft', 'scheduled', 'sent', 'archived']).optional(),
|
|
54
|
+
});
|
|
55
|
+
const createCampaignSchema = z.object({
|
|
56
|
+
title: z.string(),
|
|
57
|
+
subject: z.string(),
|
|
58
|
+
email_body: z.string(),
|
|
59
|
+
status: z.enum(['draft', 'scheduled']).optional(),
|
|
60
|
+
scheduled_at: z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
// ==================== TOOL DEFINITIONS ====================
|
|
63
|
+
export const fluentCRMTools = [
|
|
64
|
+
// Contact Management
|
|
65
|
+
{
|
|
66
|
+
name: 'fcrm_list_contacts',
|
|
67
|
+
description: 'List FluentCRM contacts with filtering and pagination',
|
|
68
|
+
inputSchema: { type: 'object', properties: listContactsSchema.shape }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'fcrm_get_contact',
|
|
72
|
+
description: 'Get a specific FluentCRM contact by ID',
|
|
73
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'fcrm_create_contact',
|
|
77
|
+
description: 'Create a new FluentCRM contact',
|
|
78
|
+
inputSchema: { type: 'object', properties: createContactSchema.shape }
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'fcrm_update_contact',
|
|
82
|
+
description: 'Update an existing FluentCRM contact',
|
|
83
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
84
|
+
id: z.number(),
|
|
85
|
+
email: z.string().email().optional(),
|
|
86
|
+
first_name: z.string().optional(),
|
|
87
|
+
last_name: z.string().optional(),
|
|
88
|
+
status: z.enum(['subscribed', 'unsubscribed', 'pending']).optional(),
|
|
89
|
+
}).shape }
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'fcrm_delete_contact',
|
|
93
|
+
description: 'Delete a FluentCRM contact',
|
|
94
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
95
|
+
},
|
|
96
|
+
// List Management
|
|
97
|
+
{
|
|
98
|
+
name: 'fcrm_list_lists',
|
|
99
|
+
description: 'List all FluentCRM contact lists',
|
|
100
|
+
inputSchema: { type: 'object', properties: listListsSchema.shape }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'fcrm_get_list',
|
|
104
|
+
description: 'Get a specific FluentCRM list by ID',
|
|
105
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'fcrm_create_list',
|
|
109
|
+
description: 'Create a new FluentCRM list',
|
|
110
|
+
inputSchema: { type: 'object', properties: createListSchema.shape }
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'fcrm_update_list',
|
|
114
|
+
description: 'Update a FluentCRM list',
|
|
115
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
116
|
+
id: z.number(),
|
|
117
|
+
title: z.string().optional(),
|
|
118
|
+
description: z.string().optional(),
|
|
119
|
+
}).shape }
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'fcrm_delete_list',
|
|
123
|
+
description: 'Delete a FluentCRM list',
|
|
124
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
125
|
+
},
|
|
126
|
+
// Tag Management
|
|
127
|
+
{
|
|
128
|
+
name: 'fcrm_list_tags',
|
|
129
|
+
description: 'List all FluentCRM tags',
|
|
130
|
+
inputSchema: { type: 'object', properties: listTagsSchema.shape }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'fcrm_get_tag',
|
|
134
|
+
description: 'Get a specific FluentCRM tag by ID',
|
|
135
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'fcrm_create_tag',
|
|
139
|
+
description: 'Create a new FluentCRM tag',
|
|
140
|
+
inputSchema: { type: 'object', properties: createTagSchema.shape }
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'fcrm_update_tag',
|
|
144
|
+
description: 'Update a FluentCRM tag',
|
|
145
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
146
|
+
id: z.number(),
|
|
147
|
+
title: z.string().optional(),
|
|
148
|
+
description: z.string().optional(),
|
|
149
|
+
}).shape }
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'fcrm_delete_tag',
|
|
153
|
+
description: 'Delete a FluentCRM tag',
|
|
154
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
155
|
+
},
|
|
156
|
+
// Campaign Management
|
|
157
|
+
{
|
|
158
|
+
name: 'fcrm_list_campaigns',
|
|
159
|
+
description: 'List all FluentCRM email campaigns',
|
|
160
|
+
inputSchema: { type: 'object', properties: listCampaignsSchema.shape }
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'fcrm_get_campaign',
|
|
164
|
+
description: 'Get a specific FluentCRM campaign by ID',
|
|
165
|
+
inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'fcrm_create_campaign',
|
|
169
|
+
description: 'Create a new FluentCRM email campaign',
|
|
170
|
+
inputSchema: { type: 'object', properties: createCampaignSchema.shape }
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'fcrm_send_campaign',
|
|
174
|
+
description: 'Send a FluentCRM campaign',
|
|
175
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
176
|
+
id: z.number(),
|
|
177
|
+
scheduled_at: z.string().optional(),
|
|
178
|
+
}).shape }
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
// ==================== TOOL HANDLERS ====================
|
|
182
|
+
export const fluentCRMHandlers = {
|
|
183
|
+
// Contact handlers
|
|
184
|
+
fcrm_list_contacts: async (args) => {
|
|
185
|
+
try {
|
|
186
|
+
const params = new URLSearchParams();
|
|
187
|
+
if (args.page)
|
|
188
|
+
params.append('page', args.page);
|
|
189
|
+
if (args.per_page)
|
|
190
|
+
params.append('per_page', args.per_page);
|
|
191
|
+
if (args.search)
|
|
192
|
+
params.append('search', args.search);
|
|
193
|
+
if (args.status)
|
|
194
|
+
params.append('status', args.status);
|
|
195
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/contacts?${params}`);
|
|
196
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
fcrm_get_contact: async (args) => {
|
|
203
|
+
try {
|
|
204
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/contacts/${args.id}`);
|
|
205
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
fcrm_create_contact: async (args) => {
|
|
212
|
+
try {
|
|
213
|
+
const response = await makeWordPressRequest('POST', 'fluent-crm/v2/contacts', args);
|
|
214
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
fcrm_update_contact: async (args) => {
|
|
221
|
+
try {
|
|
222
|
+
const { id, ...data } = args;
|
|
223
|
+
const response = await makeWordPressRequest('PUT', `fluent-crm/v2/contacts/${id}`, data);
|
|
224
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
fcrm_delete_contact: async (args) => {
|
|
231
|
+
try {
|
|
232
|
+
const response = await makeWordPressRequest('DELETE', `fluent-crm/v2/contacts/${args.id}`);
|
|
233
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
// List handlers
|
|
240
|
+
fcrm_list_lists: async (args) => {
|
|
241
|
+
try {
|
|
242
|
+
const params = new URLSearchParams();
|
|
243
|
+
if (args.page)
|
|
244
|
+
params.append('page', args.page);
|
|
245
|
+
if (args.per_page)
|
|
246
|
+
params.append('per_page', args.per_page);
|
|
247
|
+
if (args.search)
|
|
248
|
+
params.append('search', args.search);
|
|
249
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/lists?${params}`);
|
|
250
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
fcrm_get_list: async (args) => {
|
|
257
|
+
try {
|
|
258
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/lists/${args.id}`);
|
|
259
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
fcrm_create_list: async (args) => {
|
|
266
|
+
try {
|
|
267
|
+
const response = await makeWordPressRequest('POST', 'fluent-crm/v2/lists', args);
|
|
268
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
fcrm_update_list: async (args) => {
|
|
275
|
+
try {
|
|
276
|
+
const { id, ...data } = args;
|
|
277
|
+
const response = await makeWordPressRequest('PUT', `fluent-crm/v2/lists/${id}`, data);
|
|
278
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
fcrm_delete_list: async (args) => {
|
|
285
|
+
try {
|
|
286
|
+
const response = await makeWordPressRequest('DELETE', `fluent-crm/v2/lists/${args.id}`);
|
|
287
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
// Tag handlers
|
|
294
|
+
fcrm_list_tags: async (args) => {
|
|
295
|
+
try {
|
|
296
|
+
const params = new URLSearchParams();
|
|
297
|
+
if (args.page)
|
|
298
|
+
params.append('page', args.page);
|
|
299
|
+
if (args.per_page)
|
|
300
|
+
params.append('per_page', args.per_page);
|
|
301
|
+
if (args.search)
|
|
302
|
+
params.append('search', args.search);
|
|
303
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/tags?${params}`);
|
|
304
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
fcrm_get_tag: async (args) => {
|
|
311
|
+
try {
|
|
312
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/tags/${args.id}`);
|
|
313
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
fcrm_create_tag: async (args) => {
|
|
320
|
+
try {
|
|
321
|
+
const response = await makeWordPressRequest('POST', 'fluent-crm/v2/tags', args);
|
|
322
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
fcrm_update_tag: async (args) => {
|
|
329
|
+
try {
|
|
330
|
+
const { id, ...data } = args;
|
|
331
|
+
const response = await makeWordPressRequest('PUT', `fluent-crm/v2/tags/${id}`, data);
|
|
332
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
fcrm_delete_tag: async (args) => {
|
|
339
|
+
try {
|
|
340
|
+
const response = await makeWordPressRequest('DELETE', `fluent-crm/v2/tags/${args.id}`);
|
|
341
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
// Campaign handlers
|
|
348
|
+
fcrm_list_campaigns: async (args) => {
|
|
349
|
+
try {
|
|
350
|
+
const params = new URLSearchParams();
|
|
351
|
+
if (args.page)
|
|
352
|
+
params.append('page', args.page);
|
|
353
|
+
if (args.per_page)
|
|
354
|
+
params.append('per_page', args.per_page);
|
|
355
|
+
if (args.status)
|
|
356
|
+
params.append('status', args.status);
|
|
357
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/campaigns?${params}`);
|
|
358
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
fcrm_get_campaign: async (args) => {
|
|
365
|
+
try {
|
|
366
|
+
const response = await makeWordPressRequest('GET', `fluent-crm/v2/campaigns/${args.id}`);
|
|
367
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
fcrm_create_campaign: async (args) => {
|
|
374
|
+
try {
|
|
375
|
+
const response = await makeWordPressRequest('POST', 'fluent-crm/v2/campaigns', args);
|
|
376
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
fcrm_send_campaign: async (args) => {
|
|
383
|
+
try {
|
|
384
|
+
const { id, ...data } = args;
|
|
385
|
+
const response = await makeWordPressRequest('POST', `fluent-crm/v2/campaigns/${id}/send`, data);
|
|
386
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
};
|