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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool gets summary statistics, implying a read-only operation, but doesn't specify whether it requires authentication, has rate limits, returns aggregated data, or details about the summary format. This leaves significant gaps for a tool that likely accesses system logs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (accessing audit logs, likely requiring permissions) and the absence of both annotations and an output schema, the description is minimally adequate. It states what the tool does but lacks details on behavior, output format, or security context, which are important for such a tool. Without annotations, it should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no required inputs by not mentioning any. A baseline of 4 is appropriate for zero-parameter tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'summary statistics of audit log and system usage', making the purpose specific and understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'dhis2_get_audit_log' or 'dhis2_export_audit_log', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'dhis2_get_audit_log' and 'dhis2_export_audit_log' available, there's no indication of how this summary tool differs in context or when it's preferred over those options.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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