Skip to main content
Glama

dhis2_generate_ui_data_display

Generate UI data display components for DHIS2 applications, including tables, cards, lists, modals, and loading states to visualize health information system data.

Instructions

Generate @dhis2/ui data display patterns (tables, cards, lists, modal, loading states)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNameNoComponent name
includeTableNoInclude DataTable
includePaginationNoInclude pagination controls
includeCardsNoInclude Card layout
includeListsNoInclude list component
includeModalNoInclude Modal dialog
includeLoadingNoInclude CircularLoader loading state
skeletonNoInclude skeleton placeholders
emptyStateNoInclude empty state component
sortingNoInclude column sorting example
selectionNoInclude row selection example
stickyHeaderNoUse sticky header in table

Implementation Reference

  • Handler dispatch for the tool: calls generateUIDataDisplayPatterns with input args and returns the generated code as text content.
    case 'dhis2_generate_ui_data_display':
      const displayArgs = args as any;
      const displayCode = generateUIDataDisplayPatterns(displayArgs);
      return {
        content: [
          { type: 'text', text: displayCode }
        ]
      };
  • Core implementation: Generates React code snippets using @dhis2/ui components for data display patterns including tables, cards, lists, modals, pagination, and loading states.
    export function generateUIDataDisplayPatterns(args: any): string {
      const {
        componentName = 'DataDisplay',
        includeTable = true,
        includePagination = true,
        includeCards = true,
        includeLists = true,
        includeModal = true,
        includeLoading = true
      } = args;
    
      return `# @dhis2/ui Data Display Patterns: ${componentName}
    
    ## Implementation
    \`\`\`jsx
    import React from 'react';
    import {
      DataTable, DataTableHead, DataTableRow, DataTableColumnHeader, DataTableBody, DataTableCell,
      Card, Modal, ModalTitle, ModalContent, ModalActions, Button,
      ${includeLoading ? 'CircularLoader,' : ''}
    } from '@dhis2/ui';
    
    export const ${componentName} = ({ items = [], loading = false }) => {
      const [open, setOpen] = React.useState(false);
    
      if (loading) {
        return ${includeLoading ? '<CircularLoader />' : '<div>Loading...</div>'};
      }
    
      return (
        <div style={{ display: 'grid', gap: 16 }}>
          ${includeTable ? `
          <DataTable>
            <DataTableHead>
              <DataTableRow>
                <DataTableColumnHeader>Name</DataTableColumnHeader>
                <DataTableColumnHeader>Type</DataTableColumnHeader>
              </DataTableRow>
            </DataTableHead>
            <DataTableBody>
              {items.map((it) => (
                <DataTableRow key={it.id}>
                  <DataTableCell>{it.displayName}</DataTableCell>
                  <DataTableCell>{it.valueType}</DataTableCell>
                </DataTableRow>
              ))}
            </DataTableBody>
          </DataTable>
          ${includePagination ? `<div style={{ textAlign: 'center' }}><Button>Prev</Button> <Button>Next</Button></div>` : ''}
          ` : ''}
    
          ${includeCards ? `
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: 16 }}>
            {items.slice(0, 4).map((it) => (
              <Card key={it.id}>
                <div style={{ padding: 16 }}>
                  <h3 style={{ margin: '0 0 8px' }}>{it.displayName}</h3>
                  <div>Type: {it.valueType}</div>
                </div>
              </Card>
            ))}
          </div>
          ` : ''}
    
          ${includeLists ? `
          <ul>
            {items.slice(0, 5).map((it) => (
              <li key={it.id}>{it.displayName}</li>
            ))}
          </ul>
          ` : ''}
    
          ${includeModal ? `
          <>
            <Button onClick={() => setOpen(true)}>Open modal</Button>
            <Modal open={open} onClose={() => setOpen(false)}>
              <ModalTitle>Details</ModalTitle>
              <ModalContent>Modal content here</ModalContent>
              <ModalActions>
                <Button secondary onClick={() => setOpen(false)}>Close</Button>
              </ModalActions>
            </Modal>
          </>
          ` : ''}
        </div>
      );
    };
    \`\`\`
    `;
    }
  • Tool permission registration: Maps the tool to 'canUseUITools' permission in TOOL_PERMISSIONS allowing access control.
      ['dhis2_generate_ui_data_display', 'canUseUITools'],
      ['dhis2_generate_ui_navigation_layout', 'canUseUITools'],
      ['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'],
    ]);
  • Import statement for the generateUIDataDisplayPatterns helper function from webapp-generators.
      generateUIDataDisplayPatterns,
      generateUINavigationLayout,
      generateDesignSystemConfig,
      generateAndroidMaterialForm,
      generateAndroidListAdapter,
      generateAndroidNavigationDrawer,
      generateAndroidBottomSheet,
      generateTestSetup
    } from './webapp-generators.js';
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool generates but lacks critical details: it doesn't specify the output format (e.g., code snippets, configuration files), whether it's a read-only or write operation, potential side effects, or any performance considerations like rate limits. For a tool with 12 parameters and no annotations, this is a significant gap in transparency.

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 ('Generate @dhis2/ui data display patterns') and lists key examples without unnecessary elaboration. Every word earns its place, making it highly concise and well-structured for quick understanding.

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 (12 parameters, no output schema, and no annotations), the description is incomplete. It doesn't address what the tool outputs (e.g., code, JSON), how results are delivered, or any behavioral traits like idempotency or error handling. For a generation tool with many configuration options, more context is needed to guide effective use.

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, with each parameter clearly documented (e.g., 'Include DataTable' for includeTable). The description adds no additional parameter semantics beyond what's in the schema, such as explaining dependencies between parameters or default behaviors. With high schema coverage, the baseline score of 3 is appropriate, as 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 ('Generate') and the target ('@dhis2/ui data display patterns'), with specific examples of patterns like tables, cards, lists, modal, and loading states. It distinguishes from sibling tools like 'dhis2_create_ui_components' by focusing on data display patterns rather than general component creation, though it doesn't explicitly contrast with 'dhis2_generate_ui_form_patterns' or 'dhis2_generate_ui_navigation_layout'.

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, such as needing existing data or a specific context, nor does it differentiate from similar sibling tools like 'dhis2_generate_ui_form_patterns' or 'dhis2_generate_ui_navigation_layout'. Usage is implied only through the tool's 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