Skip to main content
Glama

wp_delete_page

Delete a WordPress page by ID, either permanently or by moving it to trash, for managing site content.

Instructions

Deletes a page.

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 page to delete.
forceNoIf true, permanently delete. If false, move to trash. Defaults to false.

Implementation Reference

  • The handler function that implements the core logic of the wp_delete_page tool. It calls the WordPressClient's deletePage method and formats the response.
    public async handleDeletePage(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
      const { id, force } = params as { id: number; force?: boolean };
      try {
        await client.deletePage(id, force);
        const action = params.force ? "permanently deleted" : "moved to trash";
        return `✅ Page ${id} has been ${action}.`;
      } catch (_error) {
        throw new Error(`Failed to delete page: ${getErrorMessage(_error)}`);
      }
  • The tool definition in PageTools.getTools(), which registers the wp_delete_page tool with its schema (parameters), description, and handler reference. This array is consumed by the ToolRegistry.
    {
      name: "wp_delete_page",
      description: "Deletes a page.",
      parameters: [
        {
          name: "id",
          type: "number",
          required: true,
          description: "The ID of the page to delete.",
        },
        {
          name: "force",
          type: "boolean",
          description: "If true, permanently delete. If false, move to trash. Defaults to false.",
        },
      ],
      handler: this.handleDeletePage.bind(this),
    },
  • Registers all tool classes from src/tools/index.ts, including PageTools containing wp_delete_page, by calling getTools() and registering each tool with the MCP server.
    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);
        });
      });
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Deletes a page' implies a destructive mutation but doesn't specify whether this requires admin permissions, whether deletion is permanent or reversible, what happens to associated content, or what the response looks like. The description mentions nothing about error conditions, rate limits, or side effects 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 extremely concise at just two words ('Deletes a page'), which efficiently communicates the core purpose without any wasted language. It's front-loaded with the essential information, though this brevity comes at the cost of missing important contextual details.

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 inadequate. It doesn't explain what happens after deletion, what permissions are required, whether the action can be undone, or what the return value looks like. Given the complexity of a deletion operation in WordPress (with trash functionality, permissions, and potential side effects), the description should provide more complete context.

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, with all three parameters (site, id, force) well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline of 3 where the schema does the heavy lifting for parameter documentation.

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 'Deletes a page' clearly states the action (delete) and resource (page), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like wp_delete_post or wp_delete_media, which perform similar deletion operations on different resource types.

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 when to choose wp_delete_page over wp_delete_post (for deleting posts instead of pages) or wp_delete_media (for deleting media files), nor does it discuss prerequisites like authentication or permissions needed for deletion operations.

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