Skip to main content
Glama

getTemplateStructure

Retrieve the detailed structure of an Adobe Experience Manager template by providing its path to analyze components and layout.

Instructions

Get detailed structure of a specific template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templatePathYes

Implementation Reference

  • Core implementation of getTemplateStructure: Fetches template .infinity.json from AEM, parses properties, policies, structure, initial content, recursively extracts allowed components, and returns formatted structure.
    async getTemplateStructure(templatePath) {
        return safeExecute(async () => {
            try {
                // Get the full template structure with deeper depth
                const response = await this.httpClient.get(`${templatePath}.infinity.json`);
                const structure = {
                    path: templatePath,
                    properties: response.data['jcr:content'] || {},
                    policies: response.data['jcr:content']?.['policies'] || {},
                    structure: response.data['jcr:content']?.['structure'] || {},
                    initialContent: response.data['jcr:content']?.['initial'] || {},
                    allowedComponents: [],
                    allowedPaths: response.data['jcr:content']?.['allowedPaths'] || []
                };
                // Extract allowed components from policies
                const extractComponents = (node, path = '') => {
                    if (!node || typeof node !== 'object')
                        return;
                    if (node['components']) {
                        const componentKeys = Object.keys(node['components']);
                        structure.allowedComponents.push(...componentKeys);
                    }
                    Object.entries(node).forEach(([key, value]) => {
                        if (typeof value === 'object' && value !== null && !key.startsWith('jcr:')) {
                            extractComponents(value, path ? `${path}/${key}` : key);
                        }
                    });
                };
                extractComponents(structure.policies);
                // Remove duplicates
                structure.allowedComponents = [...new Set(structure.allowedComponents)];
                return createSuccessResponse({
                    templatePath,
                    structure,
                    fullData: response.data
                }, 'getTemplateStructure');
            }
            catch (error) {
                throw handleAEMHttpError(error, 'getTemplateStructure');
            }
        }, 'getTemplateStructure');
    }
  • MCP tool schema definition for getTemplateStructure, specifying input as object with required templatePath string.
        name: 'getTemplateStructure',
        description: 'Get detailed structure of a specific template',
        inputSchema: {
            type: 'object',
            properties: { templatePath: { type: 'string' } },
            required: ['templatePath'],
        },
    },
  • MCP CallToolRequest handler case for getTemplateStructure: extracts templatePath from args, calls AEMConnector, returns JSON stringified result.
    case 'getTemplateStructure': {
        const templatePath = args.templatePath;
        const result = await aemConnector.getTemplateStructure(templatePath);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Delegation method in AEMConnector class that forwards getTemplateStructure call to the TemplateOperations module.
    async getTemplateStructure(templatePath) {
        return this.templateOps.getTemplateStructure(templatePath);
    }
  • Registers the listTools handler that returns the full tools array including getTemplateStructure schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
        return { 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