Skip to main content
Glama

dhis2_get_audit_log

Retrieve audit logs of all MCP operations performed on the DHIS2 MCP Server. Specify the number of recent entries to monitor and analyze system activities effectively.

Instructions

Retrieve audit log of all MCP operations performed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of recent entries to return (default: 50, max: 1000)

Implementation Reference

  • Handler for 'dhis2_get_audit_log' tool: destructures limit parameter (default 50), calls auditLogger.getAuditTrail(), logs the operation, formats audit entries into a readable text response with emojis and details.
    case 'dhis2_get_audit_log': const { limit = 50 } = args as { limit?: number }; const auditEntries = auditLogger.getAuditTrail(Math.min(limit, 1000)); // Log successful audit retrieval auditLogger.log({ toolName: name, parameters: { limit }, outcome: 'success', dhis2Instance: dhis2Client?.baseURL, userId: currentUser?.username, executionTime: Date.now() - startTime }); return { content: [{ type: 'text', text: `📋 Audit Log (${auditEntries.length} entries)\n\n` + auditEntries.map(entry => `🕐 ${entry.timestamp}\n` + `🛠️ Tool: ${entry.toolName}\n` + `👤 User: ${entry.userId || 'unknown'}\n` + `${entry.outcome === 'success' ? '✅' : '❌'} Result: ${entry.outcome}${entry.error ? ` - ${entry.error}` : ''}\n` + `⏱️ Duration: ${entry.executionTime || 0}ms\n` + `📍 Instance: ${entry.dhis2Instance || 'N/A'}\n` ).join('\n') }] };
  • Core helper method getAuditTrail() from AuditLogger class that provides the recent audit entries used by the tool handler.
    getAuditTrail(limit?: number): AuditEntry[] { const entries = limit ? this.entries.slice(-limit) : this.entries; return [...entries]; // Return copy to prevent mutation }
  • Global singleton instance 'auditLogger' exported and used throughout the codebase, including by the tool handler.
    } // Global audit logger instance

Other Tools

Related Tools

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