detect_intent
Detects UI intent from code patterns and suggests appropriate presets.
Reference
Returns
{
suggestions Array of intent detections with:
intent Detected intent type (destructive-action, primary-action, success-indicator, etc.)
intentLabel Human-readable label
confidence How confident the detection is (0-1)
currentCode The code as written
suggestedCode The corrected code with preset
suggestedPreset Which preset to use
suggestedComponent Which component to use
suggestion Human-readable explanation
signals What led to this detection (text, styling, props, etc.)
summary Count by intent type
}
Description
Detects UI intent from code patterns and suggests appropriate presets.
Unlike rules-based linting (which catches "bg-red-500 is not a token"), this tool understands WHAT the developer is trying to build and suggests the RIGHT preset.
Example: Instead of "bg-red-500 is not a token", this returns: "This looks like a destructive action. Use <Button preset='destructive-action'> instead."
Parameters:
- code (required): The code to analyze
- minConfidence (optional): Minimum confidence to include (0-1, default: 0.5)
- intent (optional): Filter by specific intent type
Intent types detected:
- destructive-action: Delete, remove, cancel with red styling
- primary-action: Submit, save, confirm - main CTA
- secondary-action: Cancel, back, skip - secondary actions
- success-indicator, error-indicator, warning-indicator, info-indicator: Status states
- form-input, search-input: Input types
- navigation-link, dropdown-trigger, icon-button, status-badge
Source
Defined in packages/mcp/src/tools.ts.
The request handler lives alongside its registration in packages/mcp/src/tools/.
Last reviewed by @jschuyler