Skip to main content
Glama
Tai-DT
by Tai-DT

analyze_design

Analyze HTML and CSS designs to identify improvements in accessibility, responsiveness, and performance using AI-powered best practices.

Instructions

Analyze design with AI for improvements and best practices

Input Schema

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

Implementation Reference

  • The primary handler function for the 'analyze_design' tool, called directly from src/index.ts. Currently implemented as a placeholder that returns basic analysis info.
    export async function analyzeDesign(args: DesignAnalysisOptions) {
      return {
        content: [
          {
            type: 'text',
            text: `Analyzed design for ${args.context || 'general'} context\nHTML length: ${args.html.length} characters`
          }
        ]
      };
  • src/index.ts:231-267 (registration)
    Registration of the 'analyze_design' tool in the TOOLS array, used by ListToolsRequestSchema handler. Includes name, description, and input schema.
    {
      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 switch statement that invokes the analyzeDesign function for 'analyze_design' tool calls.
    case 'analyze_design':
      return await analyzeDesign(args as unknown as DesignAnalysisOptions);
  • TypeScript interface defining the input options for the analyzeDesign function, matching the tool's inputSchema.
    export interface DesignAnalysisOptions {
      html: string;
      context?: 'landing-page' | 'dashboard' | 'component' | 'form' | 'navigation' | 'layout' | 'general';
      checkAccessibility?: boolean;
      checkResponsive?: boolean;
      checkPerformance?: boolean;
      checkUsability?: boolean;
      checkBrandConsistency?: boolean;
      framework?: 'react' | 'vue' | 'svelte' | 'html';
      designSystem?: string;
    }
  • Comprehensive helper implementation of analyzeDesign with AI-powered analysis via Gemini and fallback manual checks, not currently used by the main tool handler.
    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'}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'AI analysis' but doesn't explain what that entails—whether it's a simple check, a detailed report, or something else. There's no information about execution time, rate limits, authentication requirements, or what happens to the input data. For a tool with 6 parameters and no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for a tool with this complexity, though it could be more front-loaded with key details. There's no wasted language, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the analysis outputs, how results are formatted, or what 'improvements and best practices' entail. Without annotations or output schema, the agent lacks crucial information about the tool's behavior and results, making this description inadequate for confident tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all parameters well-documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the schema—it doesn't explain relationships between parameters, provide examples, or clarify how 'context' interacts with analysis. Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'analyze design with AI for improvements and best practices', which provides a general purpose but lacks specificity about what 'design' means or what types of improvements are offered. It doesn't clearly distinguish from sibling tools like 'suggest_improvements' or 'optimize_classes', leaving ambiguity about when to use each. The verb 'analyze' is clear, but the resource 'design' is vague without further context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'suggest_improvements' or 'optimize_classes'. There's no mention of prerequisites, specific scenarios where this analysis is appropriate, or any exclusions. The agent must infer usage from the tool name and parameters alone, which is insufficient for effective tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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