Skip to main content
Glama

scanPageComponents

Analyze an Adobe Experience Manager page to identify all components and their properties for content management and automation workflows.

Instructions

Scan a page to discover all components and their properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pagePathYes

Implementation Reference

  • The primary handler function for the scanPageComponents tool. It retrieves the full page structure using .infinity.json, recursively traverses the JCR content tree to identify all components (nodes with sling:resourceType property), extracts their paths, resource types, and properties, and returns a structured ScanComponentsResponse.
    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 tool registration in the tools array. Defines the tool name, description, and input schema (pagePath: string). This array is returned by the ListToolsRequestHandler.
      name: 'scanPageComponents',
      description: 'Scan a page to discover all components and their properties',
      inputSchema: {
        type: 'object',
        properties: {
          pagePath: { type: 'string' },
        },
        required: ['pagePath'],
      },
    },
  • MCP server request handler switch case that receives the tool call, extracts pagePath from arguments, invokes aemConnector.scanPageComponents(pagePath), and formats the response as MCP content.
    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) }] };
    }
  • TypeScript interface defining the output shape of scanPageComponents: ScanComponentsResponse extending BaseResponse with pagePath, array of components (path, resourceType, properties), and totalComponents count. (Lines approximated from search matches)
    export interface ScanComponentsResponse extends BaseResponse {

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