Skip to main content
Glama

android_generate_list_adapter

Generate Android RecyclerView adapters and layouts for DHIS2-style lists with options for shimmer placeholders, pull-to-refresh, and sticky headers.

Instructions

Generate Android RecyclerView adapter and layout for DHIS2-style lists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
adapterNameNoAdapter class name
itemLayoutNoViewBinding layout base name (e.g., item_data_element)
shimmerNoInclude shimmer placeholder pattern
pullToRefreshNoInclude pull-to-refresh pattern
stickyHeadersNoInclude sticky headers in list

Implementation Reference

  • Handler for the android_generate_list_adapter tool. Extracts arguments and calls generateAndroidListAdapter to produce Android RecyclerView adapter code.
    case 'android_generate_list_adapter':
      const aListArgs = args as any;
      const aList = generateAndroidListAdapter(aListArgs);
      return { content: [{ type: 'text', text: aList }] };
  • Core implementation function that generates Kotlin RecyclerView Adapter code and corresponding XML layout for Android list display.
    export function generateAndroidListAdapter(args: any): string {
      const { adapterName = 'DataElementAdapter', itemLayout = 'item_data_element' } = args;
    
      return `# Android RecyclerView Adapter: ${adapterName}
    
    ## Adapter (Kotlin)
    \`\`\`kotlin
    class ${adapterName}(private val items: MutableList<DataElement>) : RecyclerView.Adapter<${adapterName}.ViewHolder>() {
    
        class ViewHolder(val binding: ${camelToPascal(itemLayout)}Binding) : RecyclerView.ViewHolder(binding.root)
    
        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
            val inflater = LayoutInflater.from(parent.context)
            val binding = ${camelToPascal(itemLayout)}Binding.inflate(inflater, parent, false)
            return ViewHolder(binding)
        }
    
        override fun onBindViewHolder(holder: ViewHolder, position: Int) {
            val item = items[position]
            holder.binding.name.text = item.displayName
            holder.binding.type.text = item.valueType
        }
    
        override fun getItemCount(): Int = items.size
    }
    \`\`\`
    
    ## Item Layout (XML)
    \`\`\`xml
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="16dp">
    
        <TextView android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" android:textStyle="bold"/>
        <TextView android:id="@+id/type" android:layout_width="match_parent" android:layout_height="wrap_content"/>
    </LinearLayout>
    \`\`\`
    `;
  • Tool permission registration mapping android_generate_list_adapter to 'canUseMobileFeatures' permission check.
      ['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 but offers minimal behavioral insight. It mentions what is generated but doesn't disclose critical traits like whether this creates files, modifies existing code, requires specific project setup, has side effects, or what the output format is. For a code generation tool with zero annotation coverage, 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 front-loads the core purpose without unnecessary words. Every element ('Generate', 'Android RecyclerView adapter and layout', 'DHIS2-style lists') contributes directly to understanding the tool's function.

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 complexity of a code generation tool with 5 parameters and no annotations or output schema, the description is insufficient. It lacks details on behavioral aspects, output format, dependencies, or integration context, leaving significant gaps for an AI agent to understand how to use it 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 100%, providing clear documentation for all 5 parameters. The description adds no additional parameter semantics beyond implying the tool generates Android components, which is already evident from the tool name and schema. This meets the baseline for high schema 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 action ('Generate') and target resources ('Android RecyclerView adapter and layout'), specifying the style ('DHIS2-style lists'). It distinguishes from most siblings by focusing on list UI components, though it doesn't explicitly differentiate from similar UI generation tools like 'dhis2_generate_ui_data_display' or 'dhis2_create_ui_components'.

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 on when to use this tool versus alternatives. The description doesn't mention prerequisites, appropriate contexts, or comparisons with sibling tools like 'android_generate_material_form' or 'dhis2_generate_ui_data_display', leaving usage entirely implicit.

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