Skip to main content
Glama

dhis2_migration_assistant

Migrate from deprecated d2 library to modern DHIS2 App Platform by analyzing current stack and generating migration steps for your specific configuration.

Instructions

Assist with migrating from deprecated d2 library to modern App Platform

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currentStackYes
targetPlatformNo
migrationScopeNoScope of migration
codeComplexityNoCurrent codebase complexity

Implementation Reference

  • Main handler for the dhis2_migration_assistant tool in the MCP server request handler switch statement. Calls generateMigrationGuide function.
    case 'dhis2_migration_assistant':
      const migrationArgs = args as any;
      const migrationGuide = generateMigrationGuide(migrationArgs);
      return {
        content: [
          {
            type: 'text',
            text: migrationGuide,
          },
        ],
      };
  • Core implementation function generateMigrationGuide that generates comprehensive DHIS2 migration guides from d2 library to App Platform. This is the main logic executed by the tool.
    export function generateMigrationGuide(args: any): string {
      const { currentStack, targetPlatform = {}, migrationScope = 'incremental', codeComplexity = 'moderate' } = args;
    
      return `# DHIS2 Migration Guide: d2 Library to App Platform
    
    ## Migration Overview
    - **Current Stack**: d2 ${currentStack?.d2Version || 'unknown'}, React ${currentStack?.reactVersion || 'unknown'}, ${currentStack?.buildSystem || 'unknown'}
    - **Target Platform**: App Platform ${targetPlatform?.appPlatformVersion || 'latest'}
    - **Migration Scope**: ${migrationScope.replace(/_/g, ' ').toUpperCase()}
    - **Code Complexity**: ${codeComplexity.toUpperCase()}
    
    ⚠️  **Important**: The d2 library is deprecated. Modern DHIS2 development uses @dhis2/app-platform.
    
    ## Pre-Migration Checklist
    - [ ] Backup current codebase
    - [ ] Document current dependencies
    - [ ] Test current functionality thoroughly
    - [ ] Review breaking changes in target platform
    - [ ] Plan rollback strategy
    
    ## Step-by-Step Migration
    
    ### 1. Environment Setup
    \`\`\`bash
    # Install modern DHIS2 tooling
    npm install -g @dhis2/cli
    
    # Create new App Platform project (for reference)
    d2 app scripts init migration-reference
    \`\`\`
    
    ### 2. Package.json Updates
    ${generatePackageJsonMigration(currentStack, targetPlatform)}
    
    ### 3. Configuration Migration
    ${generateConfigMigration(currentStack)}
    
    ### 4. Code Migration
    ${generateCodeMigration(migrationScope, codeComplexity)}
    
    ### 5. API Migration
    ${generateAPIMigration(targetPlatform.features)}
    
    ## Migration Phases
    
    ${generateMigrationPhases(migrationScope, codeComplexity)}
    
    ## Testing Strategy
    ${generateTestingStrategy(codeComplexity)}
    
    ## Rollback Plan
    \`\`\`bash
    # If migration fails, rollback strategy:
    git stash
    git checkout pre-migration-branch
    npm install
    npm start
    \`\`\`
    
    ## Post-Migration Validation
    - [ ] All features working correctly
    - [ ] Performance comparable or better
    - [ ] Bundle size acceptable
    - [ ] Tests passing
    - [ ] No console errors
    - [ ] Authentication working
    - [ ] API calls functioning
    
    ## Common Migration Issues
    
    ### Dependency Conflicts
    **Issue**: Conflicting versions between d2 and App Platform dependencies
    **Solution**: Remove all d2-related dependencies and use App Platform equivalents
    
    ### API Changes  
    **Issue**: d2.Api methods don't exist in App Runtime
    **Solution**: Replace with useDataQuery/useDataMutation hooks
    
    ### Styling Conflicts
    **Issue**: d2-ui styles conflict with @dhis2/ui components  
    **Solution**: Gradually replace d2-ui components with @dhis2/ui
    
    ### Build Configuration
    **Issue**: Custom webpack config no longer works
    **Solution**: Use d2.config.js for App Platform configuration
    
    ## Resources and Support
    - **Migration Documentation**: https://developers.dhis2.org/docs/app-platform/migration
    - **App Platform Guide**: https://developers.dhis2.org/docs/app-platform/getting-started  
    - **Community Forum**: https://community.dhis2.org/c/development
    - **Code Examples**: https://github.com/dhis2/app-platform
    
    ## Success Metrics
    After migration, you should have:
    - ✅ Modern, maintainable codebase
    - ✅ Better development experience
    - ✅ Improved performance
    - ✅ Future-proof architecture
    - ✅ Access to latest DHIS2 features
    `;
    }
  • Tool permission registration in TOOL_PERMISSIONS Map. Associates 'dhis2_migration_assistant' with 'canDebugApplications' permission.
    ['dhis2_migration_assistant', 'canDebugApplications'],
Behavior2/5

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

No annotations are provided, so the description carries full burden. It vaguely describes assistance but doesn't disclose key behavioral traits: whether this is a read-only analysis tool or performs actual migrations, what the output might be (e.g., a plan, code changes), or any side effects like file modifications. For a complex migration tool with 4 parameters, this is inadequate.

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 unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 with nested objects, no output schema, no annotations), the description is insufficient. It doesn't explain what 'assist' entails, the expected outcomes, or how parameters interact. For a migration tool that likely involves significant changes, more detail is needed to guide the agent effectively.

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?

Schema description coverage is 50%, with 2 of 4 parameters having descriptions in the schema. The description adds no parameter-specific information beyond the tool's general purpose. It doesn't explain what 'currentStack' or 'migrationScope' mean in context, leaving gaps. Baseline is 3 due to moderate schema coverage, but it doesn't compensate for the low coverage.

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: 'Assist with migrating from deprecated d2 library to modern App Platform.' It specifies the verb ('assist with migrating') and the resources involved (d2 library to App Platform). However, it doesn't explicitly differentiate from sibling tools, which are mostly Android-specific or other DHIS2 utilities, so it's not a perfect 5.

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. It doesn't mention prerequisites, timing, or compare it to other migration or configuration tools in the sibling list. This leaves the agent guessing about appropriate contexts.

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