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
| Name | Required | Description | Default |
|---|---|---|---|
| templatePath | Yes |
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'); }
- dist/mcp-server.js:397-404 (schema)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'], }, },
- dist/mcp-server.js:738-742 (handler)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) }] }; }
- dist/aem-connector-new.js:149-151 (helper)Delegation method in AEMConnector class that forwards getTemplateStructure call to the TemplateOperations module.async getTemplateStructure(templatePath) { return this.templateOps.getTemplateStructure(templatePath); }
- dist/mcp-server.js:567-569 (registration)Registers the listTools handler that returns the full tools array including getTemplateStructure schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });