fc_create_comment
Add comments to posts in FluentCommunity WordPress plugin by specifying post ID, user ID, and message content to facilitate community discussions.
Instructions
Create a new comment on a post
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_id | Yes | The post ID to comment on | |
| user_id | Yes | The user ID creating the comment | |
| message | Yes | Comment message | |
| parent_id | No | Parent comment ID for replies |
Implementation Reference
- src/tools/fluent-community.ts:425-440 (handler)The async handler function that executes the fc_create_comment tool, sending a POST request to the WordPress API to create a new comment on a post.fc_create_comment: async (args: any) => { try { const commentData: any = { post_id: args.post_id, user_id: args.user_id, message: args.message, }; if (args.parent_id) commentData.parent_id = args.parent_id; const response = await makeWordPressRequest('POST', 'fc-manager/v1/comments', commentData); return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } }; } catch (error: any) { return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } }; } },
- src/tools/fluent-community.ts:81-85 (schema)Zod input schema defining the parameters for the fc_create_comment tool: post_id, user_id, and message.const createCommentSchema = z.object({ post_id: z.number().describe('The post ID to comment on'), user_id: z.number().describe('The user ID who creates the comment'), message: z.string().describe('Comment content') });
- src/tools/fluent-community.ts:221-225 (registration)Tool registration object for fc_create_comment in the fluentCommunityTools array, including name, description, and input schema reference.{ name: 'fc_create_comment', description: 'Create a new comment on a FluentCommunity post', inputSchema: { type: 'object', properties: createCommentSchema.shape } },