deleteVersion
Remove specific versions of content in Adobe Experience Manager by specifying the path and version name to manage repository space and content history.
Instructions
Delete a specific version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| versionName | Yes |
Implementation Reference
- src/mcp-server.ts:564-576 (registration)MCP tool registration for 'deleteVersion' including input schema definition (path and versionName required).{ name: 'deleteVersion', description: 'Delete a specific version', inputSchema: { type: 'object', properties: { path: { type: 'string' }, versionName: { type: 'string' } }, required: ['path', 'versionName'], }, }, ];
- src/mcp-server.ts:812-816 (handler)Primary MCP server handler for the 'deleteVersion' tool: extracts parameters from MCP request, delegates to AEMConnector.deleteVersion, and formats response.case 'deleteVersion': { const { path, versionName } = args as { path: string; versionName: string }; const result = await aemConnector.deleteVersion(path, versionName); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/aem-connector-new.ts:289-291 (handler)AEMConnector method that delegates deleteVersion call to the VersionOperations module.async deleteVersion(path: string, versionName: string) { return this.versionOps.deleteVersion(path, versionName); }
- Core implementation of deleteVersion: validates inputs, constructs form data with cmd='deleteVersion', posts to AEM versioning endpoint '/bin/wcm/versioning/deleteVersion', logs, and returns structured success response.async deleteVersion(path: string, versionName: string): Promise<DeleteVersionResponse> { return safeExecute<DeleteVersionResponse>(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 { // Delete version using AEM's versioning API const formData = new URLSearchParams(); formData.append('cmd', 'deleteVersion'); formData.append('path', path); formData.append('version', versionName); await this.httpClient.post('/bin/wcm/versioning/deleteVersion', formData, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); this.logger.info(`Deleted version for path: ${path}`, { versionName }); return createSuccessResponse({ path, deletedVersion: versionName, deletedAt: new Date().toISOString(), deletedBy: this.config.serviceUser.username }, 'deleteVersion') as DeleteVersionResponse; } catch (error: any) { throw handleAEMHttpError(error, 'deleteVersion'); } }, 'deleteVersion'); }