@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.
Files changed (49) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +220 -0
  3. package/build/cli.d.ts +2 -0
  4. package/build/cli.js +52 -0
  5. package/build/server.d.ts +2 -0
  6. package/build/server.js +97 -0
  7. package/build/tools/comments.d.ts +212 -0
  8. package/build/tools/comments.js +181 -0
  9. package/build/tools/fluent-affiliate.d.ts +2 -0
  10. package/build/tools/fluent-affiliate.js +3 -0
  11. package/build/tools/fluent-cart.d.ts +706 -0
  12. package/build/tools/fluent-cart.js +642 -0
  13. package/build/tools/fluent-community-BACKUP.d.ts +364 -0
  14. package/build/tools/fluent-community-BACKUP.js +883 -0
  15. package/build/tools/fluent-community-MINIMAL.d.ts +69 -0
  16. package/build/tools/fluent-community-MINIMAL.js +92 -0
  17. package/build/tools/fluent-community-design.d.ts +3 -0
  18. package/build/tools/fluent-community-design.js +150 -0
  19. package/build/tools/fluent-community-layout.d.ts +119 -0
  20. package/build/tools/fluent-community-layout.js +88 -0
  21. package/build/tools/fluent-community.d.ts +364 -0
  22. package/build/tools/fluent-community.js +528 -0
  23. package/build/tools/fluent-crm.d.ts +3 -0
  24. package/build/tools/fluent-crm.js +392 -0
  25. package/build/tools/index.d.ts +2205 -0
  26. package/build/tools/index.js +54 -0
  27. package/build/tools/media.d.ts +135 -0
  28. package/build/tools/media.js +168 -0
  29. package/build/tools/ml-canvas.d.ts +91 -0
  30. package/build/tools/ml-canvas.js +109 -0
  31. package/build/tools/ml-image-editor.d.ts +230 -0
  32. package/build/tools/ml-image-editor.js +270 -0
  33. package/build/tools/ml-media-hub.d.ts +575 -0
  34. package/build/tools/ml-media-hub.js +714 -0
  35. package/build/tools/plugin-repository.d.ts +62 -0
  36. package/build/tools/plugin-repository.js +149 -0
  37. package/build/tools/plugins.d.ts +129 -0
  38. package/build/tools/plugins.js +148 -0
  39. package/build/tools/unified-content.d.ts +313 -0
  40. package/build/tools/unified-content.js +615 -0
  41. package/build/tools/unified-taxonomies.d.ts +229 -0
  42. package/build/tools/unified-taxonomies.js +479 -0
  43. package/build/tools/users.d.ts +227 -0
  44. package/build/tools/users.js +182 -0
  45. package/build/types/wordpress-types.d.ts +151 -0
  46. package/build/types/wordpress-types.js +2 -0
  47. package/build/wordpress.d.ts +26 -0
  48. package/build/wordpress.js +223 -0
  49. package/package.json +67 -0
@@ -0,0 +1,883 @@
1
+ import { makeWordPressRequest } from '../wordpress.js';
2
+ import { z } from 'zod';
3
+ /**
4
+ * FluentCommunity Tools
5
+ * Provides comprehensive management of FluentCommunity plugin features
6
+ */
7
+ // Zod Schema Definitions
8
+ const listPostsSchema = z.object({
9
+ space_id: z.number().optional().describe('Filter posts by space ID'),
10
+ user_id: z.number().optional().describe('Filter posts by user ID'),
11
+ status: z.enum(['published', 'draft', 'pending', 'archived']).optional().describe('Filter by status'),
12
+ type: z.string().optional().describe('Filter by post type (text, video, etc.)'),
13
+ limit: z.number().optional().default(20).describe('Number of posts to return'),
14
+ offset: z.number().optional().default(0).describe('Offset for pagination'),
15
+ search: z.string().optional().describe('Search term to filter posts')
16
+ });
17
+ const getPostSchema = z.object({
18
+ post_id: z.number().describe('The ID of the post to retrieve')
19
+ });
20
+ const createPostSchema = z.object({
21
+ space_id: z.number().describe('The space ID where the post will be created'),
22
+ user_id: z.number().describe('The user ID who creates the post'),
23
+ title: z.string().optional().describe('Post title'),
24
+ message: z.string().describe('Post content/message'),
25
+ type: z.string().optional().default('text').describe('Post type (text, video, etc.)'),
26
+ status: z.enum(['published', 'draft', 'pending']).optional().default('published').describe('Post status'),
27
+ privacy: z.enum(['public', 'private', 'friends']).optional().default('public').describe('Post privacy setting')
28
+ });
29
+ const updatePostSchema = z.object({
30
+ post_id: z.number().describe('The ID of the post to update'),
31
+ title: z.string().optional().describe('Post title'),
32
+ message: z.string().optional().describe('Post content/message'),
33
+ status: z.enum(['published', 'draft', 'pending', 'archived']).optional().describe('Post status'),
34
+ privacy: z.enum(['public', 'private', 'friends']).optional().describe('Post privacy setting')
35
+ });
36
+ const deletePostSchema = z.object({
37
+ post_id: z.number().describe('The ID of the post to delete')
38
+ });
39
+ const listSpacesSchema = z.object({
40
+ status: z.enum(['active', 'inactive', 'archived']).optional().describe('Filter by status'),
41
+ privacy: z.enum(['public', 'private']).optional().describe('Filter by privacy setting'),
42
+ limit: z.number().optional().default(20).describe('Number of spaces to return'),
43
+ search: z.string().optional().describe('Search term')
44
+ });
45
+ const getSpaceSchema = z.object({
46
+ space_id: z.number().describe('The ID of the space to retrieve')
47
+ });
48
+ const createSpaceSchema = z.object({
49
+ title: z.string().describe('Space title'),
50
+ slug: z.string().optional().describe('Space slug (URL-friendly name)'),
51
+ description: z.string().optional().describe('Space description'),
52
+ privacy: z.enum(['public', 'private']).optional().default('public').describe('Privacy setting'),
53
+ status: z.enum(['active', 'inactive']).optional().default('active').describe('Space status')
54
+ });
55
+ const updateSpaceSchema = z.object({
56
+ space_id: z.number().describe('The ID of the space to update'),
57
+ title: z.string().optional().describe('Space title'),
58
+ description: z.string().optional().describe('Space description'),
59
+ privacy: z.enum(['public', 'private']).optional().describe('Privacy setting'),
60
+ status: z.enum(['active', 'inactive', 'archived']).optional().describe('Space status')
61
+ });
62
+ const listCommentsSchema = z.object({
63
+ post_id: z.number().optional().describe('Filter comments by post ID'),
64
+ user_id: z.number().optional().describe('Filter comments by user ID'),
65
+ limit: z.number().optional().default(50).describe('Number of comments to return')
66
+ });
67
+ const createCommentSchema = z.object({
68
+ post_id: z.number().describe('The post ID to comment on'),
69
+ user_id: z.number().describe('The user ID who creates the comment'),
70
+ message: z.string().describe('Comment content')
71
+ });
72
+ const listMembersSchema = z.object({
73
+ space_id: z.number().optional().describe('Filter members by space ID'),
74
+ role: z.string().optional().describe('Filter by role'),
75
+ limit: z.number().optional().default(50).describe('Number of members to return')
76
+ });
77
+ const getMemberSchema = z.object({
78
+ member_id: z.number().describe('The ID of the member to retrieve')
79
+ });
80
+ const getAnalyticsSchema = z.object({
81
+ space_id: z.number().optional().describe('Filter analytics by space ID'),
82
+ start_date: z.string().optional().describe('Start date (YYYY-MM-DD)'),
83
+ end_date: z.string().optional().describe('End date (YYYY-MM-DD)')
84
+ });
85
+ export const fluentCommunityTools = [
86
+ // ==================== POSTS TOOLS ====================
87
+ {
88
+ name: 'fc_list_posts',
89
+ description: 'List all posts from FluentCommunity with optional filtering',
90
+ inputSchema: {
91
+ type: 'object',
92
+ properties: {
93
+ space_id: {
94
+ type: 'number',
95
+ description: 'Filter posts by space ID',
96
+ },
97
+ user_id: {
98
+ type: 'number',
99
+ description: 'Filter posts by user ID',
100
+ },
101
+ status: {
102
+ type: 'string',
103
+ description: 'Filter by status (published, draft, etc.)',
104
+ enum: ['published', 'draft', 'pending', 'archived'],
105
+ },
106
+ type: {
107
+ type: 'string',
108
+ description: 'Filter by post type (text, video, etc.)',
109
+ },
110
+ limit: {
111
+ type: 'number',
112
+ description: 'Number of posts to return (default: 20)',
113
+ default: 20,
114
+ },
115
+ offset: {
116
+ type: 'number',
117
+ description: 'Offset for pagination (default: 0)',
118
+ default: 0,
119
+ },
120
+ search: {
121
+ type: 'string',
122
+ description: 'Search term to filter posts',
123
+ },
124
+ },
125
+ },
126
+ },
127
+ {
128
+ name: 'fc_get_post',
129
+ description: 'Get a specific FluentCommunity post by ID with all details',
130
+ inputSchema: {
131
+ type: 'object',
132
+ properties: {
133
+ post_id: {
134
+ type: 'number',
135
+ description: 'The ID of the post to retrieve',
136
+ },
137
+ },
138
+ required: ['post_id'],
139
+ },
140
+ },
141
+ {
142
+ name: 'fc_create_post',
143
+ description: 'Create a new post in FluentCommunity',
144
+ inputSchema: {
145
+ type: 'object',
146
+ properties: {
147
+ space_id: {
148
+ type: 'number',
149
+ description: 'The space ID where the post will be created',
150
+ },
151
+ user_id: {
152
+ type: 'number',
153
+ description: 'The user ID who creates the post',
154
+ },
155
+ title: {
156
+ type: 'string',
157
+ description: 'Post title',
158
+ },
159
+ message: {
160
+ type: 'string',
161
+ description: 'Post content/message',
162
+ },
163
+ type: {
164
+ type: 'string',
165
+ description: 'Post type (text, video, etc.)',
166
+ default: 'text',
167
+ },
168
+ status: {
169
+ type: 'string',
170
+ description: 'Post status',
171
+ enum: ['published', 'draft', 'pending'],
172
+ default: 'published',
173
+ },
174
+ privacy: {
175
+ type: 'string',
176
+ description: 'Post privacy setting',
177
+ enum: ['public', 'private', 'friends'],
178
+ default: 'public',
179
+ },
180
+ },
181
+ required: ['space_id', 'user_id', 'message'],
182
+ },
183
+ },
184
+ {
185
+ name: 'fc_update_post',
186
+ description: 'Update an existing FluentCommunity post',
187
+ inputSchema: {
188
+ type: 'object',
189
+ properties: {
190
+ post_id: {
191
+ type: 'number',
192
+ description: 'The ID of the post to update',
193
+ },
194
+ title: {
195
+ type: 'string',
196
+ description: 'Post title',
197
+ },
198
+ message: {
199
+ type: 'string',
200
+ description: 'Post content/message',
201
+ },
202
+ status: {
203
+ type: 'string',
204
+ description: 'Post status',
205
+ enum: ['published', 'draft', 'pending', 'archived'],
206
+ },
207
+ privacy: {
208
+ type: 'string',
209
+ description: 'Post privacy setting',
210
+ enum: ['public', 'private', 'friends'],
211
+ },
212
+ },
213
+ required: ['post_id'],
214
+ },
215
+ },
216
+ {
217
+ name: 'fc_delete_post',
218
+ description: 'Delete a FluentCommunity post',
219
+ inputSchema: {
220
+ type: 'object',
221
+ properties: {
222
+ post_id: {
223
+ type: 'number',
224
+ description: 'The ID of the post to delete',
225
+ },
226
+ },
227
+ required: ['post_id'],
228
+ },
229
+ },
230
+ // ==================== SPACES TOOLS ====================
231
+ {
232
+ name: 'fc_list_spaces',
233
+ description: 'List all spaces in FluentCommunity',
234
+ inputSchema: {
235
+ type: 'object',
236
+ properties: {
237
+ status: {
238
+ type: 'string',
239
+ description: 'Filter by status',
240
+ enum: ['active', 'inactive', 'archived'],
241
+ },
242
+ privacy: {
243
+ type: 'string',
244
+ description: 'Filter by privacy setting',
245
+ enum: ['public', 'private'],
246
+ },
247
+ limit: {
248
+ type: 'number',
249
+ description: 'Number of spaces to return',
250
+ default: 20,
251
+ },
252
+ search: {
253
+ type: 'string',
254
+ description: 'Search term',
255
+ },
256
+ },
257
+ },
258
+ },
259
+ {
260
+ name: 'fc_get_space',
261
+ description: 'Get detailed information about a specific FluentCommunity space',
262
+ inputSchema: {
263
+ type: 'object',
264
+ properties: {
265
+ space_id: {
266
+ type: 'number',
267
+ description: 'The ID of the space to retrieve',
268
+ },
269
+ },
270
+ required: ['space_id'],
271
+ },
272
+ },
273
+ {
274
+ name: 'fc_create_space',
275
+ description: 'Create a new space in FluentCommunity',
276
+ inputSchema: {
277
+ type: 'object',
278
+ properties: {
279
+ title: {
280
+ type: 'string',
281
+ description: 'Space title',
282
+ },
283
+ slug: {
284
+ type: 'string',
285
+ description: 'Space slug (URL-friendly name)',
286
+ },
287
+ description: {
288
+ type: 'string',
289
+ description: 'Space description',
290
+ },
291
+ privacy: {
292
+ type: 'string',
293
+ description: 'Privacy setting',
294
+ enum: ['public', 'private'],
295
+ default: 'public',
296
+ },
297
+ status: {
298
+ type: 'string',
299
+ description: 'Space status',
300
+ enum: ['active', 'inactive'],
301
+ default: 'active',
302
+ },
303
+ },
304
+ required: ['title'],
305
+ },
306
+ },
307
+ {
308
+ name: 'fc_update_space',
309
+ description: 'Update an existing FluentCommunity space',
310
+ inputSchema: {
311
+ type: 'object',
312
+ properties: {
313
+ space_id: {
314
+ type: 'number',
315
+ description: 'The ID of the space to update',
316
+ },
317
+ title: {
318
+ type: 'string',
319
+ description: 'Space title',
320
+ },
321
+ description: {
322
+ type: 'string',
323
+ description: 'Space description',
324
+ },
325
+ privacy: {
326
+ type: 'string',
327
+ description: 'Privacy setting',
328
+ enum: ['public', 'private'],
329
+ },
330
+ status: {
331
+ type: 'string',
332
+ description: 'Space status',
333
+ enum: ['active', 'inactive', 'archived'],
334
+ },
335
+ },
336
+ required: ['space_id'],
337
+ },
338
+ },
339
+ // ==================== COMMENTS TOOLS ====================
340
+ {
341
+ name: 'fc_list_comments',
342
+ description: 'List FluentCommunity comments for a specific post or all comments',
343
+ inputSchema: {
344
+ type: 'object',
345
+ properties: {
346
+ post_id: {
347
+ type: 'number',
348
+ description: 'Filter comments by post ID',
349
+ },
350
+ user_id: {
351
+ type: 'number',
352
+ description: 'Filter comments by user ID',
353
+ },
354
+ limit: {
355
+ type: 'number',
356
+ description: 'Number of comments to return',
357
+ default: 50,
358
+ },
359
+ },
360
+ },
361
+ },
362
+ {
363
+ name: 'fc_create_comment',
364
+ description: 'Create a new comment on a FluentCommunity post',
365
+ inputSchema: {
366
+ type: 'object',
367
+ properties: {
368
+ post_id: {
369
+ type: 'number',
370
+ description: 'The post ID to comment on',
371
+ },
372
+ user_id: {
373
+ type: 'number',
374
+ description: 'The user ID creating the comment',
375
+ },
376
+ message: {
377
+ type: 'string',
378
+ description: 'Comment message',
379
+ },
380
+ parent_id: {
381
+ type: 'number',
382
+ description: 'Parent comment ID for replies',
383
+ },
384
+ },
385
+ required: ['post_id', 'user_id', 'message'],
386
+ },
387
+ },
388
+ {
389
+ name: 'fc_update_comment',
390
+ description: 'Update an existing FluentCommunity comment',
391
+ inputSchema: {
392
+ type: 'object',
393
+ properties: {
394
+ comment_id: {
395
+ type: 'number',
396
+ description: 'The ID of the comment to update',
397
+ },
398
+ message: {
399
+ type: 'string',
400
+ description: 'Updated comment message',
401
+ },
402
+ },
403
+ required: ['comment_id'],
404
+ },
405
+ },
406
+ {
407
+ name: 'fc_delete_comment',
408
+ description: 'Delete a FluentCommunity comment',
409
+ inputSchema: {
410
+ type: 'object',
411
+ properties: {
412
+ comment_id: {
413
+ type: 'number',
414
+ description: 'The ID of the comment to delete',
415
+ },
416
+ },
417
+ required: ['comment_id'],
418
+ },
419
+ },
420
+ // ==================== SPACE MEMBERS TOOLS ====================
421
+ {
422
+ name: 'fc_list_space_members',
423
+ description: 'List members of a specific FluentCommunity space',
424
+ inputSchema: {
425
+ type: 'object',
426
+ properties: {
427
+ space_id: {
428
+ type: 'number',
429
+ description: 'The space ID to list members from',
430
+ },
431
+ status: {
432
+ type: 'string',
433
+ description: 'Filter by member status',
434
+ enum: ['active', 'pending', 'banned'],
435
+ },
436
+ limit: {
437
+ type: 'number',
438
+ description: 'Number of members to return',
439
+ default: 50,
440
+ },
441
+ },
442
+ required: ['space_id'],
443
+ },
444
+ },
445
+ {
446
+ name: 'fc_add_space_member',
447
+ description: 'Add a user to a FluentCommunity space',
448
+ inputSchema: {
449
+ type: 'object',
450
+ properties: {
451
+ space_id: {
452
+ type: 'number',
453
+ description: 'The space ID',
454
+ },
455
+ user_id: {
456
+ type: 'number',
457
+ description: 'The user ID to add',
458
+ },
459
+ role: {
460
+ type: 'string',
461
+ description: 'Member role in the space',
462
+ default: 'member',
463
+ },
464
+ },
465
+ required: ['space_id', 'user_id'],
466
+ },
467
+ },
468
+ {
469
+ name: 'fc_remove_space_member',
470
+ description: 'Remove a user from a FluentCommunity space',
471
+ inputSchema: {
472
+ type: 'object',
473
+ properties: {
474
+ space_id: {
475
+ type: 'number',
476
+ description: 'The space ID',
477
+ },
478
+ user_id: {
479
+ type: 'number',
480
+ description: 'The user ID to remove',
481
+ },
482
+ },
483
+ required: ['space_id', 'user_id'],
484
+ },
485
+ },
486
+ // ==================== SEARCH & ANALYTICS TOOLS ====================
487
+ {
488
+ name: 'fc_search_content',
489
+ description: 'Search across all FluentCommunity content (posts, comments, spaces)',
490
+ inputSchema: {
491
+ type: 'object',
492
+ properties: {
493
+ query: {
494
+ type: 'string',
495
+ description: 'Search query',
496
+ },
497
+ content_type: {
498
+ type: 'string',
499
+ description: 'Type of content to search',
500
+ enum: ['all', 'posts', 'comments', 'spaces'],
501
+ default: 'all',
502
+ },
503
+ space_id: {
504
+ type: 'number',
505
+ description: 'Limit search to specific space',
506
+ },
507
+ limit: {
508
+ type: 'number',
509
+ description: 'Number of results to return',
510
+ default: 20,
511
+ },
512
+ },
513
+ required: ['query'],
514
+ },
515
+ },
516
+ {
517
+ name: 'fc_get_space_analytics',
518
+ description: 'Get analytics and statistics for a FluentCommunity space',
519
+ inputSchema: {
520
+ type: 'object',
521
+ properties: {
522
+ space_id: {
523
+ type: 'number',
524
+ description: 'The space ID to get analytics for',
525
+ },
526
+ date_from: {
527
+ type: 'string',
528
+ description: 'Start date (YYYY-MM-DD)',
529
+ },
530
+ date_to: {
531
+ type: 'string',
532
+ description: 'End date (YYYY-MM-DD)',
533
+ },
534
+ },
535
+ required: ['space_id'],
536
+ },
537
+ },
538
+ // ==================== BULK OPERATIONS ====================
539
+ {
540
+ name: 'fc_bulk_create_posts',
541
+ description: 'Create multiple FluentCommunity posts at once (useful for AI-generated content campaigns)',
542
+ inputSchema: {
543
+ type: 'object',
544
+ properties: {
545
+ posts: {
546
+ type: 'array',
547
+ description: 'Array of post objects to create',
548
+ items: {
549
+ type: 'object',
550
+ properties: {
551
+ space_id: { type: 'number' },
552
+ user_id: { type: 'number' },
553
+ title: { type: 'string' },
554
+ message: { type: 'string' },
555
+ type: { type: 'string' },
556
+ status: { type: 'string' },
557
+ },
558
+ required: ['space_id', 'user_id', 'message'],
559
+ },
560
+ },
561
+ },
562
+ required: ['posts'],
563
+ },
564
+ },
565
+ {
566
+ name: 'fc_bulk_update_posts',
567
+ description: 'Update multiple FluentCommunity posts at once',
568
+ inputSchema: {
569
+ type: 'object',
570
+ properties: {
571
+ post_ids: {
572
+ type: 'array',
573
+ description: 'Array of post IDs to update',
574
+ items: { type: 'number' },
575
+ },
576
+ updates: {
577
+ type: 'object',
578
+ description: 'Fields to update on all posts',
579
+ properties: {
580
+ status: { type: 'string' },
581
+ privacy: { type: 'string' },
582
+ },
583
+ },
584
+ },
585
+ required: ['post_ids', 'updates'],
586
+ },
587
+ },
588
+ {
589
+ name: 'fc_bulk_delete_posts',
590
+ description: 'Delete multiple FluentCommunity posts at once',
591
+ inputSchema: {
592
+ type: 'object',
593
+ properties: {
594
+ post_ids: {
595
+ type: 'array',
596
+ description: 'Array of post IDs to delete',
597
+ items: { type: 'number' },
598
+ },
599
+ },
600
+ required: ['post_ids'],
601
+ },
602
+ },
603
+ ];
604
+ /**
605
+ * FluentCommunity Tool Handlers
606
+ */
607
+ export const fluentCommunityHandlers = {
608
+ // ==================== POSTS HANDLERS ====================
609
+ fc_list_posts: async (args) => {
610
+ try {
611
+ const params = {
612
+ per_page: args.limit || 20,
613
+ offset: args.offset || 0,
614
+ };
615
+ if (args.space_id)
616
+ params.space_id = args.space_id;
617
+ if (args.user_id)
618
+ params.user_id = args.user_id;
619
+ if (args.status)
620
+ params.status = args.status;
621
+ if (args.type)
622
+ params.type = args.type;
623
+ if (args.search)
624
+ params.search = args.search;
625
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/posts', params);
626
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
627
+ }
628
+ catch (error) {
629
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
630
+ }
631
+ },
632
+ fc_get_post: async (args) => {
633
+ try {
634
+ const response = await makeWordPressRequest('GET', `../fc-manager/v1/posts/${args.post_id}`);
635
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
636
+ }
637
+ catch (error) {
638
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
639
+ }
640
+ },
641
+ fc_create_post: async (args) => {
642
+ try {
643
+ const postData = {
644
+ space_id: args.space_id,
645
+ user_id: args.user_id,
646
+ message: args.message,
647
+ type: args.type || 'text',
648
+ status: args.status || 'published',
649
+ privacy: args.privacy || 'public',
650
+ };
651
+ if (args.title)
652
+ postData.title = args.title;
653
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/posts', postData);
654
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
655
+ }
656
+ catch (error) {
657
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
658
+ }
659
+ },
660
+ fc_update_post: async (args) => {
661
+ try {
662
+ const { post_id, ...updateData } = args;
663
+ const response = await makeWordPressRequest('POST', `../fc-manager/v1/posts/${post_id}`, updateData);
664
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
665
+ }
666
+ catch (error) {
667
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
668
+ }
669
+ },
670
+ fc_delete_post: async (args) => {
671
+ try {
672
+ const response = await makeWordPressRequest('DELETE', `../fc-manager/v1/posts/${args.post_id}`);
673
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
674
+ }
675
+ catch (error) {
676
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
677
+ }
678
+ },
679
+ // ==================== SPACES HANDLERS ====================
680
+ fc_list_spaces: async (args) => {
681
+ try {
682
+ const params = { per_page: args.limit || 20 };
683
+ if (args.status)
684
+ params.status = args.status;
685
+ if (args.privacy)
686
+ params.privacy = args.privacy;
687
+ if (args.search)
688
+ params.search = args.search;
689
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/spaces', params);
690
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
691
+ }
692
+ catch (error) {
693
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
694
+ }
695
+ },
696
+ fc_get_space: async (args) => {
697
+ try {
698
+ const response = await makeWordPressRequest('GET', `../fc-manager/v1/spaces/${args.space_id}`);
699
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
700
+ }
701
+ catch (error) {
702
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
703
+ }
704
+ },
705
+ fc_create_space: async (args) => {
706
+ try {
707
+ const spaceData = {
708
+ title: args.title,
709
+ slug: args.slug || args.title.toLowerCase().replace(/\s+/g, '-'),
710
+ privacy: args.privacy || 'public',
711
+ status: args.status || 'active',
712
+ };
713
+ if (args.description)
714
+ spaceData.description = args.description;
715
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/spaces', spaceData);
716
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
717
+ }
718
+ catch (error) {
719
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
720
+ }
721
+ },
722
+ fc_update_space: async (args) => {
723
+ try {
724
+ const { space_id, ...updateData } = args;
725
+ const response = await makeWordPressRequest('POST', `../fc-manager/v1/spaces/${space_id}`, updateData);
726
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
727
+ }
728
+ catch (error) {
729
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
730
+ }
731
+ },
732
+ // ==================== COMMENTS HANDLERS ====================
733
+ fc_list_comments: async (args) => {
734
+ try {
735
+ const params = { per_page: args.limit || 50 };
736
+ if (args.post_id)
737
+ params.post_id = args.post_id;
738
+ if (args.user_id)
739
+ params.user_id = args.user_id;
740
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/comments', params);
741
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
742
+ }
743
+ catch (error) {
744
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
745
+ }
746
+ },
747
+ fc_create_comment: async (args) => {
748
+ try {
749
+ const commentData = {
750
+ post_id: args.post_id,
751
+ user_id: args.user_id,
752
+ message: args.message,
753
+ };
754
+ if (args.parent_id)
755
+ commentData.parent_id = args.parent_id;
756
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/comments', commentData);
757
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
758
+ }
759
+ catch (error) {
760
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
761
+ }
762
+ },
763
+ fc_update_comment: async (args) => {
764
+ try {
765
+ const { comment_id, ...updateData } = args;
766
+ const response = await makeWordPressRequest('POST', `../fc-manager/v1/comments/${comment_id}`, updateData);
767
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
768
+ }
769
+ catch (error) {
770
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
771
+ }
772
+ },
773
+ fc_delete_comment: async (args) => {
774
+ try {
775
+ const response = await makeWordPressRequest('DELETE', `../fc-manager/v1/comments/${args.comment_id}`);
776
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
777
+ }
778
+ catch (error) {
779
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
780
+ }
781
+ },
782
+ // ==================== SPACE MEMBERS HANDLERS ====================
783
+ fc_list_space_members: async (args) => {
784
+ try {
785
+ const params = {
786
+ space_id: args.space_id,
787
+ per_page: args.limit || 50,
788
+ };
789
+ if (args.status)
790
+ params.status = args.status;
791
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/space-members', params);
792
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
793
+ }
794
+ catch (error) {
795
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
796
+ }
797
+ },
798
+ fc_add_space_member: async (args) => {
799
+ try {
800
+ const memberData = {
801
+ space_id: args.space_id,
802
+ user_id: args.user_id,
803
+ role: args.role || 'member',
804
+ };
805
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/space-members', memberData);
806
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
807
+ }
808
+ catch (error) {
809
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
810
+ }
811
+ },
812
+ fc_remove_space_member: async (args) => {
813
+ try {
814
+ const response = await makeWordPressRequest('DELETE', `../fc-manager/v1/space-members/${args.space_id}/${args.user_id}`);
815
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
816
+ }
817
+ catch (error) {
818
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
819
+ }
820
+ },
821
+ // ==================== SEARCH & ANALYTICS HANDLERS ====================
822
+ fc_search_content: async (args) => {
823
+ try {
824
+ const params = {
825
+ query: args.query,
826
+ content_type: args.content_type || 'all',
827
+ per_page: args.limit || 20,
828
+ };
829
+ if (args.space_id)
830
+ params.space_id = args.space_id;
831
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/search', params);
832
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
833
+ }
834
+ catch (error) {
835
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
836
+ }
837
+ },
838
+ fc_get_space_analytics: async (args) => {
839
+ try {
840
+ const params = { space_id: args.space_id };
841
+ if (args.date_from)
842
+ params.date_from = args.date_from;
843
+ if (args.date_to)
844
+ params.date_to = args.date_to;
845
+ const response = await makeWordPressRequest('GET', '../fc-manager/v1/analytics/space', params);
846
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
847
+ }
848
+ catch (error) {
849
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
850
+ }
851
+ },
852
+ // ==================== BULK OPERATIONS HANDLERS ====================
853
+ fc_bulk_create_posts: async (args) => {
854
+ try {
855
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/posts/bulk', { posts: args.posts });
856
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
857
+ }
858
+ catch (error) {
859
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
860
+ }
861
+ },
862
+ fc_bulk_update_posts: async (args) => {
863
+ try {
864
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/posts/bulk-update', {
865
+ post_ids: args.post_ids,
866
+ updates: args.updates,
867
+ });
868
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
869
+ }
870
+ catch (error) {
871
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
872
+ }
873
+ },
874
+ fc_bulk_delete_posts: async (args) => {
875
+ try {
876
+ const response = await makeWordPressRequest('POST', '../fc-manager/v1/posts/bulk-delete', { post_ids: args.post_ids });
877
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
878
+ }
879
+ catch (error) {
880
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
881
+ }
882
+ },
883
+ };