Skip to main content
Glama

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
NameRequiredDescriptionDefault
siteNoThe ID of the WordPress site to target (from mcp-wordpress.config.json). Required if multiple sites are configured.
idYesThe ID of the comment to mark as spam.

Implementation Reference

  • 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)}`);
      }
    }
  • 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),
    },
  • 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.",
      },
    ],

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