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

create_layout

Generate responsive layouts with Tailwind CSS for dashboards, landing pages, blogs, ecommerce sites, portfolios, and documentation. Specify layout sections and complexity to create HTML, React, Vue, or Svelte components.

Instructions

Generate responsive layouts with Tailwind CSS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesLayout type
sectionsYesLayout sections (header, sidebar, main, footer, etc.)
complexityNoLayout complexitymedium
frameworkNoTarget frameworkhtml

Implementation Reference

  • src/index.ts:361-392 (registration)
    Registration of the 'create_layout' tool in the TOOLS array, including name, description, and input schema validation.
    {
      name: 'create_layout',
      description: 'Generate responsive layouts with Tailwind CSS',
      inputSchema: {
        type: 'object',
        properties: {
          type: {
            type: 'string',
            enum: ['dashboard', 'landing', 'blog', 'ecommerce', 'portfolio', 'documentation'],
            description: 'Layout type'
          },
          sections: {
            type: 'array',
            items: { type: 'string' },
            description: 'Layout sections (header, sidebar, main, footer, etc.)'
          },
          complexity: {
            type: 'string',
            enum: ['simple', 'medium', 'complex'],
            default: 'medium',
            description: 'Layout complexity'
          },
          framework: {
            type: 'string',
            enum: ['html', 'react', 'vue', 'svelte'],
            default: 'html',
            description: 'Target framework'
          }
        },
        required: ['type', 'sections']
      }
    }
  • src/index.ts:449-450 (registration)
    Dispatch/registration of the create_layout handler in the CallToolRequestSchema switch statement.
    case 'create_layout':
      return await createLayout(args as unknown as LayoutOptions);
  • Core handler implementation for the create_layout tool. Generates responsive Tailwind CSS layouts using Gemini AI prompt or fallback template generators, cleans output, and returns formatted response with documentation.
    export async function createLayout(args: LayoutRequest) {
      try {
        const {
          type,
          sections,
          complexity = 'medium',
          framework = 'html'
        } = args;
    
        let layoutCode = '';
    
        if (isGeminiAvailable()) {
          const prompt = `Generate a complete ${complexity} ${type} layout using Tailwind CSS with the following specifications:
    
    Layout Type: ${type}
    Sections: ${sections.join(', ')}
    Complexity: ${complexity}
    Framework: ${framework}
    
    Requirements:
    1. Create a fully responsive layout using Tailwind CSS
    2. Include proper semantic HTML structure
    3. Use modern CSS Grid and Flexbox techniques
    4. Implement mobile-first responsive design
    5. Include placeholder content that's realistic for a ${type}
    6. Add proper spacing, typography, and visual hierarchy
    7. Include interactive elements with hover states
    8. Ensure accessibility with proper ARIA labels
    9. Use appropriate color scheme and styling
    
    ${framework === 'react' ? 'Generate as React functional components with TypeScript' : ''}
    ${framework === 'vue' ? 'Generate as Vue 3 composition API components' : ''}
    ${framework === 'svelte' ? 'Generate as Svelte components' : ''}
    
    For ${type} layout, focus on:
    ${getLayoutFocusPoints(type)}
    
    Return complete, production-ready code with proper structure and styling.`;
    
          layoutCode = await callGemini(prompt);
        } else {
          layoutCode = generateTemplateLayout(type, sections, complexity, framework);
        }
    
        // Clean up the generated code
        layoutCode = layoutCode.replace(/```[\w]*\n?/g, '').trim();
    
        return {
          content: [
            {
              type: 'text',
              text: `# ${type.charAt(0).toUpperCase() + type.slice(1)} Layout - ${complexity.charAt(0).toUpperCase() + complexity.slice(1)} Complexity
    
    ## Generated Layout
    \`\`\`${framework === 'html' ? 'html' : framework}
    ${layoutCode}
    \`\`\`
    
    ## Layout Features
    - **Type**: ${type}
    - **Complexity**: ${complexity}
    - **Framework**: ${framework}
    - **Sections**: ${sections.join(', ')}
    
    ## Responsive Breakpoints
    - **Mobile**: Base styles (< 640px)
    - **Tablet**: sm: prefix (≥ 640px)
    - **Desktop**: md: prefix (≥ 768px)
    - **Large**: lg: prefix (≥ 1024px)
    - **Extra Large**: xl: prefix (≥ 1280px)
    
    ## Customization Tips
    - Adjust color scheme by modifying color classes
    - Change spacing with different padding/margin classes
    - Modify typography with font size and weight classes
    - Add animations with transition and transform classes
    - Customize breakpoints for different responsive behavior
    
    ## Accessibility Features
    - Semantic HTML structure
    - Proper heading hierarchy
    - ARIA labels where appropriate
    - Keyboard navigation support
    - Screen reader friendly content
    
    ## Performance Considerations
    - Optimized class usage
    - Minimal custom CSS required
    - Efficient responsive design
    - Fast rendering with Tailwind's utility-first approach`
            }
          ]
        };
      } catch (error) {
        console.error('Layout generation error:', error);
        throw new Error(`Failed to create layout: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Generate' but doesn't specify whether this creates new files, modifies existing ones, requires authentication, has rate limits, or what the output format is (e.g., HTML code, a preview URL). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence: 'Generate responsive layouts with Tailwind CSS'. It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a tool with a clear scope.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'Generate' entails (e.g., returns code, creates files), how layouts are delivered, or any behavioral traits like side effects. For a tool with 4 parameters and potential complexity in output, more context is needed to guide the agent effectively.

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?

Schema description coverage is 100%, so the schema fully documents all 4 parameters (type, sections, complexity, framework) with enums and defaults. The description adds no parameter-specific information beyond implying Tailwind CSS usage, which is already suggested by the tool name. Baseline 3 is appropriate when the schema handles parameter documentation.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Generate responsive layouts with Tailwind CSS'. It specifies the action ('Generate'), resource ('responsive layouts'), and technology ('Tailwind CSS'). However, it doesn't explicitly differentiate from sibling tools like 'create_project' or 'generate_component', which might also involve layout generation.

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. With siblings like 'create_project', 'generate_component', and 'suggest_improvements', there's no indication of context, prerequisites, or exclusions. The agent must infer usage from the tool name and parameters alone.

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