Skip to main content
Glama

scanPageComponents

Scan a page to identify all components and their properties for analysis or troubleshooting in Adobe Experience Manager, using the AEM MCP Server REST/JSON-RPC APIs.

Instructions

Scan a page to discover all components and their properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pagePathYes

Implementation Reference

  • Main handler function that implements the scanPageComponents tool logic: recursively traverses the page's JCR structure from .infinity.json to find all components.
    async scanPageComponents(pagePath: string): Promise<ScanComponentsResponse> { return safeExecute<ScanComponentsResponse>(async () => { const response = await this.httpClient.get(`${pagePath}.infinity.json`); const components: Array<{ path: string; resourceType: string; properties: Record<string, unknown>; }> = []; const processNode = (node: any, nodePath: string) => { if (!node || typeof node !== 'object') return; if (node['sling:resourceType']) { components.push({ path: nodePath, resourceType: node['sling:resourceType'], properties: { ...node }, }); } Object.entries(node).forEach(([key, value]) => { if (typeof value === 'object' && value !== null && !key.startsWith('rep:') && !key.startsWith('oak:')) { const childPath = nodePath ? `${nodePath}/${key}` : key; processNode(value, childPath); } }); }; if (response.data['jcr:content']) { processNode(response.data['jcr:content'], 'jcr:content'); } else { processNode(response.data, pagePath); } return createSuccessResponse({ pagePath, components, totalComponents: components.length, }, 'scanPageComponents') as ScanComponentsResponse; }, 'scanPageComponents'); }
  • MCP server dispatches tool calls to the aemConnector.scanPageComponents method.
    case 'scanPageComponents': { const pagePath = (args as { pagePath: string }).pagePath; const result = await aemConnector.scanPageComponents(pagePath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • Tool registration including name, description, and input schema (requires pagePath: string).
    name: 'scanPageComponents', description: 'Scan a page to discover all components and their properties', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' }, }, required: ['pagePath'], }, },
  • Type definition for the ScanComponentsResponse returned by the tool.
    export interface ScanComponentsResponse extends BaseResponse { data: { pagePath: string; components: Array<{ path: string; resourceType: string; properties: Record<string, unknown>; }>; totalComponents: number; }; }
  • Alternative handler registration in MCPRequestHandler switch statement.
    case 'scanPageComponents': return await this.aemConnector.scanPageComponents(params.pagePath);

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