@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,642 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
3
|
+
// FluentCart Tools - E-commerce Management
|
|
4
|
+
// Note: FluentCart API is still in development. These tools are based on common e-commerce patterns
|
|
5
|
+
// and will be updated when official API documentation is released.
|
|
6
|
+
export const fluentCartTools = [
|
|
7
|
+
// Product Management
|
|
8
|
+
{
|
|
9
|
+
name: 'fcart_list_products',
|
|
10
|
+
description: 'List all products in FluentCart store with filtering options',
|
|
11
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
12
|
+
page: z.number().optional().describe('Page number for pagination'),
|
|
13
|
+
per_page: z.number().optional().describe('Number of products per page (max 100)'),
|
|
14
|
+
search: z.string().optional().describe('Search term for product name/description'),
|
|
15
|
+
status: z.enum(['publish', 'draft', 'pending']).optional().describe('Product status filter'),
|
|
16
|
+
category: z.number().optional().describe('Category ID filter'),
|
|
17
|
+
}).shape },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'fcart_get_product',
|
|
21
|
+
description: 'Get detailed information about a specific product',
|
|
22
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
23
|
+
product_id: z.number().describe('Product ID'),
|
|
24
|
+
}).shape },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'fcart_create_product',
|
|
28
|
+
description: 'Create a new product in FluentCart',
|
|
29
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
30
|
+
name: z.string().describe('Product name'),
|
|
31
|
+
description: z.string().optional().describe('Product description'),
|
|
32
|
+
price: z.number().describe('Product price'),
|
|
33
|
+
sale_price: z.number().optional().describe('Sale price'),
|
|
34
|
+
sku: z.string().optional().describe('Product SKU'),
|
|
35
|
+
stock_quantity: z.number().optional().describe('Stock quantity'),
|
|
36
|
+
categories: z.array(z.number()).optional().describe('Category IDs'),
|
|
37
|
+
images: z.array(z.string()).optional().describe('Image URLs'),
|
|
38
|
+
status: z.enum(['publish', 'draft']).optional().describe('Product status'),
|
|
39
|
+
}).shape },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'fcart_update_product',
|
|
43
|
+
description: 'Update an existing product',
|
|
44
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
45
|
+
product_id: z.number().describe('Product ID'),
|
|
46
|
+
name: z.string().optional().describe('Product name'),
|
|
47
|
+
description: z.string().optional().describe('Product description'),
|
|
48
|
+
price: z.number().optional().describe('Product price'),
|
|
49
|
+
sale_price: z.number().optional().describe('Sale price'),
|
|
50
|
+
sku: z.string().optional().describe('Product SKU'),
|
|
51
|
+
stock_quantity: z.number().optional().describe('Stock quantity'),
|
|
52
|
+
status: z.enum(['publish', 'draft']).optional().describe('Product status'),
|
|
53
|
+
}).shape },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'fcart_delete_product',
|
|
57
|
+
description: 'Delete a product from FluentCart',
|
|
58
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
59
|
+
product_id: z.number().describe('Product ID'),
|
|
60
|
+
force: z.boolean().optional().describe('Force delete (bypass trash)'),
|
|
61
|
+
}).shape },
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'fcart_update_product_pricing',
|
|
65
|
+
description: 'Update product pricing (price, sale_price, SKU)',
|
|
66
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
67
|
+
product_id: z.number().describe('Product ID'),
|
|
68
|
+
price: z.number().describe('Product price in dollars (will be converted to cents)'),
|
|
69
|
+
sale_price: z.number().optional().describe('Sale price in dollars'),
|
|
70
|
+
sku: z.string().optional().describe('Product SKU'),
|
|
71
|
+
}).shape },
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'fcart_get_product_thumbnail',
|
|
75
|
+
description: 'Get product thumbnail image',
|
|
76
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
77
|
+
variant_id: z.number().describe('Product variant ID'),
|
|
78
|
+
}).shape },
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'fcart_set_product_thumbnail',
|
|
82
|
+
description: 'Set product thumbnail image',
|
|
83
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
84
|
+
variant_id: z.number().describe('Product variant ID'),
|
|
85
|
+
image_id: z.number().describe('WordPress media ID for the thumbnail'),
|
|
86
|
+
}).shape },
|
|
87
|
+
},
|
|
88
|
+
// Order Management
|
|
89
|
+
{
|
|
90
|
+
name: 'fcart_list_orders',
|
|
91
|
+
description: 'List all orders with filtering options',
|
|
92
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
93
|
+
page: z.number().optional().describe('Page number'),
|
|
94
|
+
per_page: z.number().optional().describe('Orders per page (max 100)'),
|
|
95
|
+
status: z.enum(['pending', 'processing', 'completed', 'cancelled', 'refunded']).optional().describe('Order status'),
|
|
96
|
+
customer_id: z.number().optional().describe('Filter by customer ID'),
|
|
97
|
+
date_from: z.string().optional().describe('Start date (YYYY-MM-DD)'),
|
|
98
|
+
date_to: z.string().optional().describe('End date (YYYY-MM-DD)'),
|
|
99
|
+
}).shape },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'fcart_get_order',
|
|
103
|
+
description: 'Get detailed information about a specific order',
|
|
104
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
105
|
+
order_id: z.number().describe('Order ID'),
|
|
106
|
+
}).shape },
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'fcart_create_order',
|
|
110
|
+
description: 'Create a new order manually',
|
|
111
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
112
|
+
customer_id: z.number().describe('Customer ID'),
|
|
113
|
+
products: z.array(z.object({
|
|
114
|
+
product_id: z.number(),
|
|
115
|
+
quantity: z.number(),
|
|
116
|
+
})).describe('Products in order'),
|
|
117
|
+
status: z.enum(['pending', 'processing', 'completed']).optional().describe('Order status'),
|
|
118
|
+
payment_method: z.string().optional().describe('Payment method'),
|
|
119
|
+
}).shape },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'fcart_update_order',
|
|
123
|
+
description: 'Update order status or details',
|
|
124
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
125
|
+
order_id: z.number().describe('Order ID'),
|
|
126
|
+
status: z.enum(['pending', 'processing', 'completed', 'cancelled', 'refunded']).optional().describe('Order status'),
|
|
127
|
+
notes: z.string().optional().describe('Order notes'),
|
|
128
|
+
}).shape },
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'fcart_mark_order_paid',
|
|
132
|
+
description: 'Mark an order as paid',
|
|
133
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
134
|
+
order_id: z.number().describe('Order ID'),
|
|
135
|
+
}).shape },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'fcart_refund_order',
|
|
139
|
+
description: 'Refund an order',
|
|
140
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
141
|
+
order_id: z.number().describe('Order ID'),
|
|
142
|
+
amount: z.number().optional().describe('Refund amount (full refund if not specified)'),
|
|
143
|
+
reason: z.string().optional().describe('Refund reason'),
|
|
144
|
+
}).shape },
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'fcart_update_order_statuses',
|
|
148
|
+
description: 'Bulk update order statuses',
|
|
149
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
150
|
+
order_ids: z.array(z.number()).describe('Array of order IDs'),
|
|
151
|
+
status: z.enum(['pending', 'processing', 'completed', 'cancelled', 'refunded']).describe('New status'),
|
|
152
|
+
}).shape },
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'fcart_delete_order',
|
|
156
|
+
description: 'Delete an order',
|
|
157
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
158
|
+
order_id: z.number().describe('Order ID'),
|
|
159
|
+
}).shape },
|
|
160
|
+
},
|
|
161
|
+
// Customer Management
|
|
162
|
+
{
|
|
163
|
+
name: 'fcart_list_customers',
|
|
164
|
+
description: 'List all customers in FluentCart',
|
|
165
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
166
|
+
page: z.number().optional().describe('Page number'),
|
|
167
|
+
per_page: z.number().optional().describe('Customers per page'),
|
|
168
|
+
search: z.string().optional().describe('Search by name or email'),
|
|
169
|
+
}).shape },
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'fcart_get_customer',
|
|
173
|
+
description: 'Get customer details including order history',
|
|
174
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
175
|
+
customer_id: z.number().describe('Customer ID'),
|
|
176
|
+
}).shape },
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'fcart_create_customer',
|
|
180
|
+
description: 'Create a new customer',
|
|
181
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
182
|
+
email: z.string().describe('Customer email'),
|
|
183
|
+
first_name: z.string().optional().describe('First name'),
|
|
184
|
+
last_name: z.string().optional().describe('Last name'),
|
|
185
|
+
}).shape },
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'fcart_update_customer',
|
|
189
|
+
description: 'Update customer details',
|
|
190
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
191
|
+
customer_id: z.number().describe('Customer ID'),
|
|
192
|
+
email: z.string().optional().describe('Customer email'),
|
|
193
|
+
first_name: z.string().optional().describe('First name'),
|
|
194
|
+
last_name: z.string().optional().describe('Last name'),
|
|
195
|
+
}).shape },
|
|
196
|
+
},
|
|
197
|
+
// Coupon Management
|
|
198
|
+
{
|
|
199
|
+
name: 'fcart_list_coupons',
|
|
200
|
+
description: 'List all discount coupons',
|
|
201
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
202
|
+
page: z.number().optional().describe('Page number'),
|
|
203
|
+
per_page: z.number().optional().describe('Coupons per page'),
|
|
204
|
+
status: z.enum(['active', 'expired', 'disabled']).optional().describe('Coupon status'),
|
|
205
|
+
}).shape },
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'fcart_create_coupon',
|
|
209
|
+
description: 'Create a new discount coupon',
|
|
210
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
211
|
+
code: z.string().describe('Coupon code'),
|
|
212
|
+
discount_type: z.enum(['percentage', 'fixed']).describe('Discount type'),
|
|
213
|
+
amount: z.number().describe('Discount amount'),
|
|
214
|
+
expiry_date: z.string().optional().describe('Expiry date (YYYY-MM-DD)'),
|
|
215
|
+
usage_limit: z.number().optional().describe('Maximum usage count'),
|
|
216
|
+
minimum_amount: z.number().optional().describe('Minimum order amount'),
|
|
217
|
+
}).shape },
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'fcart_update_coupon',
|
|
221
|
+
description: 'Update coupon details',
|
|
222
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
223
|
+
coupon_id: z.number().describe('Coupon ID'),
|
|
224
|
+
code: z.string().optional().describe('Coupon code'),
|
|
225
|
+
amount: z.number().optional().describe('Discount amount'),
|
|
226
|
+
status: z.enum(['active', 'disabled']).optional().describe('Coupon status'),
|
|
227
|
+
}).shape },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'fcart_delete_coupon',
|
|
231
|
+
description: 'Delete a coupon',
|
|
232
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
233
|
+
coupon_id: z.number().describe('Coupon ID'),
|
|
234
|
+
}).shape },
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'fcart_get_coupon',
|
|
238
|
+
description: 'Get coupon details',
|
|
239
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
240
|
+
coupon_id: z.number().describe('Coupon ID'),
|
|
241
|
+
}).shape },
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'fcart_apply_coupon',
|
|
245
|
+
description: 'Apply a coupon to a cart or order',
|
|
246
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
247
|
+
coupon_code: z.string().describe('Coupon code'),
|
|
248
|
+
order_id: z.number().optional().describe('Order ID to apply coupon to'),
|
|
249
|
+
}).shape },
|
|
250
|
+
},
|
|
251
|
+
// Subscriptions
|
|
252
|
+
{
|
|
253
|
+
name: 'fcart_list_subscriptions',
|
|
254
|
+
description: 'List all subscriptions',
|
|
255
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
256
|
+
page: z.number().optional().describe('Page number'),
|
|
257
|
+
per_page: z.number().optional().describe('Items per page'),
|
|
258
|
+
status: z.string().optional().describe('Subscription status'),
|
|
259
|
+
customer_id: z.number().optional().describe('Filter by customer ID'),
|
|
260
|
+
}).shape },
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'fcart_get_subscription',
|
|
264
|
+
description: 'Get subscription details',
|
|
265
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
266
|
+
subscription_id: z.number().describe('Subscription ID'),
|
|
267
|
+
}).shape },
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'fcart_cancel_subscription',
|
|
271
|
+
description: 'Cancel a subscription',
|
|
272
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
273
|
+
subscription_id: z.number().describe('Subscription ID'),
|
|
274
|
+
}).shape },
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'fcart_reactivate_subscription',
|
|
278
|
+
description: 'Reactivate a cancelled subscription',
|
|
279
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
280
|
+
subscription_id: z.number().describe('Subscription ID'),
|
|
281
|
+
}).shape },
|
|
282
|
+
},
|
|
283
|
+
// Analytics
|
|
284
|
+
{
|
|
285
|
+
name: 'fcart_get_analytics',
|
|
286
|
+
description: 'Get store analytics and sales data',
|
|
287
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
288
|
+
date_from: z.string().optional().describe('Start date (YYYY-MM-DD)'),
|
|
289
|
+
date_to: z.string().optional().describe('End date (YYYY-MM-DD)'),
|
|
290
|
+
metrics: z.array(z.enum(['revenue', 'orders', 'customers', 'products_sold'])).optional().describe('Metrics to retrieve'),
|
|
291
|
+
}).shape },
|
|
292
|
+
},
|
|
293
|
+
];
|
|
294
|
+
export const fluentCartHandlers = {
|
|
295
|
+
// Product handlers
|
|
296
|
+
fcart_list_products: async (args) => {
|
|
297
|
+
try {
|
|
298
|
+
const params = new URLSearchParams();
|
|
299
|
+
if (args.page)
|
|
300
|
+
params.append('page', args.page);
|
|
301
|
+
if (args.per_page)
|
|
302
|
+
params.append('per_page', args.per_page);
|
|
303
|
+
if (args.search)
|
|
304
|
+
params.append('search', args.search);
|
|
305
|
+
if (args.status)
|
|
306
|
+
params.append('status', args.status);
|
|
307
|
+
if (args.category)
|
|
308
|
+
params.append('category', args.category);
|
|
309
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/products?${params}`);
|
|
310
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
fcart_get_product: async (args) => {
|
|
317
|
+
try {
|
|
318
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/products/${args.product_id}`);
|
|
319
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
fcart_create_product: async (args) => {
|
|
326
|
+
try {
|
|
327
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/fluentcart/products', args);
|
|
328
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
fcart_update_product: async (args) => {
|
|
335
|
+
try {
|
|
336
|
+
const { product_id, ...data } = args;
|
|
337
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/products/${product_id}`, data);
|
|
338
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
fcart_delete_product: async (args) => {
|
|
345
|
+
try {
|
|
346
|
+
const params = args.force ? '?force=true' : '';
|
|
347
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/fluentcart/products/${args.product_id}${params}`);
|
|
348
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
fcart_update_product_pricing: async (args) => {
|
|
355
|
+
try {
|
|
356
|
+
const { product_id, ...data } = args;
|
|
357
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/products/${product_id}/pricing`, data);
|
|
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
|
+
fcart_get_product_thumbnail: async (args) => {
|
|
365
|
+
try {
|
|
366
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/products/${args.variant_id}/thumbnail`);
|
|
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
|
+
fcart_set_product_thumbnail: async (args) => {
|
|
374
|
+
try {
|
|
375
|
+
const { variant_id, ...data } = args;
|
|
376
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/fluentcart/products/${variant_id}/thumbnail`, data);
|
|
377
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
// Order handlers
|
|
384
|
+
fcart_list_orders: async (args) => {
|
|
385
|
+
try {
|
|
386
|
+
const params = new URLSearchParams();
|
|
387
|
+
if (args.page)
|
|
388
|
+
params.append('page', args.page);
|
|
389
|
+
if (args.per_page)
|
|
390
|
+
params.append('per_page', args.per_page);
|
|
391
|
+
if (args.status)
|
|
392
|
+
params.append('status', args.status);
|
|
393
|
+
if (args.customer_id)
|
|
394
|
+
params.append('customer_id', args.customer_id);
|
|
395
|
+
if (args.date_from)
|
|
396
|
+
params.append('date_from', args.date_from);
|
|
397
|
+
if (args.date_to)
|
|
398
|
+
params.append('date_to', args.date_to);
|
|
399
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/orders?${params}`);
|
|
400
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
fcart_get_order: async (args) => {
|
|
407
|
+
try {
|
|
408
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/orders/${args.order_id}`);
|
|
409
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
fcart_create_order: async (args) => {
|
|
416
|
+
try {
|
|
417
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/fluentcart/orders', args);
|
|
418
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
fcart_update_order: async (args) => {
|
|
425
|
+
try {
|
|
426
|
+
const { order_id, ...data } = args;
|
|
427
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/orders/${order_id}`, data);
|
|
428
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
fcart_mark_order_paid: async (args) => {
|
|
435
|
+
try {
|
|
436
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/fluentcart/orders/${args.order_id}/mark-paid`);
|
|
437
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
fcart_refund_order: async (args) => {
|
|
444
|
+
try {
|
|
445
|
+
const { order_id, ...data } = args;
|
|
446
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/fluentcart/orders/${order_id}/refund`, data);
|
|
447
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
fcart_update_order_statuses: async (args) => {
|
|
454
|
+
try {
|
|
455
|
+
const response = await makeWordPressRequest('PUT', 'fc-manager/v1/fluentcart/orders/update-statuses', args);
|
|
456
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
457
|
+
}
|
|
458
|
+
catch (error) {
|
|
459
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
fcart_delete_order: async (args) => {
|
|
463
|
+
try {
|
|
464
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/fluentcart/orders/${args.order_id}/delete`);
|
|
465
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
466
|
+
}
|
|
467
|
+
catch (error) {
|
|
468
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
// Customer handlers
|
|
472
|
+
fcart_list_customers: async (args) => {
|
|
473
|
+
try {
|
|
474
|
+
const params = new URLSearchParams();
|
|
475
|
+
if (args.page)
|
|
476
|
+
params.append('page', args.page);
|
|
477
|
+
if (args.per_page)
|
|
478
|
+
params.append('per_page', args.per_page);
|
|
479
|
+
if (args.search)
|
|
480
|
+
params.append('search', args.search);
|
|
481
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/customers?${params}`);
|
|
482
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
483
|
+
}
|
|
484
|
+
catch (error) {
|
|
485
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
fcart_get_customer: async (args) => {
|
|
489
|
+
try {
|
|
490
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/customers/${args.customer_id}`);
|
|
491
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
492
|
+
}
|
|
493
|
+
catch (error) {
|
|
494
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
fcart_create_customer: async (args) => {
|
|
498
|
+
try {
|
|
499
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/fluentcart/customers', args);
|
|
500
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
fcart_update_customer: async (args) => {
|
|
507
|
+
try {
|
|
508
|
+
const { customer_id, ...data } = args;
|
|
509
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/customers/${customer_id}`, data);
|
|
510
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
511
|
+
}
|
|
512
|
+
catch (error) {
|
|
513
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
// Coupon handlers
|
|
517
|
+
fcart_list_coupons: async (args) => {
|
|
518
|
+
try {
|
|
519
|
+
const params = new URLSearchParams();
|
|
520
|
+
if (args.page)
|
|
521
|
+
params.append('page', args.page);
|
|
522
|
+
if (args.per_page)
|
|
523
|
+
params.append('per_page', args.per_page);
|
|
524
|
+
if (args.status)
|
|
525
|
+
params.append('status', args.status);
|
|
526
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/coupons?${params}`);
|
|
527
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
528
|
+
}
|
|
529
|
+
catch (error) {
|
|
530
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
fcart_create_coupon: async (args) => {
|
|
534
|
+
try {
|
|
535
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/fluentcart/coupons', args);
|
|
536
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
537
|
+
}
|
|
538
|
+
catch (error) {
|
|
539
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
fcart_update_coupon: async (args) => {
|
|
543
|
+
try {
|
|
544
|
+
const { coupon_id, ...data } = args;
|
|
545
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/coupons/${coupon_id}`, data);
|
|
546
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
fcart_delete_coupon: async (args) => {
|
|
553
|
+
try {
|
|
554
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/fluentcart/coupons/${args.coupon_id}`);
|
|
555
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
fcart_get_coupon: async (args) => {
|
|
562
|
+
try {
|
|
563
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/coupons/${args.coupon_id}`);
|
|
564
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
fcart_apply_coupon: async (args) => {
|
|
571
|
+
try {
|
|
572
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/fluentcart/coupons/apply', args);
|
|
573
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
574
|
+
}
|
|
575
|
+
catch (error) {
|
|
576
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
// Subscription handlers
|
|
580
|
+
fcart_list_subscriptions: async (args) => {
|
|
581
|
+
try {
|
|
582
|
+
const params = new URLSearchParams();
|
|
583
|
+
if (args.page)
|
|
584
|
+
params.append('page', args.page);
|
|
585
|
+
if (args.per_page)
|
|
586
|
+
params.append('per_page', args.per_page);
|
|
587
|
+
if (args.status)
|
|
588
|
+
params.append('status', args.status);
|
|
589
|
+
if (args.customer_id)
|
|
590
|
+
params.append('customer_id', args.customer_id);
|
|
591
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/subscriptions?${params}`);
|
|
592
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
fcart_get_subscription: async (args) => {
|
|
599
|
+
try {
|
|
600
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/subscriptions/${args.subscription_id}`);
|
|
601
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
fcart_cancel_subscription: async (args) => {
|
|
608
|
+
try {
|
|
609
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/subscriptions/${args.subscription_id}/cancel`);
|
|
610
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
fcart_reactivate_subscription: async (args) => {
|
|
617
|
+
try {
|
|
618
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/fluentcart/subscriptions/${args.subscription_id}/reactivate`);
|
|
619
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
620
|
+
}
|
|
621
|
+
catch (error) {
|
|
622
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
// Analytics handler
|
|
626
|
+
fcart_get_analytics: async (args) => {
|
|
627
|
+
try {
|
|
628
|
+
const params = new URLSearchParams();
|
|
629
|
+
if (args.date_from)
|
|
630
|
+
params.append('date_from', args.date_from);
|
|
631
|
+
if (args.date_to)
|
|
632
|
+
params.append('date_to', args.date_to);
|
|
633
|
+
if (args.metrics)
|
|
634
|
+
params.append('metrics', args.metrics.join(','));
|
|
635
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/fluentcart/analytics?${params}`);
|
|
636
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
};
|