Skip to main content
Glama
reallygood83

UI Expert MCP Server

by reallygood83

create_component

Generate UI components with modern best practices for React, Vue, or Angular frameworks, including accessibility features and responsive design options.

Instructions

Create a new UI component with modern best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentTypeYesType of component
frameworkYesFrontend framework
variantNoComponent variant
responsiveNoMake responsive
propsNoComponent props

Implementation Reference

  • Core handler function that dispatches to framework-specific component generators based on input parameters.
    function createComponent(params: z.infer<typeof CreateComponentSchema>): string {
      const { componentType, framework, variant = 'primary', responsive = true, props = {} } = params;
      
      // Generate component based on framework
      if (framework.toLowerCase() === 'react') {
        return generateReactComponent(componentType, variant, responsive, props);
      } else if (framework.toLowerCase() === 'vue') {
        return generateVueComponent(componentType, variant, responsive, props);
      } else {
        return `# ${componentType} Component
    
    Framework: ${framework}
    Variant: ${variant}
    Responsive: ${responsive}
    
    ## Implementation Guide:
    
    1. Create component structure
    2. Add styling with design tokens
    3. Implement interactivity
    4. Add accessibility features
    5. Test across devices
    
    Note: Specific implementation depends on ${framework} best practices.`;
      }
    }
  • Zod schema defining the input parameters for the create_component tool.
    const CreateComponentSchema = z.object({
      componentType: z.string().describe("Type of component (button, card, navbar, etc)"),
      framework: z.string().describe("Frontend framework to use"),
      variant: z.string().optional().describe("Component variant (primary, secondary, etc)"),
      responsive: z.boolean().optional().default(true).describe("Make component responsive"),
      props: z.record(z.any()).optional().describe("Component props/options"),
    });
  • src/index.ts:111-125 (registration)
    Tool registration in the ListTools response, specifying name, description, and input schema.
    {
      name: "create_component", 
      description: "Create a new UI component with modern best practices",
      inputSchema: {
        type: "object",
        properties: {
          componentType: { type: "string", description: "Type of component" },
          framework: { type: "string", description: "Frontend framework" },
          variant: { type: "string", description: "Component variant" },
          responsive: { type: "boolean", description: "Make responsive" },
          props: { type: "object", description: "Component props" },
        },
        required: ["componentType", "framework"],
      },
    },
  • MCP CallToolRequest handler case that parses inputs and calls the createComponent function.
    case "create_component": {
      const parsed = CreateComponentSchema.parse(args);
      return {
        content: [
          {
            type: "text",
            text: createComponent(parsed),
          },
        ],
      };
    }
  • Helper function that generates React component code, primarily for button-like components.
    function generateReactComponent(type: string, variant: string, responsive: boolean, props: any): string {
      const componentName = type.charAt(0).toUpperCase() + type.slice(1);
      
      return `import React from 'react';
    import { cn } from '@/lib/utils';
    
    interface ${componentName}Props {
      children?: React.ReactNode;
      className?: string;
      variant?: '${variant}' | 'secondary' | 'outline';
      size?: 'sm' | 'md' | 'lg';
      disabled?: boolean;
      onClick?: () => void;
    }
    
    export const ${componentName}: React.FC<${componentName}Props> = ({
      children,
      className,
      variant = '${variant}',
      size = 'md',
      disabled = false,
      onClick,
      ...props
    }) => {
      const baseStyles = 'inline-flex items-center justify-center font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50';
      
      const variants = {
        ${variant}: 'bg-primary-600 text-white hover:bg-primary-700 focus-visible:ring-primary-500',
        secondary: 'bg-neutral-100 text-neutral-900 hover:bg-neutral-200 focus-visible:ring-neutral-500',
        outline: 'border border-neutral-300 bg-transparent hover:bg-neutral-50 focus-visible:ring-neutral-500',
      };
      
      const sizes = {
        sm: 'h-9 px-3 text-sm rounded-md',
        md: 'h-10 px-4 text-base rounded-lg',
        lg: 'h-12 px-6 text-lg rounded-lg',
      };
      
      return (
        <button
          className={cn(
            baseStyles,
            variants[variant],
            sizes[size],
            ${responsive ? "'responsive-padding'" : ''},
            className
          )}
          disabled={disabled}
          onClick={onClick}
          {...props}
        >
          {children}
        </button>
      );
    };
    
    // Usage example:
    // <${componentName} variant="${variant}" size="md" onClick={() => console.log('Clicked!')}>
    //   Click me
    // </${componentName}>`;
    }
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 this is a creation tool but doesn't address permissions needed, whether it's idempotent, what happens on failure, or any rate limits. 'Modern best practices' is vague and doesn't clarify behavioral traits.

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 with zero wasted words. It's appropriately sized and front-loaded with the core purpose, making it easy to scan and understand 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?

For a creation tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'create' entails (e.g., file generation, API call), what the return value might be, or how 'modern best practices' influences behavior, leaving significant gaps for an AI agent.

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 already documents all 5 parameters. The description adds no additional meaning about parameters beyond implying 'modern best practices' might relate to them, but this is too vague to provide real value over the 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 verb ('create') and resource ('new UI component'), and specifies 'with modern best practices' adds some differentiation. However, it doesn't explicitly distinguish this from sibling tools like 'improve_component' or 'analyze_ui', 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 like 'improve_component' or 'generate_design_tokens'. It mentions 'modern best practices' but doesn't specify contexts, 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/reallygood83/ui-expert-mcp'

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