Skip to main content
Glama
reallygood83

UI Expert MCP Server

by reallygood83

improve_component

Enhance UI component code by applying accessibility standards and development best practices for your specified framework.

Instructions

Improve existing UI component with best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentCodeYesCurrent component code
frameworkYesFrontend framework
improvementsNoSpecific improvements requested
accessibilityNoFocus on accessibility

Implementation Reference

  • The core handler function for the 'improve_component' tool. It takes parsed input parameters including component code, framework, optional improvements, and accessibility focus, then returns a markdown-formatted string with detailed improvement suggestions across performance, accessibility, code quality, styling, and best practices.
    function improveComponent(params: z.infer<typeof ImproveComponentSchema>): string {
      const { componentCode, framework, improvements = [], accessibility } = params;
      
      // This is a simplified example - in a real implementation, 
      // you'd parse and analyze the component code
      return `# Component Improvement Suggestions
    
    ## Original Component:
    \`\`\`${framework}
    ${componentCode}
    \`\`\`
    
    ## Improvements:
    
    ### 1. Performance Optimizations
    - Add React.memo() wrapper to prevent unnecessary re-renders
    - Use useCallback for event handlers
    - Implement lazy loading for heavy dependencies
    
    ### 2. Accessibility Enhancements
    ${accessibility ? `- Add proper ARIA labels and roles
    - Ensure keyboard navigation support
    - Implement focus management
    - Add screen reader announcements` : '- Consider adding ARIA labels for better accessibility'}
    
    ### 3. Code Quality
    - Extract magic numbers into constants
    - Add proper TypeScript types
    - Implement error boundaries
    - Add loading and error states
    
    ### 4. Styling Improvements
    - Use CSS modules or styled-components for scoped styles
    - Implement responsive design with mobile-first approach
    - Add hover and focus states
    - Use CSS custom properties for theming
    
    ### 5. Best Practices
    - Add prop validation
    - Implement proper component composition
    - Use semantic HTML elements
    - Add unit tests
    
    ${improvements.length > 0 ? `\n### Requested Improvements:\n${improvements.map(imp => `- ${imp}`).join('\n')}` : ''}`;
    }
  • Zod schema defining the input parameters for the 'improve_component' tool: required componentCode and framework, optional improvements array and accessibility boolean.
    const ImproveComponentSchema = z.object({
      componentCode: z.string().describe("Current component code"),
      framework: z.string().describe("Frontend framework being used"),
      improvements: z.array(z.string()).optional().describe("Specific improvements requested"),
      accessibility: z.boolean().optional().describe("Focus on accessibility improvements"),
    });
  • src/index.ts:93-110 (registration)
    Tool registration in the ListTools response, defining name, description, and inputSchema matching the Zod schema.
    {
      name: "improve_component",
      description: "Improve existing UI component with best practices",
      inputSchema: {
        type: "object",
        properties: {
          componentCode: { type: "string", description: "Current component code" },
          framework: { type: "string", description: "Frontend framework" },
          improvements: { 
            type: "array", 
            items: { type: "string" },
            description: "Specific improvements requested" 
          },
          accessibility: { type: "boolean", description: "Focus on accessibility" },
        },
        required: ["componentCode", "framework"],
      },
    },
  • src/index.ts:159-169 (registration)
    Handler case in the CallToolRequest switch statement that parses input with ImproveComponentSchema and calls the improveComponent function.
    case "improve_component": {
      const parsed = ImproveComponentSchema.parse(args);
      return {
        content: [
          {
            type: "text",
            text: improveComponent(parsed),
          },
        ],
      };
    }
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. 'Improve' implies mutation, but the description doesn't specify whether this is a destructive operation, what permissions are needed, whether changes are reversible, or what the output looks like. It mentions 'best practices' but doesn't explain what those entail or how they're applied.

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. There's no wasted language or unnecessary elaboration. However, it could be more front-loaded with critical information about what type of improvement occurs.

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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'improve' means operationally, what the output looks like, or what happens to the original component. The agent must guess whether this returns modified code, suggestions, or something else entirely.

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 four parameters thoroughly. The description adds no additional meaning beyond what's in the schema - it doesn't explain how parameters interact, provide examples of 'improvements', or clarify the relationship between 'framework' and 'best practices'. Baseline 3 is appropriate when the schema does the heavy lifting.

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's purpose ('Improve existing UI component') and mentions 'best practices', which provides some context. However, it's vague about what 'improve' entails and doesn't clearly differentiate from sibling tools like 'analyze_ui' or 'create_component'. It doesn't specify whether this is about code refactoring, performance optimization, or design enhancement.

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. There's no mention of prerequisites, when not to use it, or how it differs from sibling tools like 'analyze_ui' (which might analyze without improving) or 'create_component' (which creates new components). The agent must infer usage from the tool name 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/reallygood83/ui-expert-mcp'

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