Skip to main content
Glama
gaupoit

WordPress MCP Server

by gaupoit

wp_delete_post

Remove WordPress posts by ID, either moving them to trash or permanently deleting them based on the force parameter setting.

Instructions

Delete a WordPress post.

Args:
    post_id: The ID of the post to delete.
    force: If False (default), moves to trash. If True, permanently deletes.

Returns:
    Confirmation with id, deleted status, and previous post info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes
forceNo

Implementation Reference

  • The main handler function for the 'wp_delete_post' tool. It is decorated with @mcp.tool() which also serves as the registration mechanism in FastMCP. The function retrieves the WordPress client and calls its delete_post method.
    @mcp.tool()
    def wp_delete_post(post_id: int, force: bool = False) -> dict:
        """Delete a WordPress post.
    
        Args:
            post_id: The ID of the post to delete.
            force: If False (default), moves to trash. If True, permanently deletes.
    
        Returns:
            Confirmation with id, deleted status, and previous post info.
        """
        client = get_client()
        return client.delete_post(post_id=post_id, force=force)
  • The supporting method in WordPressClient that performs the actual deletion via WordPress REST API using the _delete helper, handling the force parameter and formatting the response.
    def delete_post(self, post_id: int, force: bool = False) -> dict:
        """Delete a post. If force=False, moves to trash. If force=True, permanently deletes."""
        params = {"force": force}
        result = self._delete(f"posts/{post_id}", params)
    
        return {
            "id": result.get("id", post_id),
            "deleted": True,
            "previous": {
                "title": result.get("title", {}).get("rendered", ""),
                "status": result.get("status", ""),
            } if "title" in result else None,
        }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: the destructive nature of the operation, the trash vs permanent deletion behavior based on force parameter, and what information is returned. It doesn't mention authentication requirements or rate limits, but covers the core mutation behavior adequately.

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 efficiently structured with clear sections (Args, Returns), uses minimal sentences that each earn their place, and is appropriately sized for a 2-parameter destructive operation. No wasted words.

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

Completeness4/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 provides good coverage: purpose, parameter semantics, and return information. It could mention authentication requirements or error cases, but given the tool's relative simplicity, it's mostly complete.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by explaining both parameters: post_id's purpose and force's behavior (default false moves to trash, true permanently deletes). It adds crucial semantic meaning beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Delete') and target resource ('a WordPress post'), distinguishing it from sibling tools like wp_create_post and wp_update_post. It's not a tautology of the name and provides unambiguous purpose.

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

Usage Guidelines4/5

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

The description implies usage context through the force parameter explanation (trash vs permanent deletion), but doesn't explicitly state when to use this tool versus alternatives like wp_update_post or other deletion methods. It provides clear operational guidance but lacks sibling differentiation.

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

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