aem_bundle_status
Check OSGi bundle status on Adobe Experience Manager instances to monitor health and identify issues with specific bundles or the overall system.
Instructions
Check OSGi bundle status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundleId | No | Specific bundle ID or symbolic name (optional) | |
| 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:170-220 (handler)MCP tool handler function that processes input arguments, calls the AEMClient to fetch bundle status, formats the response with summaries and details, and returns MCP-formatted content.
async getBundleStatus(args: any) { const config = this.getConfig(args); const { bundleId } = args; const result = await this.aemClient.getBundleStatus(config, bundleId); let bundleText = `OSGi Bundle Status: ${bundleId ? `Bundle ID: ${bundleId}` : 'All Bundles'} Success: ${result.success} `; if (result.success && result.bundles) { if (bundleId) { // Single bundle bundleText += `Bundle Details:\n${JSON.stringify(result.bundles, null, 2)}`; } else { // All bundles summary const bundles = result.bundles; if (bundles.s && Array.isArray(bundles.s)) { const totalBundles = bundles.s.length; const activeBundles = bundles.s.filter((bundle: any) => bundle.state === 'Active').length; const resolvedBundles = bundles.s.filter((bundle: any) => bundle.state === 'Resolved').length; const installedBundles = bundles.s.filter((bundle: any) => bundle.state === 'Installed').length; bundleText += `Total Bundles: ${totalBundles} Active Bundles: ${activeBundles} Resolved Bundles: ${resolvedBundles} Installed Bundles: ${installedBundles} Bundle Summary: ${bundles.s.slice(0, 10).map((bundle: any) => `- ${bundle.name} (${bundle.symbolicName}): ${bundle.state}` ).join('\n')} ${totalBundles > 10 ? `\n... and ${totalBundles - 10} more bundles` : ''}`; } else { bundleText += `Bundle Data:\n${JSON.stringify(bundles, null, 2)}`; } } } else { bundleText += `Message: ${result.message || 'Failed to get bundle status'}`; } return { content: [ { type: 'text', text: bundleText, }, ], }; } - src/index.ts:276-308 (schema)Input schema definition for the aem_bundle_status tool, including optional bundleId and AEM connection parameters.
{ name: 'aem_bundle_status', description: 'Check OSGi bundle status', inputSchema: { type: 'object', properties: { bundleId: { type: 'string', description: 'Specific bundle ID or symbolic name (optional)' }, 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:365-366 (registration)Tool registration in the MCP CallToolRequest handler switch statement, dispatching to the AEMTools.getBundleStatus method.
case 'aem_bundle_status': return await this.aemTools.getBundleStatus(args); - src/aem-client.ts:299-328 (helper)Core helper function in AEMClient that performs HTTP request to AEM's OSGi console to retrieve bundle status (all or specific bundle), handles authentication and errors.
async getBundleStatus(config: AEMConfig, bundleId?: string): Promise<any> { const baseUrl = this.getBaseUrl(config); const authHeader = this.getAuthHeader(config); try { const url = bundleId ? `${baseUrl}/system/console/bundles/${bundleId}.json` : `${baseUrl}/system/console/bundles.json`; const response = await this.axiosInstance.get(url, { headers: { 'Authorization': authHeader, }, }); if (response.status === 200) { return { success: true, bundles: response.data, }; } else { return { success: false, message: `Failed to get bundle status: HTTP ${response.status}`, }; } } catch (error) { throw new Error(`Failed to get bundle status: ${error instanceof Error ? error.message : 'Unknown error'}`); } }