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
| Name | Required | Description | Default |
|---|---|---|---|
| pagePath | Yes |
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'); }
- src/mcp-server.ts:611-614 (registration)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) }] };
- src/mcp-server.ts:67-76 (schema)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'], }, },
- dist/interfaces/index.d.ts:373-383 (schema)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; }; }
- src/mcp-handler.ts:19-20 (registration)Alternative handler registration in MCPRequestHandler switch statement.case 'scanPageComponents': return await this.aemConnector.scanPageComponents(params.pagePath);