Skip to main content
Glama

wpnav_list_comments

Retrieve and filter WordPress comments by status, post ID, or pagination to manage comment moderation and organization.

Instructions

List WordPress comments with optional filtering. Returns comment ID, author, content, and status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (default: 1)
per_pageNoNumber of comments to return (default: 10, max: 100)
statusNoFilter by status: approve, hold, spam, trash, any
postNoFilter by post ID

Implementation Reference

  • The core handler function for the wpnav_list_comments tool. It validates pagination parameters, constructs a query string for filtering, fetches comments from the WordPress REST API (/wp/v2/comments), extracts a summary of relevant fields (id, author_name, content, status, post, date), and returns a formatted JSON response.
    handler: async (args, context) => { const { page, per_page } = validatePagination(args); const qs = buildQueryString({ page, per_page, status: args.status, post: args.post }); const comments = await context.wpRequest(`/wp/v2/comments?${qs}`); const summary = comments.map((c: any) => extractSummary(c, ['id', 'author_name', 'content.rendered', 'status', 'post', 'date'])); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; },
  • Input schema defining the parameters for the wpnav_list_comments tool: pagination (page, per_page), status filter, and post filter.
    inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination (default: 1)' }, per_page: { type: 'number', description: 'Number of comments to return (default: 10, max: 100)' }, status: { type: 'string', enum: ['approve', 'hold', 'spam', 'trash', 'any'], description: 'Filter by status: approve, hold, spam, trash, any' }, post: { type: 'number', description: 'Filter by post ID' }, }, required: [], },
  • Full tool registration block including name, description, input schema, handler function, and category for wpnav_list_comments.
    toolRegistry.register({ definition: { name: 'wpnav_list_comments', description: 'List WordPress comments with optional filtering. Returns comment ID, author, content, and status.', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination (default: 1)' }, per_page: { type: 'number', description: 'Number of comments to return (default: 10, max: 100)' }, status: { type: 'string', enum: ['approve', 'hold', 'spam', 'trash', 'any'], description: 'Filter by status: approve, hold, spam, trash, any' }, post: { type: 'number', description: 'Filter by post ID' }, }, required: [], }, }, handler: async (args, context) => { const { page, per_page } = validatePagination(args); const qs = buildQueryString({ page, per_page, status: args.status, post: args.post }); const comments = await context.wpRequest(`/wp/v2/comments?${qs}`); const summary = comments.map((c: any) => extractSummary(c, ['id', 'author_name', 'content.rendered', 'status', 'post', 'date'])); return { content: [{ type: 'text', text: context.clampText(JSON.stringify(summary, null, 2)) }], }; }, category: ToolCategory.CONTENT, });
  • Static schema definition for wpnav_list_comments in the tools list, likely used for MCP protocol exposure or TypeScript types.
    { name: 'wpnav_list_comments', description: 'List WordPress comments with optional filtering. Returns comment ID, author, content, and status.', inputSchema: { type: 'object' as const, properties: { per_page: { type: 'number' as const, description: 'Number of comments to return (default: 10, max: 100)', default: 10, }, page: { type: 'number' as const, description: 'Page number for pagination (default: 1)', default: 1, }, status: { type: 'string' as const, description: 'Filter by status: approve, hold, spam, trash, any', enum: ['approve', 'hold', 'spam', 'trash', 'any'], }, post: { type: 'number' as const, description: 'Filter by post ID', }, }, required: [], },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/littlebearapps/wp-navigator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server