@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,528 @@
|
|
|
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
|
+
const updateCommentSchema = z.object({
|
|
86
|
+
comment_id: z.number().describe('The ID of the comment to update'),
|
|
87
|
+
message: z.string().describe('Updated comment message')
|
|
88
|
+
});
|
|
89
|
+
const deleteCommentSchema = z.object({
|
|
90
|
+
comment_id: z.number().describe('The ID of the comment to delete')
|
|
91
|
+
});
|
|
92
|
+
const listSpaceMembersSchema = z.object({
|
|
93
|
+
space_id: z.number().describe('The space ID to list members from'),
|
|
94
|
+
status: z.enum(['active', 'pending', 'banned']).optional().describe('Filter by member status'),
|
|
95
|
+
limit: z.number().optional().default(50).describe('Number of members to return')
|
|
96
|
+
});
|
|
97
|
+
const addSpaceMemberSchema = z.object({
|
|
98
|
+
space_id: z.number().describe('The space ID'),
|
|
99
|
+
user_id: z.number().describe('The user ID to add'),
|
|
100
|
+
role: z.string().optional().default('member').describe('Member role in the space')
|
|
101
|
+
});
|
|
102
|
+
const removeSpaceMemberSchema = z.object({
|
|
103
|
+
space_id: z.number().describe('The space ID'),
|
|
104
|
+
user_id: z.number().describe('The user ID to remove')
|
|
105
|
+
});
|
|
106
|
+
const searchContentSchema = z.object({
|
|
107
|
+
query: z.string().describe('Search query'),
|
|
108
|
+
content_type: z.enum(['all', 'posts', 'comments', 'spaces']).optional().default('all').describe('Type of content to search'),
|
|
109
|
+
space_id: z.number().optional().describe('Limit search to specific space'),
|
|
110
|
+
limit: z.number().optional().default(20).describe('Number of results to return')
|
|
111
|
+
});
|
|
112
|
+
const getSpaceAnalyticsSchema = z.object({
|
|
113
|
+
space_id: z.number().describe('The space ID to get analytics for'),
|
|
114
|
+
date_from: z.string().optional().describe('Start date (YYYY-MM-DD)'),
|
|
115
|
+
date_to: z.string().optional().describe('End date (YYYY-MM-DD)')
|
|
116
|
+
});
|
|
117
|
+
const bulkCreatePostsSchema = z.object({
|
|
118
|
+
posts: z.array(z.object({
|
|
119
|
+
space_id: z.number(),
|
|
120
|
+
user_id: z.number(),
|
|
121
|
+
title: z.string().optional(),
|
|
122
|
+
message: z.string(),
|
|
123
|
+
type: z.string().optional(),
|
|
124
|
+
status: z.string().optional()
|
|
125
|
+
})).describe('Array of post objects to create')
|
|
126
|
+
});
|
|
127
|
+
const bulkUpdatePostsSchema = z.object({
|
|
128
|
+
post_ids: z.array(z.number()).describe('Array of post IDs to update'),
|
|
129
|
+
updates: z.object({
|
|
130
|
+
status: z.string().optional(),
|
|
131
|
+
privacy: z.string().optional()
|
|
132
|
+
}).describe('Fields to update on all posts')
|
|
133
|
+
});
|
|
134
|
+
const bulkDeletePostsSchema = z.object({
|
|
135
|
+
post_ids: z.array(z.number()).describe('Array of post IDs to delete')
|
|
136
|
+
});
|
|
137
|
+
export const fluentCommunityTools = [
|
|
138
|
+
// ==================== POSTS TOOLS ====================
|
|
139
|
+
{
|
|
140
|
+
name: 'fc_list_posts',
|
|
141
|
+
description: 'List all posts from FluentCommunity with optional filtering',
|
|
142
|
+
inputSchema: { type: 'object', properties: listPostsSchema.shape }
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'fc_get_post',
|
|
146
|
+
description: 'Get a specific FluentCommunity post by ID with all details',
|
|
147
|
+
inputSchema: { type: 'object', properties: getPostSchema.shape }
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'fc_create_post',
|
|
151
|
+
description: 'Create a new post in FluentCommunity',
|
|
152
|
+
inputSchema: { type: 'object', properties: createPostSchema.shape }
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'fc_update_post',
|
|
156
|
+
description: 'Update an existing FluentCommunity post',
|
|
157
|
+
inputSchema: { type: 'object', properties: updatePostSchema.shape }
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'fc_delete_post',
|
|
161
|
+
description: 'Delete a FluentCommunity post',
|
|
162
|
+
inputSchema: { type: 'object', properties: deletePostSchema.shape }
|
|
163
|
+
},
|
|
164
|
+
// ==================== SPACES TOOLS ====================
|
|
165
|
+
{
|
|
166
|
+
name: 'fc_list_spaces',
|
|
167
|
+
description: 'List all spaces in FluentCommunity',
|
|
168
|
+
inputSchema: { type: 'object', properties: listSpacesSchema.shape }
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'fc_get_space',
|
|
172
|
+
description: 'Get detailed information about a specific FluentCommunity space',
|
|
173
|
+
inputSchema: { type: 'object', properties: getSpaceSchema.shape }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'fc_create_space',
|
|
177
|
+
description: 'Create a new space in FluentCommunity',
|
|
178
|
+
inputSchema: { type: 'object', properties: createSpaceSchema.shape }
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'fc_update_space',
|
|
182
|
+
description: 'Update an existing FluentCommunity space',
|
|
183
|
+
inputSchema: { type: 'object', properties: updateSpaceSchema.shape }
|
|
184
|
+
},
|
|
185
|
+
// ==================== COMMENTS TOOLS ====================
|
|
186
|
+
{
|
|
187
|
+
name: 'fc_list_comments',
|
|
188
|
+
description: 'List FluentCommunity comments for a specific post or all comments',
|
|
189
|
+
inputSchema: { type: 'object', properties: listCommentsSchema.shape }
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'fc_create_comment',
|
|
193
|
+
description: 'Create a new comment on a FluentCommunity post',
|
|
194
|
+
inputSchema: { type: 'object', properties: createCommentSchema.shape }
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'fc_update_comment',
|
|
198
|
+
description: 'Update an existing FluentCommunity comment',
|
|
199
|
+
inputSchema: { type: 'object', properties: updateCommentSchema.shape }
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'fc_delete_comment',
|
|
203
|
+
description: 'Delete a FluentCommunity comment',
|
|
204
|
+
inputSchema: { type: 'object', properties: deleteCommentSchema.shape }
|
|
205
|
+
},
|
|
206
|
+
// ==================== SPACE MEMBERS TOOLS ====================
|
|
207
|
+
{
|
|
208
|
+
name: 'fc_list_space_members',
|
|
209
|
+
description: 'List members of a specific FluentCommunity space',
|
|
210
|
+
inputSchema: { type: 'object', properties: listSpaceMembersSchema.shape }
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'fc_add_space_member',
|
|
214
|
+
description: 'Add a user to a FluentCommunity space',
|
|
215
|
+
inputSchema: { type: 'object', properties: addSpaceMemberSchema.shape }
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'fc_remove_space_member',
|
|
219
|
+
description: 'Remove a user from a FluentCommunity space',
|
|
220
|
+
inputSchema: { type: 'object', properties: removeSpaceMemberSchema.shape }
|
|
221
|
+
},
|
|
222
|
+
// ==================== SEARCH & ANALYTICS TOOLS ====================
|
|
223
|
+
{
|
|
224
|
+
name: 'fc_search_content',
|
|
225
|
+
description: 'Search across all FluentCommunity content (posts, comments, spaces)',
|
|
226
|
+
inputSchema: { type: 'object', properties: searchContentSchema.shape }
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'fc_get_space_analytics',
|
|
230
|
+
description: 'Get analytics and statistics for a FluentCommunity space',
|
|
231
|
+
inputSchema: { type: 'object', properties: getSpaceAnalyticsSchema.shape }
|
|
232
|
+
},
|
|
233
|
+
// ==================== BULK OPERATIONS ====================
|
|
234
|
+
{
|
|
235
|
+
name: 'fc_bulk_create_posts',
|
|
236
|
+
description: 'Create multiple FluentCommunity posts at once (useful for AI-generated content campaigns)',
|
|
237
|
+
inputSchema: { type: 'object', properties: bulkCreatePostsSchema.shape }
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'fc_bulk_update_posts',
|
|
241
|
+
description: 'Update multiple FluentCommunity posts at once',
|
|
242
|
+
inputSchema: { type: 'object', properties: bulkUpdatePostsSchema.shape }
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'fc_bulk_delete_posts',
|
|
246
|
+
description: 'Delete multiple FluentCommunity posts at once',
|
|
247
|
+
inputSchema: { type: 'object', properties: bulkDeletePostsSchema.shape }
|
|
248
|
+
},
|
|
249
|
+
];
|
|
250
|
+
/**
|
|
251
|
+
* FluentCommunity Tool Handlers
|
|
252
|
+
*/
|
|
253
|
+
export const fluentCommunityHandlers = {
|
|
254
|
+
// ==================== POSTS HANDLERS ====================
|
|
255
|
+
fc_list_posts: async (args) => {
|
|
256
|
+
try {
|
|
257
|
+
const params = {
|
|
258
|
+
per_page: args.limit || 20,
|
|
259
|
+
offset: args.offset || 0,
|
|
260
|
+
};
|
|
261
|
+
if (args.space_id)
|
|
262
|
+
params.space_id = args.space_id;
|
|
263
|
+
if (args.user_id)
|
|
264
|
+
params.user_id = args.user_id;
|
|
265
|
+
if (args.status)
|
|
266
|
+
params.status = args.status;
|
|
267
|
+
if (args.type)
|
|
268
|
+
params.type = args.type;
|
|
269
|
+
if (args.search)
|
|
270
|
+
params.search = args.search;
|
|
271
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/posts', params);
|
|
272
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
fc_get_post: async (args) => {
|
|
279
|
+
try {
|
|
280
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/posts/${args.post_id}`);
|
|
281
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
fc_create_post: async (args) => {
|
|
288
|
+
try {
|
|
289
|
+
const postData = {
|
|
290
|
+
space_id: args.space_id,
|
|
291
|
+
user_id: args.user_id,
|
|
292
|
+
message: args.message,
|
|
293
|
+
type: args.type || 'text',
|
|
294
|
+
status: args.status || 'published',
|
|
295
|
+
privacy: args.privacy || 'public',
|
|
296
|
+
};
|
|
297
|
+
if (args.title)
|
|
298
|
+
postData.title = args.title;
|
|
299
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/posts', postData);
|
|
300
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
fc_update_post: async (args) => {
|
|
307
|
+
try {
|
|
308
|
+
const { post_id, ...updateData } = args;
|
|
309
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/posts/${post_id}`, updateData);
|
|
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
|
+
fc_delete_post: async (args) => {
|
|
317
|
+
try {
|
|
318
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/posts/${args.post_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
|
+
// ==================== SPACES HANDLERS ====================
|
|
326
|
+
fc_list_spaces: async (args) => {
|
|
327
|
+
try {
|
|
328
|
+
const params = { per_page: args.limit || 20 };
|
|
329
|
+
if (args.status)
|
|
330
|
+
params.status = args.status;
|
|
331
|
+
if (args.privacy)
|
|
332
|
+
params.privacy = args.privacy;
|
|
333
|
+
if (args.search)
|
|
334
|
+
params.search = args.search;
|
|
335
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/spaces', params);
|
|
336
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
fc_get_space: async (args) => {
|
|
343
|
+
try {
|
|
344
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/spaces/${args.space_id}`);
|
|
345
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
fc_create_space: async (args) => {
|
|
352
|
+
try {
|
|
353
|
+
const spaceData = {
|
|
354
|
+
title: args.title,
|
|
355
|
+
slug: args.slug || args.title.toLowerCase().replace(/\s+/g, '-'),
|
|
356
|
+
privacy: args.privacy || 'public',
|
|
357
|
+
status: args.status || 'active',
|
|
358
|
+
};
|
|
359
|
+
if (args.description)
|
|
360
|
+
spaceData.description = args.description;
|
|
361
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/spaces', spaceData);
|
|
362
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
fc_update_space: async (args) => {
|
|
369
|
+
try {
|
|
370
|
+
const { space_id, ...updateData } = args;
|
|
371
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/spaces/${space_id}`, updateData);
|
|
372
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
// ==================== COMMENTS HANDLERS ====================
|
|
379
|
+
fc_list_comments: async (args) => {
|
|
380
|
+
try {
|
|
381
|
+
const params = { per_page: args.limit || 50 };
|
|
382
|
+
if (args.post_id)
|
|
383
|
+
params.post_id = args.post_id;
|
|
384
|
+
if (args.user_id)
|
|
385
|
+
params.user_id = args.user_id;
|
|
386
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/comments', params);
|
|
387
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
fc_create_comment: async (args) => {
|
|
394
|
+
try {
|
|
395
|
+
const commentData = {
|
|
396
|
+
post_id: args.post_id,
|
|
397
|
+
user_id: args.user_id,
|
|
398
|
+
message: args.message,
|
|
399
|
+
};
|
|
400
|
+
if (args.parent_id)
|
|
401
|
+
commentData.parent_id = args.parent_id;
|
|
402
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/comments', commentData);
|
|
403
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
fc_update_comment: async (args) => {
|
|
410
|
+
try {
|
|
411
|
+
const { comment_id, ...updateData } = args;
|
|
412
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/comments/${comment_id}`, updateData);
|
|
413
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
fc_delete_comment: async (args) => {
|
|
420
|
+
try {
|
|
421
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/comments/${args.comment_id}`);
|
|
422
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
// ==================== SPACE MEMBERS HANDLERS ====================
|
|
429
|
+
fc_list_space_members: async (args) => {
|
|
430
|
+
try {
|
|
431
|
+
const params = {
|
|
432
|
+
per_page: args.limit || 50,
|
|
433
|
+
};
|
|
434
|
+
if (args.status)
|
|
435
|
+
params.status = args.status;
|
|
436
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/spaces/${args.space_id}/members`, params);
|
|
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
|
+
fc_add_space_member: async (args) => {
|
|
444
|
+
try {
|
|
445
|
+
// WordPress endpoint expects URL parameters for POST
|
|
446
|
+
const queryParams = new URLSearchParams({
|
|
447
|
+
user_id: args.user_id.toString(),
|
|
448
|
+
role: args.role || 'member',
|
|
449
|
+
});
|
|
450
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/spaces/${args.space_id}/members?${queryParams.toString()}`);
|
|
451
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
fc_remove_space_member: async (args) => {
|
|
458
|
+
try {
|
|
459
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/spaces/${args.space_id}/members/${args.user_id}`);
|
|
460
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
461
|
+
}
|
|
462
|
+
catch (error) {
|
|
463
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
// ==================== SEARCH & ANALYTICS HANDLERS ====================
|
|
467
|
+
fc_search_content: async (args) => {
|
|
468
|
+
try {
|
|
469
|
+
const params = {
|
|
470
|
+
query: args.query,
|
|
471
|
+
content_type: args.content_type || 'all',
|
|
472
|
+
per_page: args.limit || 20,
|
|
473
|
+
};
|
|
474
|
+
if (args.space_id)
|
|
475
|
+
params.space_id = args.space_id;
|
|
476
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/search', params);
|
|
477
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
478
|
+
}
|
|
479
|
+
catch (error) {
|
|
480
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
fc_get_space_analytics: async (args) => {
|
|
484
|
+
try {
|
|
485
|
+
const params = { space_id: args.space_id };
|
|
486
|
+
if (args.date_from)
|
|
487
|
+
params.date_from = args.date_from;
|
|
488
|
+
if (args.date_to)
|
|
489
|
+
params.date_to = args.date_to;
|
|
490
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/analytics/space', params);
|
|
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
|
+
// ==================== BULK OPERATIONS HANDLERS ====================
|
|
498
|
+
fc_bulk_create_posts: async (args) => {
|
|
499
|
+
try {
|
|
500
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/posts/bulk', { posts: args.posts });
|
|
501
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
fc_bulk_update_posts: async (args) => {
|
|
508
|
+
try {
|
|
509
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/posts/bulk-update', {
|
|
510
|
+
post_ids: args.post_ids,
|
|
511
|
+
updates: args.updates,
|
|
512
|
+
});
|
|
513
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
514
|
+
}
|
|
515
|
+
catch (error) {
|
|
516
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
fc_bulk_delete_posts: async (args) => {
|
|
520
|
+
try {
|
|
521
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/posts/bulk-delete', { post_ids: args.post_ids });
|
|
522
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
};
|