Skip to main content
Glama

analyze_design

Evaluate HTML and CSS designs for accessibility, responsiveness, and performance using AI. Enhance designs by identifying improvements and ensuring best practices are followed.

Instructions

Analyze design with AI for improvements and best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
checkAccessibilityNoCheck accessibility compliance
checkPerformanceNoCheck performance implications
checkResponsiveNoCheck responsive design
contextNoDesign context or purpose
cssNoAdditional CSS code (optional)
htmlYesHTML code to analyze

Implementation Reference

  • src/index.ts:230-267 (registration)
    Registration of the analyze_design tool in the TOOLS array used by ListToolsRequestHandler
    }, { name: 'analyze_design', description: 'Analyze design with AI for improvements and best practices', inputSchema: { type: 'object', properties: { html: { type: 'string', description: 'HTML code to analyze' }, css: { type: 'string', description: 'Additional CSS code (optional)' }, context: { type: 'string', description: 'Design context or purpose' }, checkAccessibility: { type: 'boolean', default: true, description: 'Check accessibility compliance' }, checkResponsive: { type: 'boolean', default: true, description: 'Check responsive design' }, checkPerformance: { type: 'boolean', default: true, description: 'Check performance implications' } }, required: ['html'] } },
  • Dispatch handler in the CallToolRequestSchema that invokes the analyzeDesign function for the analyze_design tool
    case 'analyze_design': return await analyzeDesign(args as unknown as DesignAnalysisOptions);
  • The core handler function implementation for the analyze_design MCP tool
    export async function analyzeDesign(args: DesignAnalysisOptions) { return { content: [ { type: 'text', text: `Analyzed design for ${args.context || 'general'} context\nHTML length: ${args.html.length} characters` } ] };
  • Detailed input schema validation for analyze_design tool parameters
    description: 'Analyze design with AI for improvements and best practices', inputSchema: { type: 'object', properties: { html: { type: 'string', description: 'HTML code to analyze' }, css: { type: 'string', description: 'Additional CSS code (optional)' }, context: { type: 'string', description: 'Design context or purpose' }, checkAccessibility: { type: 'boolean', default: true, description: 'Check accessibility compliance' }, checkResponsive: { type: 'boolean', default: true, description: 'Check responsive design' }, checkPerformance: { type: 'boolean', default: true, description: 'Check performance implications' } }, required: ['html'] }
  • Comprehensive helper function for design analysis with AI (Gemini) integration and manual fallback analysis, matching the tool's input schema.
    export async function analyzeDesign(args: AnalyzeRequest) { try { const { html, css = '', context = '', checkAccessibility = true, checkResponsive = true, checkPerformance = true } = args; if (isGeminiAvailable()) { const prompt = `Analyze this HTML/CSS code for design quality, best practices, and improvements: HTML: ${html} ${css ? `CSS:\n${css}` : ''} ${context ? `Context: ${context}` : ''} Please provide a comprehensive analysis covering: ${checkAccessibility ? '1. **Accessibility**: Check for ARIA labels, semantic HTML, color contrast, keyboard navigation, screen reader compatibility' : ''} ${checkResponsive ? '2. **Responsive Design**: Evaluate mobile-first approach, breakpoints, flexible layouts' : ''} ${checkPerformance ? '3. **Performance**: Analyze CSS efficiency, bundle size implications, render performance' : ''} 4. **Design Quality**: Visual hierarchy, spacing consistency, typography, color usage 5. **Code Quality**: Tailwind best practices, maintainability, reusability 6. **UX Considerations**: Usability, interaction patterns, user flow For each area, provide: - Current state assessment (Good/Needs Improvement/Poor) - Specific issues found - Actionable recommendations - Code examples for improvements Format as structured markdown with clear sections.`; const analysis = await callGemini(prompt); return { content: [ { type: 'text', text: `# Design Analysis Report\n\n${analysis}` } ] }; } else { // Fallback manual analysis const manualAnalysis = performManualAnalysis(html, css, checkAccessibility, checkResponsive, checkPerformance); return { content: [ { type: 'text', text: manualAnalysis } ] }; } } catch (error) { console.error('Design analysis error:', error); throw new Error(`Failed to analyze design: ${error instanceof Error ? error.message : 'Unknown error'}`); } }

Other Tools

Related 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/Tai-DT/mcp-tailwind-gemini'

If you have feedback or need assistance with the MCP directory API, please join our Discord server