Skip to main content
Glama

fetchSites

Retrieve all available sites in Adobe Experience Manager to manage content, components, and assets through REST/JSON-RPC APIs.

Instructions

Get all available sites in AEM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler implementation for fetchSites tool. Queries AEM /content.json endpoint with depth=2, parses top-level sites, extracts name, path, title, template, and lastModified properties, wraps in standardized response.
    async fetchSites(): Promise<SitesResponse> {
      return safeExecute<SitesResponse>(async () => {
        const response = await this.httpClient.get('/content.json', { 
          params: { ':depth': '2' } 
        });
        
        const sites: Array<{
          name: string;
          path: string;
          title: string;
          template?: string;
          lastModified?: string;
        }> = [];
    
        Object.entries(response.data).forEach(([key, value]: [string, any]) => {
          if (key.startsWith('jcr:') || key.startsWith('sling:')) return;
          if (value && typeof value === 'object' && value['jcr:content']) {
            sites.push({
              name: key,
              path: `/content/${key}`,
              title: value['jcr:content']['jcr:title'] || key,
              template: value['jcr:content']['cq:template'],
              lastModified: value['jcr:content']['cq:lastModified'],
            });
          }
        });
    
        return createSuccessResponse({
          sites,
          totalCount: sites.length,
        }, 'fetchSites') as SitesResponse;
      }, 'fetchSites');
    }
  • Type definition for the output response of fetchSites, defining the structure of sites array and totalCount.
    export interface SitesResponse extends BaseResponse {
      data: {
        sites: Array<{
          name: string;
          path: string;
          title: string;
          template?: string;
          lastModified?: string;
        }>;
        totalCount: number;
      };
    }
  • MCP tool schema definition including name, description, and empty input schema (no parameters required).
    {
      name: 'fetchSites',
      description: 'Get all available sites in AEM',
      inputSchema: { type: 'object', properties: {} },
    },
  • MCP server dispatch handler for fetchSites tool call, invoking AEM connector and returning JSON response.
    case 'fetchSites': {
      const result = await aemConnector.fetchSites();
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Alternative handler registration listing fetchSites in available methods with description and no parameters.
    { name: 'fetchSites', description: 'Get all available sites in AEM', parameters: [] },

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