Autocorrect Component
autocorrect_componentAnalyze and correct React components to enforce design consistency by fixing hardcoded colors, missing glass treatments, and incorrect typography tokens against active UI presets.
Instructions
Analyze a React component and auto-correct it against the active preset. Corrects: hardcoded colors, missing glass treatment, wrong typography tokens, wrong animation tokens, non-conforming sidebar/settings structure.
Args:
code (string): React component source code (max 10,000 chars)
context ('sidebar'|'settings'|'dashboard'|'surface'|'navigation'|'form'|'auto'): Component context hint for targeted rules (default: 'auto')
dry_run (boolean): Return issues without changing code (default: false)
Returns:
corrected: Fixed component code
issues: Array of UIIssue objects with severity, rule, message, fix
appliedFixes: List of changes made
score: Conformance score before correction (0-100)
Requires active preset (run load_preset first).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "autocorrect_component"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | React component source code (max 10,000 chars) | |
| context | No | Component context hint for targeted rules | auto |
| dry_run | No | Return issues without changing code |