Skip to main content
Glama

dhis2_optimize_performance

Analyze and resolve performance issues in DHIS2 web applications, including slow loading, memory leaks, API bottlenecks, and bundle size optimization.

Instructions

Identify and fix performance issues in DHIS2 web applications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
performanceIssueYesType of performance issue
metricsNo
targetMetricsNo
appComplexityNoApplication complexity level

Implementation Reference

  • Handler for dhis2_optimize_performance tool: receives arguments, calls generatePerformanceOptimizations helper, and returns markdown response.
    case 'dhis2_optimize_performance':
      const perfArgs = args as any;
      const perfOptimizations = generatePerformanceOptimizations(perfArgs);
      return {
        content: [
          {
            type: 'text',
            text: perfOptimizations,
          },
        ],
      };
  • Core helper function that generates comprehensive performance optimization recommendations including strategies, code examples, metrics analysis, and DHIS2-specific optimizations.
    export function generatePerformanceOptimizations(args: any): string {
      const { performanceIssue, metrics = {}, targetMetrics = {}, appComplexity = 'moderate' } = args;
    
      return `# DHIS2 App Performance Optimization
    
    ## Current Performance Analysis
    - **Issue Type**: ${performanceIssue.replace(/_/g, ' ').toUpperCase()}
    - **App Complexity**: ${appComplexity.toUpperCase()}
    
    ### Current Metrics
    ${Object.entries(metrics).map(([key, value]) => `- **${key.replace(/_/g, ' ').toUpperCase()}**: ${value}${getMetricUnit(key)}`).join('\n')}
    
    ### Target Metrics
    ${Object.entries(targetMetrics).map(([key, value]) => `- **${key.replace(/target_/g, '').replace(/_/g, ' ').toUpperCase()}**: ${value}${getMetricUnit(key.replace('target_', ''))}`).join('\n')}
    
    ## Optimization Strategy
    
    ${generateOptimizationStrategy(performanceIssue, metrics, appComplexity)}
    
    ## Implementation Guide
    
    ${generateImplementationGuide(performanceIssue)}
    
    ## Monitoring and Measurement
    
    ### Performance Testing Setup
    \`\`\`javascript
    // Performance measurement utility
    const measurePerformance = (name, fn) => {
      const start = performance.now();
      const result = fn();
      const end = performance.now();
      console.log(\`\${name} took \${end - start} milliseconds\`);
      return result;
    };
    
    // Usage example
    measurePerformance('Data Element Load', () => {
      // Load data elements
    });
    \`\`\`
    
    ### Browser Performance API
    \`\`\`javascript
    // Track Core Web Vitals
    import { getCLS, getFID, getFCP, getLCP, getTTFB } from 'web-vitals';
    
    getCLS(console.log);
    getFID(console.log);
    getFCP(console.log);
    getLCP(console.log);
    getTTFB(console.log);
    \`\`\`
    
    ## Performance Budget
    ${generatePerformanceBudget(appComplexity)}
    
    ## DHIS2-Specific Optimizations
    ${generateDHIS2Optimizations()}
    
    ## Monitoring Dashboard
    \`\`\`javascript
    // Simple performance dashboard component
    const PerformanceDashboard = () => {
      const [metrics, setMetrics] = React.useState({});
      
      React.useEffect(() => {
        // Collect performance metrics
        const observer = new PerformanceObserver((list) => {
          const entries = list.getEntries();
          setMetrics(prev => ({
            ...prev,
            ...entries.reduce((acc, entry) => ({
              ...acc,
              [entry.name]: entry.duration
            }), {})
          }));
        });
        
        observer.observe({ entryTypes: ['measure'] });
        
        return () => observer.disconnect();
      }, []);
      
      return (
        <div>
          <h3>Performance Metrics</h3>
          {Object.entries(metrics).map(([name, value]) => (
            <p key={name}>{name}: {value.toFixed(2)}ms</p>
          ))}
        </div>
      );
    };
    \`\`\`
    `;
    }
  • Tool permission registration mapping 'dhis2_optimize_performance' to required permission 'canDebugApplications' in TOOL_PERMISSIONS Map used for access control.
    ['dhis2_optimize_performance', 'canDebugApplications'],
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'identify and fix,' implying both diagnostic and corrective actions, but fails to detail critical aspects like required permissions, potential side effects (e.g., changes to app configuration), or expected outcomes (e.g., whether it provides a report or automatically applies fixes). This leaves significant gaps in understanding the tool's behavior.

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, direct sentence with no wasted words, clearly front-loading the core purpose. It is appropriately sized for the tool's complexity, avoiding unnecessary elaboration while stating the essential function efficiently.

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

Completeness2/5

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

Given the tool's complexity (4 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It lacks details on behavioral traits, parameter usage, expected outputs, and differentiation from siblings. For a tool that performs both identification and fixing of performance issues, more comprehensive guidance is needed to ensure effective use.

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

Parameters3/5

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

The description does not mention any parameters, while the input schema has 4 parameters with 50% description coverage. Since schema coverage is moderate, the baseline is 3, as the description adds no semantic context beyond what the schema provides. It fails to explain how parameters like 'performanceIssue' or 'metrics' relate to the tool's purpose, leaving users to infer usage from the schema alone.

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 tool's purpose as 'Identify and fix performance issues in DHIS2 web applications,' specifying the action (identify and fix), resource (performance issues), and domain (DHIS2 web applications). However, it does not explicitly differentiate from the sibling tool 'dhis2_android_performance_optimization,' which targets Android apps, leaving some ambiguity in scope.

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, such as the Android-focused sibling tool or other performance-related tools in the list. It lacks context on prerequisites, exclusions, or specific scenarios where this tool is most applicable, offering only a general statement without actionable usage instructions.

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