Skip to main content
Glama

wp_delete_comment

Delete WordPress comments by ID, either permanently or by moving to trash, to manage site content and moderation.

Instructions

Deletes a comment.

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 delete.
forceNoIf true, the comment will be permanently deleted. Defaults to false (moved to trash).

Implementation Reference

  • MCP tool handler that extracts parameters, calls WordPressClient.deleteComment(id, force), handles errors, and returns a formatted success or error message.
    public async handleDeleteComment(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const { id, force } = params as { id: number; force?: boolean };
      try {
        await client.deleteComment(id, force);
        const action = force ? "permanently deleted" : "moved to trash";
        return `✅ Comment ${id} has been ${action}`;
      } catch (_error) {
        throw new Error(`Failed to delete comment: ${getErrorMessage(_error)}`);
      }
    }
  • Tool definition in CommentTools.getTools() including name, description, input parameters schema, and handler reference.
    {
      name: "wp_delete_comment",
      description: "Deletes a comment.",
      parameters: [
        {
          name: "id",
          type: "number",
          required: true,
          description: "The ID of the comment to delete.",
        },
        {
          name: "force",
          type: "boolean",
          description: "If true, the comment will be permanently deleted. Defaults to false (moved to trash).",
        },
      ],
      handler: this.handleDeleteComment.bind(this),
    },
  • Server-level MCP tool registration: imports all tool classes from '@/tools/index.js' (includes CommentTools), instantiates them, calls getTools() to get definitions like wp_delete_comment, builds Zod input schemas, and registers handlers with McpServer.tool().
    public registerAllTools(): void {
      // Register all tools from the tools directory
      Object.values(Tools).forEach((ToolClass) => {
        let toolInstance: { getTools(): unknown[] };
    
        // Cache and Performance tools need the clients map
        if (ToolClass.name === "CacheTools" || ToolClass.name === "PerformanceTools") {
          toolInstance = new ToolClass(this.wordpressClients);
        } else {
          toolInstance = new (ToolClass as new () => { getTools(): unknown[] })();
        }
    
        const tools = toolInstance.getTools();
    
        tools.forEach((tool: unknown) => {
          this.registerTool(tool as ToolDefinition);
        });
      });
  • CommentsOperations.deleteComment: Performs the actual HTTP DELETE request via base client to WordPress REST API endpoint `/wp-json/wp/v2/comments/${id}?force=${force}`.
    async deleteComment(id: number, force = false): Promise<{ deleted: boolean; previous?: WordPressComment }> {
      return this.client.delete(`comments/${id}?force=${force}`);
    }
  • WordPressClient.deleteComment: Delegates comment deletion to the modular commentsOps instance for clean separation of concerns.
    async deleteComment(id: number, force = false): Promise<{ deleted: boolean; previous?: WordPressComment }> {
      return this.commentsOps.deleteComment(id, force);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'deletes' implies a destructive mutation, it doesn't specify important behavioral details: whether deletion requires specific permissions, what happens to associated data, if the action is reversible, or what the response looks like. The description adds minimal context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise at just three words. It's front-loaded with the essential action and resource, with zero wasted words. Every element earns its place in this minimal but complete statement of function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address important contextual aspects: what permissions are needed, whether the action is reversible, what happens to the comment data, or what the tool returns. The combination of a destructive operation with minimal description creates significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing complete documentation for all three parameters. The description adds no additional parameter information beyond what's already in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('deletes') and resource ('a comment'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling deletion tools like wp_delete_category or wp_delete_post, which follow the same pattern but target different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like wp_spam_comment or wp_update_comment that might be relevant alternatives, nor does it specify prerequisites such as needing comment deletion permissions or when deletion versus updating might be appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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