deletePage
Remove a specific page from Adobe Experience Manager by specifying the page path, with an optional force flag to bypass restrictions. Streamlines page deletion using REST/JSON-RPC APIs.
Instructions
Delete a page from AEM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| pagePath | Yes |
Implementation Reference
- Core implementation of deletePage tool. Performs HTTP DELETE on the page path with fallback mechanisms using WCM command and Sling POST delete operations. Includes validation and error handling.async deletePage(request) { return safeExecute(async () => { const { pagePath, force = false } = request; if (!isValidContentPath(pagePath)) { throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, `Invalid page path: ${String(pagePath)}`, { pagePath }); } let deleted = false; try { await this.httpClient.delete(pagePath); deleted = true; } catch (err) { if (err.response && err.response.status === 405) { try { await this.httpClient.post('/bin/wcmcommand', { cmd: 'deletePage', path: pagePath, force: force.toString(), }); deleted = true; } catch (postErr) { try { await this.httpClient.post(pagePath, { ':operation': 'delete' }); deleted = true; } catch (slingErr) { this.logger.error('Sling POST delete failed', { error: slingErr.response?.status, data: slingErr.response?.data }); throw slingErr; } } } else { this.logger.error('DELETE failed', { status: err.response?.status, data: err.response?.data }); throw err; } } return createSuccessResponse({ success: deleted, deletedPath: pagePath, timestamp: new Date().toISOString(), }, 'deletePage'); }, 'deletePage'); }
- dist/mcp-server.js:272-283 (registration)Tool registration in the MCP server's tools list, including name, description, and input schema for listTools request.{ name: 'deletePage', description: 'Delete a page from AEM', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' }, force: { type: 'boolean' }, }, required: ['pagePath'], }, },
- dist/mcp-server.js:697-700 (handler)MCP CallToolRequestSchema handler dispatch for deletePage, forwarding arguments to AEMConnector.deletePage.case 'deletePage': { const result = await aemConnector.deletePage(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- dist/interfaces/index.d.ts:193-196 (schema)TypeScript interface defining the input parameters for deletePage request.export interface DeletePageRequest { pagePath: string; force?: boolean; }
- dist/aem-connector-new.js:73-74 (handler)Delegation handler in AEMConnector that routes deletePage calls to the PageOperations module.async deletePage(request) { return this.pageOps.deletePage(request);