wp_spam_comment
Mark WordPress comments as spam to manage unwanted content and maintain site integrity using the MCP WordPress Server.
Instructions
Marks a comment as spam.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | The ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured. | |
| id | Yes | The ID of the comment to mark as spam. |
Implementation Reference
- src/tools/comments.ts:243-254 (handler)The handler function for wp_spam_comment, which updates the comment status to 'spam' using the WordPress client.public async handleSpamComment(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> { const { id } = params as { id: number }; try { const comment = await client.updateComment({ id, status: "spam", }); return `✅ Comment ${comment.id} has been marked as spam.`; } catch (_error) { throw new Error(`Failed to mark comment as spam: ${getErrorMessage(_error)}`); } }
- src/tools/comments.ts:143-155 (registration)The registration of the wp_spam_comment tool in the CommentTools.getTools() array, including schema (parameters) and handler binding.{ name: "wp_spam_comment", description: "Marks a comment as spam.", parameters: [ { name: "id", type: "number", required: true, description: "The ID of the comment to mark as spam.", }, ], handler: this.handleSpamComment.bind(this), },
- src/tools/comments.ts:146-153 (schema)Input schema for wp_spam_comment tool: requires 'id' as number.parameters: [ { name: "id", type: "number", required: true, description: "The ID of the comment to mark as spam.", }, ],