fetchSites
Retrieve all available sites in Adobe Experience Manager (AEM) using REST/JSON-RPC APIs for streamlined content and asset management.
Instructions
Get all available sites in AEM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Core implementation of the fetchSites tool. Makes an HTTP GET request to /content.json with depth=2, parses the response to extract site information (name, path, title, template, lastModified), filters out system properties, and returns a structured SitesResponse.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'); }
- src/mcp-server.ts:77-81 (registration)Registration of the fetchSites tool in the MCP server tools list, including name, description, and empty input schema (no parameters required).{ name: 'fetchSites', description: 'Get all available sites in AEM', inputSchema: { type: 'object', properties: {} }, },
- src/mcp-server.ts:616-619 (handler)MCP server dispatch handler for fetchSites tool call, delegating to aemConnector.fetchSites() and formatting the response.case 'fetchSites': { const result = await aemConnector.fetchSites(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/aem-connector-new.ts:205-206 (handler)Delegation from AEMConnector to UtilityOperations instance for fetchSites execution.async fetchSites() { return this.utilityOps.fetchSites();
- src/mcp-handler.ts:21-22 (handler)Handler dispatch in MCPRequestHandler switch statement, calling aemConnector.fetchSites().case 'fetchSites': return await this.aemConnector.fetchSites();