Skip to main content
Glama

listPages

Retrieve all pages from an Adobe Experience Manager site root, with options to control depth and limit results for content management.

Instructions

List all pages under a site root

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteRootNo
depthNo
limitNo

Implementation Reference

  • Registration of the 'listPages' MCP tool including name, description, and input schema.
    {
        name: 'listPages',
        description: 'List all pages under a site root',
        inputSchema: {
            type: 'object',
            properties: {
                siteRoot: { type: 'string' },
                depth: { type: 'number' },
                limit: { type: 'number' },
            },
        },
    },
  • MCP server handler for 'listPages' tool: extracts parameters and delegates to AEMConnector.listPages, formats result as JSON text content.
    case 'listPages': {
        const { siteRoot, depth, limit } = args;
        const result = await aemConnector.listPages(siteRoot, depth, limit);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Core implementation of listPages: fetches site tree as JSON, recursively traverses to collect cq:Page nodes up to depth/limit, falls back to QueryBuilder query, wraps in success response.
    async listPages(siteRoot, depth = 1, limit = 20) {
        return safeExecute(async () => {
            const client = this.createAxiosInstance();
            // First try direct JSON API approach for better performance
            try {
                const response = await client.get(`${siteRoot}.${depth}.json`);
                const pages = [];
                const processNode = (node, currentPath, currentDepth) => {
                    if (currentDepth > depth || pages.length >= limit)
                        return;
                    Object.entries(node).forEach(([key, value]) => {
                        if (pages.length >= limit)
                            return;
                        // Skip JCR system properties
                        if (key.startsWith('jcr:') || key.startsWith('sling:') || key.startsWith('cq:') ||
                            key.startsWith('rep:') || key.startsWith('oak:')) {
                            return;
                        }
                        if (value && typeof value === 'object') {
                            const childPath = `${currentPath}/${key}`;
                            const primaryType = value['jcr:primaryType'];
                            // Only include cq:Page nodes
                            if (primaryType === 'cq:Page') {
                                pages.push({
                                    name: key,
                                    path: childPath,
                                    primaryType: 'cq:Page',
                                    title: value['jcr:content']?.['jcr:title'] || key,
                                    template: value['jcr:content']?.['cq:template'],
                                    lastModified: value['jcr:content']?.['cq:lastModified'],
                                    lastModifiedBy: value['jcr:content']?.['cq:lastModifiedBy'],
                                    resourceType: value['jcr:content']?.['sling:resourceType'],
                                    type: 'page'
                                });
                            }
                            // Recursively process child nodes if within depth limit
                            if (currentDepth < depth) {
                                processNode(value, childPath, currentDepth + 1);
                            }
                        }
                    });
                };
                if (response.data && typeof response.data === 'object') {
                    processNode(response.data, siteRoot, 0);
                }
                return createSuccessResponse({
                    siteRoot,
                    pages,
                    pageCount: pages.length,
                    depth,
                    limit,
                    totalChildrenScanned: pages.length
                }, 'listPages');
            }
            catch (error) {
                // Fallback to QueryBuilder if JSON API fails
                if (error.response?.status === 404 || error.response?.status === 403) {
                    const response = await client.get('/bin/querybuilder.json', {
                        params: {
                            path: siteRoot,
                            type: 'cq:Page',
                            'p.nodedepth': depth.toString(),
                            'p.limit': limit.toString(),
                            'p.hits': 'full'
                        },
                    });
                    const pages = (response.data.hits || []).map((hit) => ({
                        name: hit.name || hit.path?.split('/').pop(),
                        path: hit.path,
                        primaryType: 'cq:Page',
                        title: hit['jcr:content/jcr:title'] || hit.title || hit.name,
                        template: hit['jcr:content/cq:template'],
                        lastModified: hit['jcr:content/cq:lastModified'],
                        lastModifiedBy: hit['jcr:content/cq:lastModifiedBy'],
                        resourceType: hit['jcr:content/sling:resourceType'],
                        type: 'page'
                    }));
                    return createSuccessResponse({
                        siteRoot,
                        pages,
                        pageCount: pages.length,
                        depth,
                        limit,
                        totalChildrenScanned: response.data.total || pages.length,
                        fallbackUsed: 'QueryBuilder'
                    }, 'listPages');
                }
                throw error;
            }
        }, 'listPages');
  • Alternative handler in MCPRequestHandler class that delegates listPages call to AEMConnector with default parameters.
    case 'listPages':
        return await this.aemConnector.listPages(params.siteRoot || params.path || '/content', params.depth || 1, params.limit || 20);
  • Tool registration entry in getAvailableMethods() for listPages with parameters list.
    { name: 'listPages', description: 'List all pages under a site root', parameters: ['siteRoot', 'depth', 'limit'] },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't cover critical aspects like pagination, rate limits, authentication needs, or what happens with invalid inputs. The description is too minimal for a tool with parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, though this conciseness comes at the cost of completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (3 parameters, no annotations, no output schema), the description is inadequate. It doesn't explain return values, error handling, or parameter details, leaving significant gaps for the agent to operate effectively in a server with many sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but fails to do so. It mentions 'site root' which maps to the 'siteRoot' parameter, but doesn't explain 'depth' or 'limit', leaving two of three parameters undocumented. The description adds minimal value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('pages under a site root'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'listChildren' or 'enhancedPageSearch', which appear to have overlapping functionality for listing content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'listChildren' or 'enhancedPageSearch'. It mentions 'all pages under a site root' but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to infer usage from context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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