[Sprint 1] feat: Implement DMC validation tools (3 tools) #172

Closed
opened 2026-01-26 16:20:41 +00:00 by lmiranda · 1 comment
Owner

Description

Implement the three DMC component validation tools that prevent Claude from hallucinating invalid props.

Acceptance Criteria

  • Implement list_components tool:
    • Input: category?: string (optional filter)
    • Output: Component names grouped by category
    • Uses component_registry.py
  • Implement get_component_props tool:
    • Input: component: string
    • Output: Props schema with types, defaults, enum values
    • Returns error if component not found
  • Implement validate_component tool:
    • Input: component: string, props: object
    • Output: {valid: bool, errors: [], warnings: []}
    • Validates prop types, required props, unknown props
  • All tools registered in server.py list_tools()
  • All tools have proper JSON schemas

Technical Notes

These are the "constraint layer" tools - they MUST be accurate to the installed DMC version. Invalid validation = runtime errors for users.

Error messages should be actionable:

❌ Invalid prop 'colours' for Button. Did you mean 'color'?
❌ Prop 'size' expects one of ['xs', 'sm', 'md', 'lg', 'xl'], got 'huge'

Dependencies

  • Depends on #170 (MCP server foundation)
  • Depends on #171 (Component registry)
## Description Implement the three DMC component validation tools that prevent Claude from hallucinating invalid props. ## Acceptance Criteria - [ ] Implement `list_components` tool: - Input: `category?: string` (optional filter) - Output: Component names grouped by category - Uses component_registry.py - [ ] Implement `get_component_props` tool: - Input: `component: string` - Output: Props schema with types, defaults, enum values - Returns error if component not found - [ ] Implement `validate_component` tool: - Input: `component: string, props: object` - Output: `{valid: bool, errors: [], warnings: []}` - Validates prop types, required props, unknown props - [ ] All tools registered in server.py list_tools() - [ ] All tools have proper JSON schemas ## Technical Notes These are the "constraint layer" tools - they MUST be accurate to the installed DMC version. Invalid validation = runtime errors for users. Error messages should be actionable: ``` ❌ Invalid prop 'colours' for Button. Did you mean 'color'? ❌ Prop 'size' expects one of ['xs', 'sm', 'md', 'lg', 'xl'], got 'huge' ``` ## Dependencies - Depends on #170 (MCP server foundation) - Depends on #171 (Component registry)
Author
Owner

Completed: DMC validation tools implemented.

Tools Added:

  1. list_components - Lists DMC components by category
  2. get_component_props - Gets props schema with types, defaults, enum values
  3. validate_component - Validates props with errors/warnings

Features:

  • Typo detection for component names and props
  • Common mistake warnings (class vs className, onClick vs n_clicks)
  • All tools registered in MCP server with JSON schemas

Test Results:

  • 134 components across 10 categories loaded
  • Typo detection: "colour" → "Did you mean 'color'?"
  • Enum validation: "huge" not in ['filled', 'light', ...]
  • Common mistakes: warns about 'class' instead of 'className'

Commit: 67fae6a

Completed: DMC validation tools implemented. **Tools Added:** 1. `list_components` - Lists DMC components by category 2. `get_component_props` - Gets props schema with types, defaults, enum values 3. `validate_component` - Validates props with errors/warnings **Features:** - Typo detection for component names and props - Common mistake warnings (class vs className, onClick vs n_clicks) - All tools registered in MCP server with JSON schemas **Test Results:** - 134 components across 10 categories loaded - Typo detection: "colour" → "Did you mean 'color'?" - Enum validation: "huge" not in ['filled', 'light', ...] - Common mistakes: warns about 'class' instead of 'className' **Commit:** 67fae6a
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#172