Skip to main content
Glama

getVersionHistory

Retrieve version history for Adobe Experience Manager content paths to track changes and manage content revisions.

Instructions

Get version history for a content path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Core handler implementing the getVersionHistory tool logic: validates path, fetches from AEM .versionhistory.json, parses and structures version info (name, label, created, etc.), sorts newest first, identifies base version, logs, wraps in success response.
    async getVersionHistory(path: string): Promise<VersionHistoryResponse> {
      return safeExecute<VersionHistoryResponse>(async () => {
        if (!isValidContentPath(path)) {
          throw createAEMError(
            AEM_ERROR_CODES.INVALID_PARAMETERS,
            `Invalid content path: ${path}`,
            { path }
          );
        }
    
        try {
          // Get version history using AEM's versioning API
          const response = await this.httpClient.get(`${path}.versionhistory.json`, {
            params: { ':depth': '2' }
          });
    
          const versions: VersionInfo[] = [];
          let baseVersion: string | undefined;
    
          if (response.data && typeof response.data === 'object') {
            Object.entries(response.data).forEach(([key, value]: [string, any]) => {
              if (key === 'jcr:versionLabels') {
                // Handle version labels
                return;
              }
    
              if (value && typeof value === 'object' && value['jcr:frozenNode']) {
                const versionInfo: VersionInfo = {
                  name: key,
                  label: value['jcr:frozenNode']?.['jcr:versionLabel'],
                  created: value['jcr:created'] || new Date().toISOString(),
                  createdBy: value['jcr:createdBy'] || 'unknown',
                  comment: value['jcr:versionComment'],
                  isBaseVersion: value['jcr:isCheckedOut'] === false
                };
    
                if (versionInfo.isBaseVersion) {
                  baseVersion = key;
                }
    
                versions.push(versionInfo);
              }
            });
          }
    
          // Sort versions by creation date (newest first)
          versions.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime());
    
          this.logger.info(`Retrieved version history for path: ${path}`, {
            versionCount: versions.length,
            baseVersion
          });
    
          return createSuccessResponse({
            path,
            versions,
            totalCount: versions.length,
            baseVersion
          }, 'getVersionHistory') as VersionHistoryResponse;
    
        } catch (error: any) {
          throw handleAEMHttpError(error, 'getVersionHistory');
        }
      }, 'getVersionHistory');
    }
  • MCP tool registration defining the getVersionHistory tool with name, description, and input schema requiring 'path' parameter.
    name: 'getVersionHistory',
    description: 'Get version history for a content path',
    inputSchema: {
      type: 'object',
      properties: {
        path: { type: 'string' }
      },
      required: ['path'],
    },
  • MCP server handler case that extracts 'path' from arguments and calls AEMConnector.getVersionHistory, formats result as MCP response.
    case 'getVersionHistory': {
      const path = (args as { path: string }).path;
      const result = await aemConnector.getVersionHistory(path);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • TypeScript interfaces defining input/output schema for getVersionHistory: VersionInfo for each version and VersionHistoryResponse for the full output structure.
    export interface VersionInfo {
      name: string;
      label?: string;
      created: string;
      createdBy: string;
      comment?: string;
      isBaseVersion?: boolean;
    }
    
    export interface VersionHistoryResponse {
      success: boolean;
      operation: string;
      timestamp: string;
      data: {
        path: string;
        versions: VersionInfo[];
        totalCount: number;
        baseVersion?: string;
      };
    }
  • Delegation helper in AEMConnector that forwards getVersionHistory call to the VersionOperations instance.
    async getVersionHistory(path: string) {
      return this.versionOps.getVersionHistory(path);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves version history but doesn't specify what the output includes (e.g., list of versions, timestamps, authors), whether it's read-only or has side effects, or any constraints like permissions or rate limits. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words, making it easy to parse and understand at a glance. It's appropriately sized for a simple tool and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of version history retrieval, lack of annotations, no output schema, and low parameter coverage, the description is incomplete. It doesn't explain what data is returned, how versions are formatted, or any behavioral nuances, making it inadequate for an agent to use the tool effectively without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the description only mentions 'content path' without adding details like format, examples, or constraints (e.g., path syntax, required permissions). It fails to compensate for the low schema coverage, providing minimal semantic value beyond the parameter name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get version history for a content path' clearly states the action (get) and resource (version history) with a specific scope (content path). However, it doesn't distinguish this tool from potential siblings like 'compareVersions' or 'restoreVersion', which also deal with version-related operations, leaving the exact differentiation unclear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare it to siblings such as 'compareVersions' or 'restoreVersion', which could be relevant for version management tasks. Usage is implied by the name but not explicitly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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