Skip to main content
Glama

tailwind_generate_config

Generate Tailwind CSS configuration from design tokens including colors, spacing, typography, and breakpoints for consistent UI/UX development.

Instructions

Generate Tailwind configuration from design tokens

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorsNo
spacingNo
typographyNo
breakpointsNo

Implementation Reference

  • Core handler function that parses input design tokens (colors, spacing, typography, breakpoints) and generates a Tailwind configuration object along with CSS variables.
    async generateConfig(args: any) {
      const params = TailwindConfigSchema.parse(args);
      
      try {
        // Generate Tailwind configuration based on design tokens
        const config = {
          content: ['./src/**/*.{js,jsx,ts,tsx,html}'],
          theme: {
            extend: {
              colors: this.processColors(params.colors),
              spacing: this.processSpacing(params.spacing),
              fontFamily: this.processFontFamily(params.typography),
              fontSize: this.processFontSizes(params.typography),
              screens: this.processBreakpoints(params.breakpoints)
            }
          },
          plugins: []
        };
    
        // Also generate CSS variables for design tokens
        const cssVariables = this.generateCSSVariables(params);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                tailwindConfig: config,
                cssVariables,
                usage: {
                  config: 'Save as tailwind.config.js',
                  css: 'Add CSS variables to your global styles',
                  example: 'bg-primary text-secondary p-spacing-md'
                }
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error generating Tailwind config: ${error.message}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod validation schema matching the tool's inputSchema for parsing arguments in generateConfig.
    const TailwindConfigSchema = z.object({
      colors: z.record(z.any()).optional(),
      spacing: z.record(z.any()).optional(),
      typography: z.record(z.any()).optional(),
      breakpoints: z.record(z.any()).optional()
    });
  • src/index.ts:95-106 (registration)
    Tool registration in the listTools response, defining name, description, and input schema.
      name: 'tailwind_generate_config',
      description: 'Generate Tailwind configuration from design tokens',
      inputSchema: {
        type: 'object',
        properties: {
          colors: { type: 'object' },
          spacing: { type: 'object' },
          typography: { type: 'object' },
          breakpoints: { type: 'object' }
        }
      }
    },
  • src/index.ts:308-309 (registration)
    Switch case in callTool handler that dispatches to the TailwindTools.generateConfig method.
    case 'tailwind_generate_config':
      return await this.tailwindTools.generateConfig(args);
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 states the tool generates configuration but doesn't explain how it processes input (e.g., validation, defaults), what output format to expect, or any side effects like file creation. This leaves significant gaps for a tool with complex nested parameters.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 (4 nested parameters, 0% schema coverage, no output schema, no annotations), the description is insufficient. It doesn't explain parameter usage, output format, or behavioral traits, leaving the agent with inadequate information to use the tool effectively.

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

Parameters2/5

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

The input schema has 0% description coverage, so the description must compensate. It mentions 'design tokens' but doesn't explain the four parameters (colors, spacing, typography, breakpoints) or their expected structures. This lack of detail fails to adequately supplement the bare schema.

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 Tailwind configuration from design tokens.' It specifies the verb ('generate'), resource ('Tailwind configuration'), and source ('design tokens'). However, it doesn't explicitly differentiate from sibling tools like 'tailwind_optimize_classes' or 'workflow_build_design_system,' which prevents a perfect score.

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. It doesn't mention sibling tools like 'tailwind_optimize_classes' for class optimization or 'workflow_build_design_system' for broader design system tasks, nor does it specify prerequisites or exclusions for usage.

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/willem4130/ui-ux-mcp-server'

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