Skip to main content
Glama

dhis2_generate_design_system

Generate design system tokens for DHIS2 applications, including color palettes, typography settings, spacing scales, and dark mode support to ensure consistent UI styling.

Instructions

Generate design system tokens (palette, typography, spacing) and dark mode support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
themeNoTheme name
enableDarkModeNoEnable prefers-color-scheme dark styles
paletteNoCustom color palette
typographyNoTypography settings (font family, scale)
spacingNoSpacing scale tokens
densityNoDensity guidance
rtlNoInclude RTL CSS variables

Implementation Reference

  • Handler for the 'dhis2_generate_design_system' tool: extracts arguments, calls generateDesignSystemConfig, and returns the generated config as text content.
    case 'dhis2_generate_design_system':
      const dsArgs = args as any;
      const dsConfig = generateDesignSystemConfig(dsArgs);
      return {
        content: [
          { type: 'text', text: dsConfig }
        ]
      };
  • Core implementation: generateDesignSystemConfig function that creates CSS custom properties (variables) for a design system theme based on provided palette, typography, and spacing parameters.
    export function generateDesignSystemConfig(args: any): string {
      const {
        theme = 'default',
        enableDarkMode = true,
        palette = {
          primary: '#0a6eb4',
          secondary: '#4a5568',
          success: '#0E7C86',
          warning: '#FFA400',
          danger: '#E53935'
        },
        typography = {
          fontFamily: 'Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji"',
          scale: [12, 14, 16, 20, 24, 32]
        },
        spacing = [4, 8, 12, 16, 24, 32]
      } = args;
    
      return `# Design System Configuration
    
    ## Theme Tokens (CSS Variables)
    \`\`\`css
    :root {
      --color-primary: ${palette.primary};
      --color-secondary: ${palette.secondary};
      --color-success: ${palette.success};
      --color-warning: ${palette.warning};
      --color-danger: ${palette.danger};
    
      --font-family-base: ${typography.fontFamily};
      --font-size-xs: ${typography.scale[0]}px;
      --font-size-sm: ${typography.scale[1]}px;
      --font-size-md: ${typography.scale[2]}px;
      --font-size-lg: ${typography.scale[3]}px;
      --font-size-xl: ${typography.scale[4]}px;
      --font-size-2xl: ${typography.scale[5]}px;
    
      --space-1: ${spacing[0]}px;
      --space-2: ${spacing[1]}px;
      --space-3: ${spacing[2]}px;
      --space-4: ${spacing[3]}px;
      --space-5: ${spacing[4]}px;
      --space-6: ${spacing[5]}px;
    }
    
    \`\`\`
    
    `;
    }
  • Tool permission registration: Maps 'dhis2_generate_design_system' to require 'canUseUITools' permission in the TOOL_PERMISSIONS Map used for filtering tools.
    private static readonly TOOL_PERMISSIONS = new Map<string, keyof UserPermissions | Array<keyof UserPermissions>>([
      // Configuration and connection
      ['dhis2_configure', 'canViewSystemInfo'],
      ['dhis2_get_system_info', 'canViewSystemInfo'],
      
      // Metadata operations - Data Elements
      ['dhis2_list_data_elements', 'canViewMetadata'],
      ['dhis2_create_data_element', 'canCreateMetadata'],
      ['dhis2_update_data_element', 'canUpdateMetadata'],
      ['dhis2_delete_data_element', 'canDeleteMetadata'],
      
      // Metadata operations - Data Sets
      ['dhis2_list_data_sets', 'canViewMetadata'],
      ['dhis2_create_data_set', 'canCreateMetadata'],
      
      // Metadata operations - Categories
      ['dhis2_list_categories', 'canViewMetadata'],
      ['dhis2_create_category', 'canCreateMetadata'],
      ['dhis2_list_category_options', 'canViewMetadata'],
      ['dhis2_create_category_option', 'canCreateMetadata'],
      ['dhis2_list_category_combos', 'canViewMetadata'],
      ['dhis2_create_category_combo', 'canCreateMetadata'],
      ['dhis2_list_category_option_combos', 'canViewMetadata'],
      
      // Organisation Units
      ['dhis2_list_org_units', 'canViewMetadata'],
      ['dhis2_list_org_unit_groups', 'canViewMetadata'],
      ['dhis2_create_org_unit_group', 'canCreateMetadata'],
      
      // Validation Rules
      ['dhis2_list_validation_rules', 'canViewMetadata'],
      ['dhis2_create_validation_rule', 'canCreateMetadata'],
      ['dhis2_run_validation', ['canViewData', 'canRunAnalytics']],
      
      // Data Values
      ['dhis2_get_data_values', 'canViewData'],
      ['dhis2_bulk_import_data_values', 'canImportData'],
      
      // Analytics
      ['dhis2_get_analytics', 'canRunAnalytics'],
      ['dhis2_get_data_statistics', 'canRunAnalytics'],
      
      // Programs (Tracker)
      ['dhis2_list_programs', 'canViewMetadata'],
      ['dhis2_create_program', 'canManagePrograms'],
      ['dhis2_list_tracked_entity_types', 'canViewMetadata'],
      ['dhis2_create_tracked_entity_type', 'canManagePrograms'],
      ['dhis2_list_tracked_entity_attributes', 'canViewMetadata'],
      ['dhis2_create_tracked_entity_attribute', 'canManagePrograms'],
      ['dhis2_list_program_stages', 'canViewMetadata'],
      ['dhis2_create_program_stage', 'canManagePrograms'],
      ['dhis2_list_program_rules', 'canViewMetadata'],
      ['dhis2_create_program_rule', 'canManagePrograms'],
      
      // Tracker Data
      ['dhis2_list_tracked_entity_instances', 'canViewTEI'],
      ['dhis2_create_tracked_entity_instance', 'canEnrollTEI'],
      ['dhis2_list_enrollments', 'canViewTEI'],
      ['dhis2_create_enrollment', 'canEnrollTEI'],
      ['dhis2_list_events', 'canViewTEI'],
      ['dhis2_create_event', 'canManageTrackerData'],
      ['dhis2_bulk_import_events', 'canImportData'],
      ['dhis2_get_event_analytics', 'canRunAnalytics'],
      ['dhis2_get_enrollment_analytics', 'canRunAnalytics'],
      
      // Dashboards and Visualizations
      ['dhis2_list_dashboards', 'canViewData'],
      ['dhis2_create_dashboard', 'canManageDashboards'],
      ['dhis2_list_visualizations', 'canViewData'],
      ['dhis2_create_visualization', 'canManageDashboards'],
      ['dhis2_list_reports', 'canViewData'],
      ['dhis2_generate_report', 'canExportData'],
      
      // Web App Platform Tools
      ['dhis2_init_webapp', 'canConfigureApps'],
      ['dhis2_configure_app_manifest', 'canConfigureApps'],
      ['dhis2_configure_build_system', 'canConfigureApps'],
      ['dhis2_setup_dev_environment', 'canConfigureApps'],
      ['dhis2_generate_app_runtime_config', 'canConfigureApps'],
      ['dhis2_create_datastore_namespace', 'canConfigureApps'],
      ['dhis2_manage_datastore_key', 'canConfigureApps'],
      ['dhis2_setup_authentication_patterns', 'canConfigureApps'],
      ['dhis2_create_ui_components', 'canUseUITools'],
      ['dhis2_generate_test_setup', 'canConfigureApps'],
      
      // Debugging Tools
      ['dhis2_diagnose_cors_issues', 'canDebugApplications'],
      ['dhis2_configure_cors_allowlist', 'canDebugApplications'],
      ['dhis2_debug_authentication', 'canDebugApplications'],
      ['dhis2_fix_proxy_configuration', 'canDebugApplications'],
      ['dhis2_resolve_build_issues', 'canDebugApplications'],
      ['dhis2_optimize_performance', 'canDebugApplications'],
      ['dhis2_validate_environment', 'canDebugApplications'],
      ['dhis2_migration_assistant', 'canDebugApplications'],
      
      // Android SDK Tools
      ['dhis2_android_init_project', 'canUseMobileFeatures'],
      ['dhis2_android_configure_gradle', 'canUseMobileFeatures'],
      ['dhis2_android_setup_sync', 'canConfigureMobile'],
      ['dhis2_android_configure_storage', 'canConfigureMobile'],
      ['dhis2_android_setup_location_services', 'canUseMobileFeatures'],
      ['dhis2_android_configure_camera', 'canUseMobileFeatures'],
      ['dhis2_android_setup_authentication', 'canConfigureMobile'],
      ['dhis2_android_generate_data_models', 'canUseMobileFeatures'],
      ['dhis2_android_setup_testing', 'canUseMobileFeatures'],
      ['dhis2_android_configure_ui_patterns', 'canUseMobileFeatures'],
      ['dhis2_android_setup_offline_analytics', 'canUseMobileFeatures'],
      ['dhis2_android_configure_notifications', 'canUseMobileFeatures'],
      ['dhis2_android_performance_optimization', 'canUseMobileFeatures'],
      
      // UI Library Tools
      ['dhis2_generate_ui_form_patterns', 'canUseUITools'],
      ['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'],
    ]);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'generates' design system tokens, implying a creation or output operation, but doesn't specify whether this is a read-only generation (e.g., producing code snippets) or a write operation (e.g., modifying files). It also lacks details on permissions, side effects, rate limits, or output format, which are critical for a tool with 7 parameters and no output schema.

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: 'Generate design system tokens (palette, typography, spacing) and dark mode support'. It is front-loaded with the core action and resources, with no wasted words or redundancy. Every part of the sentence contributes directly to understanding the tool's 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?

Given the complexity (7 parameters, nested objects, no output schema) and lack of annotations, the description is incomplete. It doesn't explain what the tool outputs (e.g., code, configuration files), how the generated tokens are used, or any behavioral traits like error handling. For a tool that likely produces significant UI-related assets, more context is needed to ensure correct 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?

The description mentions 'palette, typography, spacing' and 'dark mode support', which aligns with parameters like 'palette', 'typography', 'spacing', and 'enableDarkMode'. However, with 100% schema description coverage, the schema already documents all 7 parameters thoroughly. The description adds minimal value beyond the schema, such as hinting at the purpose of these tokens, but doesn't provide additional syntax, format details, or usage examples.

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 design system tokens (palette, typography, spacing) and dark mode support'. It specifies the verb 'generate' and resources 'design system tokens', making the action and output clear. However, it doesn't explicitly differentiate from sibling tools like 'dhis2_generate_ui_data_display' or 'dhis2_generate_ui_form_patterns', which also generate UI-related outputs, so it misses full sibling differentiation.

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 any prerequisites, context for generating design systems, or how it relates to sibling tools such as 'dhis2_configure_ui_patterns' or 'dhis2_create_ui_components'. Without such information, users must infer usage from the name alone, leading to potential misuse.

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