Skip to main content
Glama

dhis2_android_init_project

Initialize an Android project with DHIS2 SDK integration to build health information apps with offline sync, GPS capture, and architecture patterns.

Instructions

Initialize a new Android project with DHIS2 SDK integration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesAndroid project name (e.g., "dhis2-health-tracker")
applicationIdYesAndroid application ID (e.g., "org.dhis2.healthtracker")
minSdkVersionNoMinimum Android SDK version (default: 21)
targetSdkVersionNoTarget Android SDK version (default: 34)
languageYesProgramming language for Android app
dhis2SdkVersionNoDHIS2 Android SDK version (e.g., "1.10.0")
featuresNoFeatures to include in the project setup
architectureNoAndroid architecture pattern to implement

Implementation Reference

  • MCP tool handler for 'dhis2_android_init_project'. Receives arguments, calls generateAndroidProjectInit function, and returns generated project initialization instructions as markdown text.
    case 'dhis2_android_init_project':
      const androidProjectArgs = args as any;
      const androidProjectInstructions = generateAndroidProjectInit(androidProjectArgs);
      return {
        content: [
          {
            type: 'text',
            text: androidProjectInstructions,
          },
        ],
      };
  • Core implementation function that generates comprehensive Android project initialization guide including project structure, AndroidManifest.xml, architecture patterns, and next steps based on provided config.
    export function generateAndroidProjectInit(config: AndroidProjectConfig): string {
      const { projectName, applicationId, minSdkVersion = 21, targetSdkVersion = 34, language, dhis2SdkVersion, features = [], architecture } = config;
    
      return `# DHIS2 Android Project Initialization Guide
    
    ## ๐Ÿš€ Quick Start Commands
    
    \`\`\`bash
    # Create new Android project structure
    mkdir ${projectName}
    cd ${projectName}
    
    # Initialize Android project with Android Studio template or CLI
    # Option 1: Android Studio
    # - Create new project with API ${minSdkVersion}+ and ${language}
    # - Choose Empty Activity template
    # - Set Application name: ${projectName}
    # - Set Package name: ${applicationId}
    
    # Option 2: Command line with Android CLI tools
    android create project \\
        --name ${projectName} \\
        --target android-${targetSdkVersion} \\
        --path ./${projectName} \\
        --package ${applicationId} \\
        --activity MainActivity
    
    # Initialize git repository
    git init
    \`\`\`
    
    ## ๐Ÿ“ฑ Project Structure
    
    \`\`\`
    ${projectName}/
    โ”œโ”€โ”€ app/
    โ”‚   โ”œโ”€โ”€ src/
    โ”‚   โ”‚   โ”œโ”€โ”€ main/
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ java/${applicationId?.replace(/\./g, '/') || 'com/example/app'}/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MainActivity.${language === 'kotlin' ? 'kt' : 'java'}
    โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ data/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ local/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ remote/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ repository/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ domain/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ model/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ repository/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ usecase/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ presentation/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ui/
    โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ viewmodel/
    โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ utils/
    โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ res/
    โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AndroidManifest.xml
    โ”‚   โ”‚   โ”œโ”€โ”€ androidTest/
    โ”‚   โ”‚   โ””โ”€โ”€ test/
    โ”‚   โ”œโ”€โ”€ build.gradle${language === 'kotlin' ? '.kts' : ''}
    โ”‚   โ””โ”€โ”€ proguard-rules.pro
    โ”œโ”€โ”€ gradle/
    โ”œโ”€โ”€ build.gradle${language === 'kotlin' ? '.kts' : ''}
    โ”œโ”€โ”€ gradle.properties
    โ””โ”€โ”€ settings.gradle${language === 'kotlin' ? '.kts' : ''}
    \`\`\`
    
    ## ๐Ÿ—๏ธ Architecture Pattern: ${architecture?.toUpperCase().replace('_', ' ') || 'MVVM'}
    
    ${generateArchitecturePattern(architecture || 'mvvm', language || 'kotlin')}
    
    ## ๐Ÿ“‹ Required Permissions
    
    Add these permissions to \`app/src/main/AndroidManifest.xml\`:
    
    \`\`\`xml
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="${applicationId}">
    
        <!-- DHIS2 SDK Required Permissions -->
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        
    ${(features || []).includes('gps_capture') ? `    <!-- Location Services -->
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />` : ''}
    ${(features || []).includes('camera_integration') ? `    <!-- Camera & Media -->
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />` : ''}
    ${(features || []).includes('encrypted_storage') ? `    <!-- Storage & Security -->
        <uses-permission android:name="android.permission.USE_FINGERPRINT" />
        <uses-permission android:name="android.permission.USE_BIOMETRIC" />` : ''}
    ${(features || []).includes('offline_sync') ? `    <!-- Background Sync -->
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />` : ''}
    
        <application
            android:name=".${(projectName || 'App').replace(/-/g, '')}Application"
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/Theme.${(projectName || 'App').replace(/-/g, '')}"
            android:networkSecurityConfig="@xml/network_security_config">
            
            <activity
                android:name=".MainActivity"
                android:exported="true"
                android:theme="@style/Theme.${(projectName || 'App').replace(/-/g, '')}.NoActionBar">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            
    ${(features || []).includes('offline_sync') ? `        <!-- Background Sync Service -->
            <service
                android:name=".service.SyncService"
                android:permission="android.permission.BIND_JOB_SERVICE"
                android:exported="false" />` : ''}
        </application>
    </manifest>
    \`\`\`
    
    ## ๐Ÿ”ง Next Steps
    
    1. **Configure Gradle**: Use \`dhis2_android_configure_gradle\` tool
    2. **Set up Authentication**: Use \`dhis2_android_setup_authentication\` tool  
    3. **Configure Data Sync**: Use \`dhis2_android_setup_sync\` tool
    4. **Add UI Components**: Use \`dhis2_android_configure_ui_patterns\` tool
    
    ## ๐Ÿ“š Additional Resources
    
    - [DHIS2 Android SDK Documentation](https://docs.dhis2.org/en/develop/developing-with-the-android-sdk/about-this-guide.html)
    - [Android Architecture Guide](https://developer.android.com/guide/components/activities/activity-lifecycle)
    - [Material Design Components](https://material.io/develop/android)
    
    ## ๐Ÿงช Development Commands
    
    \`\`\`bash
    # Build debug APK
    ./gradlew assembleDebug
    
    # Run tests
    ./gradlew test
    
    # Install on connected device
    ./gradlew installDebug
    
    # Generate signed APK
    ./gradlew assembleRelease
    \`\`\`
    `;
    }
  • TypeScript interface defining the input schema/parameters for the Android project initialization tool.
    export interface AndroidProjectConfig {
      projectName: string;
      applicationId: string;
      minSdkVersion: number;
      targetSdkVersion: number;
      language: 'kotlin' | 'java';
      dhis2SdkVersion: string;
      features: string[];
      architecture: string;
    }
  • Tool permission registration mapping 'dhis2_android_init_project' to required user permission 'canUseMobileFeatures'.
    ['dhis2_android_init_project', 'canUseMobileFeatures'],
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Initialize' implies a creation/setup operation, the description doesn't specify whether this tool creates files, modifies existing projects, requires specific permissions, has side effects, or what the expected outcome looks like. For a tool with 8 parameters and no annotation coverage, this represents a significant transparency gap.

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 clearly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information, making it easy for an agent to quickly understand what the tool does.

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?

For a tool with 8 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the tool actually produces (project structure, files created), what happens if the project already exists, or any behavioral constraints. The combination of complex parameters and lack of structured metadata requires more descriptive context than provided.

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 input schema has 100% description coverage, providing detailed documentation for all 8 parameters including enums and defaults. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline score of 3 where the schema does the heavy lifting.

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 action ('Initialize') and target ('new Android project with DHIS2 SDK integration'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'dhis2_init_webapp' or 'dhis2_setup_dev_environment', 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. There are no prerequisites mentioned, no indication of when this initialization should occur in the development workflow, and no comparison to sibling tools like 'dhis2_configure_gradle' or 'dhis2_setup_dev_environment' that might handle related setup tasks.

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