Skip to main content
Glama

wp_update_comment

Modify existing WordPress comments by updating content or changing status using the MCP WordPress Server tool.

Instructions

Updates an existing 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 update.
contentNoThe updated content for the comment.
statusNoThe new status for the comment.

Implementation Reference

  • The handler function implementing the core logic of the 'wp_update_comment' tool. It casts input parameters to UpdateCommentRequest type, invokes the WordPress client's updateComment method, and returns a success message or throws an error.
    public async handleUpdateComment(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      try {
        const updateParams = params as unknown as UpdateCommentRequest & { id: number };
        const comment = await client.updateComment(updateParams);
        return `✅ Comment ${comment.id} updated successfully. New status: ${comment.status}.`;
      } catch (_error) {
        throw new Error(`Failed to update comment: ${getErrorMessage(_error)}`);
      }
    }
  • Registration of the 'wp_update_comment' MCP tool in CommentTools.getTools(), defining name, description, input parameters schema, and binding to the handler function.
    {
      name: "wp_update_comment",
      description: "Updates an existing comment.",
      parameters: [
        {
          name: "id",
          type: "number",
          required: true,
          description: "The ID of the comment to update.",
        },
        {
          name: "content",
          type: "string",
          description: "The updated content for the comment.",
        },
        {
          name: "status",
          type: "string",
          description: "The new status for the comment.",
          enum: ["hold", "approve", "spam", "trash"],
        },
      ],
      handler: this.handleUpdateComment.bind(this),
    },
  • TypeScript interface UpdateCommentRequest defining the structure for comment update data, used for type safety in the tool handler. Extends CreateCommentRequest partially, adds required 'id' and optional 'status'.
    export interface UpdateCommentRequest extends Partial<Omit<CreateCommentRequest, "status">> {
      id: number;
      status?: "approved" | "unapproved" | "spam" | "trash";
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action ('Updates') without behavioral details. It doesn't mention authentication requirements, permission levels needed, whether changes are reversible, error conditions, or what the tool returns. For a mutation tool with zero annotation coverage, this is inadequate.

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 a single, efficient sentence with no wasted words. It's appropriately sized for a simple update operation and gets straight to the point without unnecessary elaboration.

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 mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, what permissions are required, or how it differs from related comment modification tools. Given the complexity of updating a database record and the lack of structured behavioral information, more context is needed.

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?

Schema description coverage is 100%, so the schema already documents all four parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. According to guidelines, when schema 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.

Purpose3/5

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

The description states the verb ('Updates') and resource ('an existing comment'), making the basic purpose clear. However, it lacks specificity about what fields can be updated and doesn't differentiate from sibling tools like wp_spam_comment or wp_approve_comment that also modify comment status. The description is functional but minimal.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention wp_approve_comment or wp_spam_comment for specific status changes, or wp_get_comment for checking current state before updating. The description offers no context about prerequisites or typical use cases.

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