fc_list_posts
Retrieve and filter community posts by space, user, status, type, or search terms to manage content effectively.
Instructions
List all posts from FluentCommunity with optional filtering
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | No | Filter posts by space ID | |
| user_id | No | Filter posts by user ID | |
| status | No | Filter by status (published, draft, etc.) | |
| type | No | Filter by post type (text, video, etc.) | |
| limit | No | Number of posts to return (default: 20) | |
| offset | No | Offset for pagination (default: 0) | |
| search | No | Search term to filter posts |
Implementation Reference
- src/tools/fluent-community.ts:289-307 (handler)Handler function for fc_list_posts tool that makes a GET request to the WordPress API endpoint 'fc-manager/v1/posts' with filtering parameters and returns the response.
fc_list_posts: async (args: any) => { try { const params: any = { per_page: args.limit || 20, offset: args.offset || 0, }; if (args.space_id) params.space_id = args.space_id; if (args.user_id) params.user_id = args.user_id; if (args.status) params.status = args.status; if (args.type) params.type = args.type; if (args.search) params.search = args.search; const response = await makeWordPressRequest('GET', 'fc-manager/v1/posts', params); 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:12-20 (schema)Zod schema defining input parameters for the fc_list_posts tool, including optional filters like space_id, user_id, status, type, limit, offset, and search.
const listPostsSchema = z.object({ space_id: z.number().optional().describe('Filter posts by space ID'), user_id: z.number().optional().describe('Filter posts by user ID'), status: z.enum(['published', 'draft', 'pending', 'archived']).optional().describe('Filter by status'), type: z.string().optional().describe('Filter by post type (text, video, etc.)'), limit: z.number().optional().default(20).describe('Number of posts to return'), offset: z.number().optional().default(0).describe('Offset for pagination'), search: z.string().optional().describe('Search term to filter posts') }); - src/tools/fluent-community.ts:168-171 (registration)Tool registration object in fluentCommunityTools array, defining the name, description, and inputSchema for fc_list_posts.
name: 'fc_list_posts', description: 'List all posts from FluentCommunity with optional filtering', inputSchema: { type: 'object', properties: listPostsSchema.shape } },