deactivatePage
Unpublish a specific page or its associated content tree in Adobe Experience Manager using the AEM MCP Server for efficient content management.
Instructions
Deactivate (unpublish) a single page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deactivateTree | No | ||
| pagePath | Yes |
Implementation Reference
- Core handler function that performs the page deactivation by calling AEM's replication API (/bin/replicate.json with cmd='Deactivate') or fallback to WCM command, includes validation, tree option, and error handling.async deactivatePage(request) { return safeExecute(async () => { const { pagePath, deactivateTree = false } = request; if (!isValidContentPath(pagePath)) { throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, `Invalid page path: ${String(pagePath)}`, { pagePath }); } try { // Use the correct AEM replication servlet endpoint const formData = new URLSearchParams(); formData.append('cmd', 'Deactivate'); formData.append('path', pagePath); formData.append('ignoredeactivated', 'false'); formData.append('onlymodified', 'false'); if (deactivateTree) { formData.append('deep', 'true'); } const response = await this.httpClient.post('/bin/replicate.json', formData, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); return createSuccessResponse({ success: true, deactivatedPath: pagePath, deactivateTree, response: response.data, timestamp: new Date().toISOString(), }, 'deactivatePage'); } catch (error) { // Fallback to alternative replication methods try { const wcmResponse = await this.httpClient.post('/bin/wcmcommand', { cmd: 'deactivate', path: pagePath, ignoredeactivated: false, onlymodified: false, }); return createSuccessResponse({ success: true, deactivatedPath: pagePath, deactivateTree, response: wcmResponse.data, fallbackUsed: 'WCM Command', timestamp: new Date().toISOString(), }, 'deactivatePage'); } catch (fallbackError) { throw handleAEMHttpError(error, 'deactivatePage'); } } }, 'deactivatePage'); }
- dist/mcp-server.js:336-346 (registration)MCP tool registration: defines the tool name, description, and input schema (pagePath required, deactivateTree optional). This is returned by ListToolsRequestHandler.name: 'deactivatePage', description: 'Deactivate (unpublish) a single page', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' }, deactivateTree: { type: 'boolean' }, }, required: ['pagePath'], }, },
- dist/mcp-server.js:717-720 (handler)MCP server dispatch handler: calls aemConnector.deactivatePage(args) and formats response for MCP protocol.case 'deactivatePage': { const result = await aemConnector.deactivatePage(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- dist/aem-connector-new.js:88-90 (helper)AEMConnector proxy method that delegates deactivatePage call to the PageOperations module.async deactivatePage(request) { return this.pageOps.deactivatePage(request); }
- dist/mcp-server.js:338-346 (schema)Input schema definition for the deactivatePage tool: object with pagePath (string, required) and deactivateTree (boolean, optional).inputSchema: { type: 'object', properties: { pagePath: { type: 'string' }, deactivateTree: { type: 'boolean' }, }, required: ['pagePath'], }, },