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'],

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