Skip to main content
Glama

dhis2_create_ui_components

Generate UI components for DHIS2 applications using the official UI library. Create forms, tables, dashboards, and other interface elements with built-in data integration, validation, and responsive design features.

Instructions

Generate common UI components using DHIS2 UI library patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentTypeYesType of component to generate
componentNameYesName of the component
featuresNo
dataIntegrationNo
stylingNo

Implementation Reference

  • Main handler for the 'dhis2_create_ui_components' tool call. Receives arguments, invokes generateUIComponents from webapp-generators.ts, and returns generated content.
    case 'dhis2_create_ui_components':
      const uiArgs = args as any;
      const uiComponents = generateUIComponents(uiArgs);
      return {
        content: [
          {
            type: 'text',
            text: uiComponents,
          },
        ],
      };
  • Core helper function that generates markdown with DHIS2 UI component code (React/@dhis2/ui). Dispatches to type-specific generators (form, table, etc.) based on componentType.
    export function generateUIComponents(args: any): string {
      const { componentType, componentName, features = {}, dataIntegration = {}, styling = {} } = args;
    
      return `# DHIS2 UI Component: ${componentName}
    
    ## Component Implementation
    
    ${generateComponentCode(componentType, componentName, features, dataIntegration, styling)}
    
    ## Usage Example
    \`\`\`jsx
    import { ${componentName} } from './components/${componentName}';
    
    function App() {
      return (
        <div>
          <${componentName} />
        </div>
      );
    }
    \`\`\`
    
    ## Features Included
    ${Object.entries(features).map(([feature, enabled]) => 
      enabled ? `- ✅ ${feature.replace(/_/g, ' ').toUpperCase()}` : `- ❌ ${feature.replace(/_/g, ' ').toUpperCase()}`
    ).join('\n')}
    
    ## Styling Options
    - **Theme**: ${styling.theme || 'default'}
    - **Custom CSS**: ${styling.customCss ? 'Enabled' : 'Disabled'}
    
    ${dataIntegration.apiEndpoint ? `
    ## API Integration
    - **Endpoint**: ${dataIntegration.apiEndpoint}
    - **Data Query**: ${dataIntegration.useDataQuery ? 'Enabled' : 'Disabled'}  
    - **Data Mutation**: ${dataIntegration.useDataMutation ? 'Enabled' : 'Disabled'}
    ` : ''}
    `;
    }
  • Registers the tool in TOOL_PERMISSIONS map, requiring 'canUseUITools' permission for access control.
    ['dhis2_create_ui_components', 'canUseUITools'],
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 does but doesn't describe how it behaves: Is this a code generation tool? Does it create files or return code snippets? What permissions or environment setup are required? Are there rate limits or side effects? The description lacks these critical behavioral details for a tool with complex parameters.

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 gets straight to the point with zero wasted words. It's appropriately sized for a tool name that already conveys the domain (DHIS2) and action (create UI components). Every word earns its place by specifying the technology context and purpose.

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 5 parameters (including complex nested objects), no annotations, no output schema, and only 40% schema description coverage, the description is insufficient. It doesn't explain what the tool returns (code? configuration files?), how parameters interact, or what 'using DHIS2 UI library patterns' entails. The agent lacks critical context to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'common UI components' but doesn't explain what parameters like 'features', 'dataIntegration', or 'styling' actually do or how they affect the output. With schema description coverage at only 40% (many parameters lack descriptions in the schema), the description fails to compensate by providing semantic context about these complex nested objects. The agent must guess at parameter meanings.

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 tool's purpose: 'Generate common UI components using DHIS2 UI library patterns.' It specifies the verb ('generate'), resource ('UI components'), and technology context ('DHIS2 UI library patterns'). However, it doesn't explicitly differentiate from sibling tools like 'dhis2_generate_ui_data_display' or 'dhis2_generate_ui_form_patterns', which appear to be more specialized UI generation tools.

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. With many sibling tools focused on UI generation (e.g., 'dhis2_generate_ui_data_display', 'dhis2_generate_ui_form_patterns'), there's no indication of scope boundaries, prerequisites, or typical use cases. The agent must infer usage from the tool name and parameters alone.

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