aem_list_packages
Retrieve and list all installed packages in Adobe Experience Manager (AEM) by specifying host, port, username, and password for efficient package management.
Instructions
List installed packages in AEM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | AEM host (default: localhost) | localhost |
| password | No | AEM password (default: admin) | admin |
| port | No | AEM port (default: 4502) | |
| username | No | AEM username (default: admin) | admin |
Implementation Reference
- src/aem-tools.ts:59-84 (handler)The primary handler function for the 'aem_list_packages' tool. It processes input arguments, calls the AEMClient to fetch packages, formats the output as text content, and returns the MCP response.async listPackages(args: any) { const config = this.getConfig(args); const result = await this.aemClient.listPackages(config); let packagesText = 'Installed Packages:\n'; if (result.success && result.packages) { if (typeof result.packages === 'string') { // Parse HTML response if needed packagesText += result.packages; } else { packagesText += JSON.stringify(result.packages, null, 2); } } else { packagesText += result.message || 'Failed to retrieve packages'; } return { content: [ { type: 'text', text: packagesText, }, ], }; }
- src/aem-client.ts:158-183 (helper)Core helper function in AEMClient that makes the HTTP request to AEM's package manager endpoint (/crx/packmgr/list.jsp) to retrieve the list of installed packages.async listPackages(config: AEMConfig): Promise<any> { const baseUrl = this.getBaseUrl(config); const authHeader = this.getAuthHeader(config); try { const response = await this.axiosInstance.get(`${baseUrl}/crx/packmgr/list.jsp`, { headers: { 'Authorization': authHeader, }, }); if (response.status === 200) { return { success: true, packages: response.data, }; } else { return { success: false, message: `Failed to list packages: HTTP ${response.status}`, }; } } catch (error) { throw new Error(`Failed to list packages: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
- src/index.ts:116-144 (schema)Input schema definition for the 'aem_list_packages' tool, specifying optional parameters for AEM connection details.{ name: 'aem_list_packages', description: 'List installed packages in AEM', inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'AEM host (default: localhost)', default: 'localhost' }, port: { type: 'number', description: 'AEM port (default: 4502)', default: 4502 }, username: { type: 'string', description: 'AEM username (default: admin)', default: 'admin' }, password: { type: 'string', description: 'AEM password (default: admin)', default: 'admin' } } } },
- src/index.ts:357-358 (registration)Registers the tool handler in the switch statement for CallToolRequestSchema, dispatching calls to AEMTools.listPackages.case 'aem_list_packages': return await this.aemTools.listPackages(args);