Skip to main content
Glama

delete_page

Remove a specific page from WordPress using its ID, with an option to force deletion bypassing the trash. Returns a boolean indicating success.

Instructions

Deletes a specific page from WordPress, it will return a boolean value to indicate if the deletion was successful.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoWhether to bypass the trash and force deletion. Defaults to false.
pageIdYesThe ID of the page to delete.

Implementation Reference

  • The inline handler function for the MCP 'delete_page' tool. It invokes the deletePage helper from wp-api.js and returns a success response.
    async (input) => { // Handler await deletePage(input.pageId, input.force); return { content: [ { type: "text", text: "true", }, ], }; }
  • Zod input schema defining parameters for the delete_page tool: pageId (required number) and force (optional boolean, default false).
    { // Input Schema: Use plain object with Zod types pageId: z .number() .int() .positive() .describe("The ID of the page to delete."), force: z .boolean() .optional() .default(false) .describe( "Whether to bypass the trash and force deletion. Defaults to false." ), },
  • src/index.js:226-256 (registration)
    Registration of the 'delete_page' tool on the MCP server using server.tool(), including description, input schema, and handler function.
    server.tool( "delete_page", "Deletes a specific page from WordPress, it will return a boolean value to indicate if the deletion was successful.", { // Input Schema: Use plain object with Zod types pageId: z .number() .int() .positive() .describe("The ID of the page to delete."), force: z .boolean() .optional() .default(false) .describe( "Whether to bypass the trash and force deletion. Defaults to false." ), }, async (input) => { // Handler await deletePage(input.pageId, input.force); return { content: [ { type: "text", text: "true", }, ], }; } );
  • Helper function that performs the actual page deletion via WordPress REST API delete endpoint, called by the tool handler.
    async function deletePage(pageId, force = true) { const client = getApiClient(); const response = await client.delete(`/wp-json/wp/v2/pages/${pageId}?force=${force}`); // WP delete usually returns the object before deletion or a specific structure return response.data; }

Other Tools

Related 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/aguaitech/Elementor-MCP'

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