aem_list_packages
List installed packages in Adobe Experience Manager to manage content bundles and track deployments.
Instructions
List installed packages in AEM
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "aem_list_packages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | AEM host (default: localhost) | localhost |
| port | No | AEM port (default: 4502) | |
| username | No | AEM username (default: admin) | admin |
| password | No | AEM password (default: admin) | admin |
Implementation Reference
- src/aem-tools.ts:59-83 (handler)Handler function that executes the aem_list_packages tool logic: extracts config, calls AEMClient.listPackages, formats the response as MCP content.
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/index.ts:116-144 (schema)Input schema and metadata for the aem_list_packages tool, provided in the ListToolsRequestSchema response.
{ 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)Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching to AEMTools.listPackages.
case 'aem_list_packages': return await this.aemTools.listPackages(args); - src/aem-client.ts:158-182 (helper)Helper method in AEMClient that performs the actual HTTP request to retrieve the list of installed packages from AEM's package manager.
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/aem-tools.ts:6-13 (helper)Shared helper method to extract and default AEM configuration from tool arguments.
private getConfig(args: any): AEMConfig { return { host: args.host || 'localhost', port: args.port || 4506, username: args.username || 'admin', password: args.password || 'admin', }; }