Skip to main content
Glama

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
NameRequiredDescriptionDefault
deactivateTreeNo
pagePathYes

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'); }
  • 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'], }, },
  • 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) }] }; }
  • AEMConnector proxy method that delegates deactivatePage call to the PageOperations module.
    async deactivatePage(request) { return this.pageOps.deactivatePage(request); }
  • 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'], }, },

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/indrasishbanerjee/aem-mcp-server'

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