Skip to main content
Glama

android_generate_navigation_drawer

Create Android navigation drawer components using Jetpack Compose for DHIS2 mobile applications, with options for Navigation Compose integration and Material 3 dynamic colors.

Instructions

Generate Android navigation drawer pattern (Compose)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNameNoComposable name
navComposeNoInclude Navigation Compose sample
dynamicColorNoUse Material 3 dynamic color in scaffold

Implementation Reference

  • MCP tool handler that invokes the navigation drawer generator function with provided arguments and returns the generated code as text content.
    const aNavArgs = args as any;
    const aNav = generateAndroidNavigationDrawer(aNavArgs);
    return { content: [{ type: 'text', text: aNav }] };
  • Core generator function that produces complete Jetpack Compose code for a Material Design Navigation Drawer, including drawer state management, menu items, top app bar with hamburger menu, and scaffold structure.
    export function generateAndroidNavigationDrawer(args: any): string {
      const { componentName = 'AppNavigation' } = args;
    
      return `# Android Navigation Drawer (Compose): ${componentName}
    
    ## Implementation
    \`\`\`kotlin
    @OptIn(ExperimentalMaterial3Api::class)
    @Composable
    fun ${componentName}() {
        val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
        val scope = rememberCoroutineScope()
    
        ModalNavigationDrawer(
            drawerState = drawerState,
            drawerContent = {
                ModalDrawerSheet {
                    NavigationDrawerItem(label = { Text("Dashboard") }, selected = true, onClick = { })
                    NavigationDrawerItem(label = { Text("Data Entry") }, selected = false, onClick = { })
                    NavigationDrawerItem(label = { Text("Reports") }, selected = false, onClick = { })
                }
            }
        ) {
            Scaffold(topBar = {
                TopAppBar(title = { Text("My DHIS2 App") }, navigationIcon = {
                    IconButton(onClick = { scope.launch { drawerState.open() } }) {
                        Icon(Icons.Default.Menu, contentDescription = null)
                    }
                })
            }) { padding ->
                Box(Modifier.padding(padding)) {
                    Text("Content goes here")
                }
            }
        }
    }
    \`\`\`
    `;
    }
  • Tool permissions registration mapping 'android_generate_navigation_drawer' to 'canUseMobileFeatures' permission check for access control.
      ['android_generate_material_form', 'canUseMobileFeatures'],
      ['android_generate_list_adapter', 'canUseMobileFeatures'],
      ['android_generate_navigation_drawer', 'canUseMobileFeatures'],
      ['android_generate_bottom_sheet', 'canUseMobileFeatures'],
    ]);

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