Skip to main content
Glama

wp_get_comment

Retrieve a specific WordPress comment by its unique ID to access comment details, moderate content, or analyze user feedback. Use this tool to fetch individual comments from your WordPress site for review or management purposes.

Instructions

Retrieves a single comment by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe unique identifier for the comment.

Implementation Reference

  • Tool registration definition in CommentTools.getTools() method, including name, description, input parameters schema, and binding to the handler function.
    { name: "wp_get_comment", description: "Retrieves a single comment by its ID.", parameters: [ { name: "id", type: "number", required: true, description: "The unique identifier for the comment.", }, ], handler: this.handleGetComment.bind(this), },
  • The main handler function that implements the wp_get_comment tool logic: extracts comment ID, fetches comment via WordPressClient, formats details, and returns formatted string or throws error.
    public async handleGetComment(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { try { const { id } = params as { id: number }; const comment = await client.getComment(id); const content = `**Comment Details (ID: ${comment.id})**\n\n` + `- **Author:** ${comment.author_name}\n` + `- **Post ID:** ${comment.post}\n` + `- **Date:** ${new Date(comment.date).toLocaleString()}\n` + `- **Status:** ${comment.status}\n` + `- **Content:** ${comment.content.rendered}`; return content; } catch (_error) { throw new Error(`Failed to get comment: ${getErrorMessage(_error)}`); } }

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/docdyhr/mcp-wordpress'

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