optimize_classes
Optimize and clean up Tailwind CSS classes in HTML by removing redundant styles, resolving conflicts, and suggesting better alternatives.
Instructions
Optimize and clean up Tailwind CSS classes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | HTML with Tailwind classes to optimize | |
| removeRedundant | No | Remove redundant classes | |
| mergeConflicts | No | Resolve conflicting classes | |
| suggestAlternatives | No | Suggest better alternatives |
Implementation Reference
- src/index.ts:160-188 (registration)Registration of the 'optimize_classes' tool in the TOOLS array, including description and JSON input schema
{ name: 'optimize_classes', description: 'Optimize and clean up Tailwind CSS classes', inputSchema: { type: 'object', properties: { html: { type: 'string', description: 'HTML with Tailwind classes to optimize' }, removeRedundant: { type: 'boolean', default: true, description: 'Remove redundant classes' }, mergeConflicts: { type: 'boolean', default: true, description: 'Resolve conflicting classes' }, suggestAlternatives: { type: 'boolean', default: true, description: 'Suggest better alternatives' } }, required: ['html'] } }, - src/utils/tool-functions.ts:28-37 (handler)The handler function implementing the optimize_classes tool logic. Currently a placeholder that returns a mock optimization response.
export async function optimizeClasses(args: ClassOptimizationOptions) { return { content: [ { type: 'text', text: `Optimized classes: ${args.classes}\nContext: ${args.context || 'general'}` } ] }; } - src/index.ts:437-438 (registration)Tool dispatch in the switch statement that routes 'optimize_classes' calls to the handler function.
case 'optimize_classes': return await optimizeClasses(args as unknown as ClassOptimizationOptions); - src/types.ts:16-24 (schema)TypeScript interface defining the expected input parameters for the optimize_classes handler (note: slight mismatch with JSON schema).
export interface ClassOptimizationOptions { classes: string; context?: 'component' | 'layout' | 'utility' | 'responsive'; removeRedundant?: boolean; sortClasses?: boolean; suggestAlternatives?: boolean; checkConflicts?: boolean; framework?: 'tailwind' | 'unocss' | 'windicss'; }