Skip to main content
Glama

restoreVersion

Restore content to a specific version in Adobe Experience Manager by providing the content path and version name.

Instructions

Restore content to a specific version

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
versionNameYes

Implementation Reference

  • MCP tool registration for 'restoreVersion' including schema definition
    { name: 'restoreVersion', description: 'Restore content to a specific version', inputSchema: { type: 'object', properties: { path: { type: 'string' }, versionName: { type: 'string' } }, required: ['path', 'versionName'], }, },
  • MCP server CallToolRequestSchema handler that calls AEMConnector.restoreVersion with extracted parameters
    case 'restoreVersion': { const { path, versionName } = args as { path: string; versionName: string }; const result = await aemConnector.restoreVersion(path, versionName); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • AEMConnector method that delegates restoreVersion call to VersionOperations module
    async restoreVersion(path: string, versionName: string) { return this.versionOps.restoreVersion(path, versionName); }
  • Core implementation of restoreVersion: validates inputs, fetches current version, executes POST to AEM /bin/wcm/versioning/restoreVersion, logs action, returns formatted response
    async restoreVersion(path: string, versionName: string): Promise<RestoreVersionResponse> { return safeExecute<RestoreVersionResponse>(async () => { if (!isValidContentPath(path)) { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, `Invalid content path: ${path}`, { path } ); } if (!versionName || typeof versionName !== 'string') { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, 'Version name is required', { versionName } ); } try { // Get current version before restore const versionHistory = await this.getVersionHistory(path); const currentVersion = versionHistory.data.baseVersion; // Restore version using AEM's versioning API const formData = new URLSearchParams(); formData.append('cmd', 'restoreVersion'); formData.append('path', path); formData.append('version', versionName); await this.httpClient.post('/bin/wcm/versioning/restoreVersion', formData, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); this.logger.info(`Restored version for path: ${path}`, { versionName, previousVersion: currentVersion }); return createSuccessResponse({ path, restoredVersion: versionName, previousVersion: currentVersion, restoredAt: new Date().toISOString(), restoredBy: this.config.serviceUser.username }, 'restoreVersion') as RestoreVersionResponse; } catch (error: any) { throw handleAEMHttpError(error, 'restoreVersion'); } }, 'restoreVersion'); }

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