Skip to main content
Glama

dhis2_get_audit_summary

Retrieve summary statistics for audit logs and system usage to monitor activity and track performance in DHIS2 health information systems.

Instructions

Get summary statistics of audit log and system usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler for the 'dhis2_get_audit_summary' tool. Retrieves audit summary from auditLogger, adds session info, logs the call, and returns formatted text response.
    case 'dhis2_get_audit_summary': const summary = auditLogger.getAuditSummary(); const permissionSummary = PermissionSystem.getPermissionSummary(userPermissions); auditLogger.log({ toolName: name, parameters: {}, outcome: 'success', dhis2Instance: dhis2Client?.baseURL, userId: currentUser?.username, executionTime: Date.now() - startTime }); return { content: [{ type: 'text', text: `šŸ“Š DHIS2 MCP Server Audit Summary šŸ”¢ **Usage Statistics:** • Total Operations: ${summary.totalOperations} • Successful: ${summary.successCount} (${Math.round((summary.successCount / summary.totalOperations) * 100) || 0}%) • Errors: ${summary.errorCount} (${Math.round((summary.errorCount / summary.totalOperations) * 100) || 0}%) šŸ‘¤ **Current Session:** • User: ${currentUser?.displayName || 'Unknown'} • Permission Level: ${permissionSummary.level} • Available Tools: ${PermissionSystem.filterToolsByPermissions(tools, userPermissions).length} of ${tools.length} • Connected to: ${dhis2Client?.baseURL || 'Not connected'} šŸ› ļø **Most Used Tools:** ${summary.mostUsedTools.slice(0, 5).map(tool => ` • ${tool.tool}: ${tool.count} times`).join('\n') || ' • No operations yet'} ${summary.recentErrors.length > 0 ? `āš ļø **Recent Errors:** ${summary.recentErrors.slice(0, 3).map(error => ` • ${error.toolName}: ${error.error}`).join('\n')}` : 'āœ… No recent errors'}` }] };
  • Core getAuditSummary method in AuditLogger class that computes statistics: total ops, success/error counts, most used tools, recent errors.
    getAuditSummary(): { totalOperations: number; successCount: number; errorCount: number; mostUsedTools: Array<{ tool: string; count: number }>; recentErrors: AuditEntry[]; } { const toolUsage = new Map<string, number>(); this.entries.forEach(entry => { toolUsage.set(entry.toolName, (toolUsage.get(entry.toolName) || 0) + 1); }); const mostUsedTools = Array.from(toolUsage.entries()) .map(([tool, count]) => ({ tool, count })) .sort((a, b) => b.count - a.count) .slice(0, 10); const recentErrors = this.entries .filter(entry => entry.outcome === 'error') .slice(-5); return { totalOperations: this.entries.length, successCount: this.getSuccessCount(), errorCount: this.getErrorCount(), mostUsedTools, recentErrors }; }
  • Global singleton instance of AuditLogger used by all tools including dhis2_get_audit_summary.
    } // Global audit logger instance

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/Dradebo/dhis2-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server