Skip to main content
Glama

android_generate_material_form

Generate Android Jetpack Compose form patterns with Material Design for DHIS2 health information systems. Create customizable forms with validation, date pickers, multi-select options, and accessibility features.

Instructions

Generate Android Jetpack Compose form patterns (Material Design)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screenNameNoComposable name
includeValidationNo
includeDatePickerNo
includeMultiSelectNo
dynamicColorNoUse Material 3 dynamic color
lightDarkNoInclude light/dark theme setup
rtlNoAdd RTL considerations
snackbarNoInclude snackbar feedback example

Implementation Reference

  • MCP server tool handler for 'android_generate_material_form'. Receives arguments, calls generateAndroidMaterialForm generator, and formats response as text content.
    case 'android_generate_material_form':
      const aFormArgs = args as any;
      const aForm = generateAndroidMaterialForm(aFormArgs);
      return { content: [{ type: 'text', text: aForm }] };
  • Core generator function that produces Kotlin Jetpack Compose code for Android Material Design forms based on input parameters like screenName, validation, date picker, multi-select.
    export function generateAndroidMaterialForm(args: any): string {
      const {
        screenName = 'RegistrationForm',
        includeValidation = true,
        includeDatePicker = true,
        includeMultiSelect = true
      } = args;
    
      return `# Android Material Form (Jetpack Compose): ${screenName}
    
    ## Implementation
    \`\`\`kotlin
    @Composable
    fun ${screenName}(
        onSubmit: (name: String, description: String, date: String, options: List<String>) -> Unit
    ) {
        var name by remember { mutableStateOf("") }
        var description by remember { mutableStateOf("") }
        var date by remember { mutableStateOf("") }
        var showDatePicker by remember { mutableStateOf(false) }
        val selectedOptions = remember { mutableStateListOf<String>() }
        ${includeValidation ? 'var nameError by remember { mutableStateOf<String?>(null) }' : ''}
    
        Column(modifier = Modifier.padding(16.dp).fillMaxSize(), verticalArrangement = Arrangement.spacedBy(12.dp)) {
            OutlinedTextField(
                value = name,
                onValueChange = { value ->
                    name = value
                    ${includeValidation ? 'nameError = if (value.isBlank()) "Name is required" else null' : ''}
                },
                label = { Text("Name") },
                isError = ${includeValidation ? 'nameError != null' : 'false'},
                supportingText = { ${includeValidation ? 'nameError?.let { Text(it)' : 'null'} ${includeValidation ? '}' : ''} }
            )
    
            OutlinedTextField(
                value = description,
                onValueChange = { description = it },
                label = { Text("Description") },
                minLines = 3
            )
    
            ${includeDatePicker ? `
            OutlinedTextField(
                value = date,
                onValueChange = {},
                label = { Text("Date") },
                readOnly = true,
                trailingIcon = { Icon(Icons.Default.DateRange, contentDescription = null) },
                modifier = Modifier.clickable { showDatePicker = true }
            )
    
            if (showDatePicker) {
                DatePickerDialog(
                    onDismissRequest = { showDatePicker = false },
                    onDateChange = { y, m, d ->
                        date = "%04d-%02d-%02d".format(y, m + 1, d)
                        showDatePicker = false
                    }
                )
            }
            ` : ''}
    
            ${includeMultiSelect ? `
            Text("Categories")
            FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
                listOf("male", "female", "other").forEach { option ->
                    FilterChip(
                        selected = selectedOptions.contains(option),
                        onClick = {
                            if (selectedOptions.contains(option)) selectedOptions.remove(option)
                            else selectedOptions.add(option)
                        },
                        label = { Text(option) }
                    )
                }
            }
            ` : ''}
    
            Button(onClick = {
                ${includeValidation ? 'if (nameError != null) return@Button' : ''}
                onSubmit(name, description, date, selectedOptions.toList())
            }) {
                Text("Save")
            }
        }
    }
    \`\`\`
    
    ## Notes
    - Replace \`DatePickerDialog\` with your preferred implementation if needed.
    - Use validation for required fields.
    `;
    }
  • Tool permission registration in TOOL_PERMISSIONS Map, associating 'android_generate_material_form' with 'canUseMobileFeatures' permission.
      ['dhis2_generate_design_system', 'canUseUITools'],
      ['android_generate_material_form', 'canUseMobileFeatures'],
      ['android_generate_list_adapter', 'canUseMobileFeatures'],
      ['android_generate_navigation_drawer', 'canUseMobileFeatures'],
      ['android_generate_bottom_sheet', '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 but offers minimal information. It states what the tool generates but doesn't describe output format (e.g., code snippets, configuration files), side effects, permissions needed, or error handling. For a generation tool with 8 parameters, this leaves significant behavioral aspects unexplained.

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, focused sentence with zero wasted words. It front-loads the core purpose ('Generate Android Jetpack Compose form patterns') and efficiently specifies the design system ('Material Design'). Every element earns its place without redundancy.

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 (8 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain what the output looks like (critical for a code generation tool), doesn't provide usage context, and offers minimal behavioral transparency. The description alone leaves too many open questions for effective tool selection and invocation.

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 63% (5 of 8 parameters have descriptions), providing decent baseline documentation. The description adds no parameter-specific information beyond the tool's general purpose, so it doesn't compensate for the 37% gap. However, since most parameters are self-explanatory booleans (e.g., includeValidation, includeDatePicker), the baseline 3 is appropriate.

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 ('Generate') and target ('Android Jetpack Compose form patterns (Material Design)'), making the purpose immediately understandable. It distinguishes from most siblings by focusing on form generation rather than navigation, UI components, or configuration tasks. However, it doesn't explicitly differentiate from 'dhis2_generate_ui_form_patterns' which might have overlapping domain.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites, appropriate contexts, or comparison with sibling tools like 'dhis2_generate_ui_form_patterns' or 'android_generate_navigation_drawer'. The agent must infer usage purely from the tool name and description.

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