Skip to main content
Glama

apply_material_ui_best_practices

Apply Material-UI best practices like theme.spacing, alpha functions, and sx prop to React components for consistent styling and improved maintainability.

Instructions

Aplica best practices do Material-UI (theme.spacing, alpha, sx prop)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesCódigo do componente ou nome do arquivo

Implementation Reference

  • Handler for 'apply_material_ui_best_practices' tool: returns pre-defined Material-UI best practices instructions and example, referencing the input component.
    case 'apply_material_ui_best_practices':
      return {
        content: [
          {
            type: 'text',
            text: `${UX_GUIDELINES.materialUI.instructions}\n\n**Exemplo:**\n${UX_GUIDELINES.materialUI.example}\n\n**Componente:** ${args.component}`,
          },
        ],
      };
  • index.js:417-430 (registration)
    Registration of the 'apply_material_ui_best_practices' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'apply_material_ui_best_practices',
      description: 'Aplica best practices do Material-UI (theme.spacing, alpha, sx prop)',
      inputSchema: {
        type: 'object',
        properties: {
          component: {
            type: 'string',
            description: 'Código do componente ou nome do arquivo',
          },
        },
        required: ['component'],
      },
    },
  • Input schema definition for the tool: requires a 'component' string.
    inputSchema: {
      type: 'object',
      properties: {
        component: {
          type: 'string',
          description: 'Código do componente ou nome do arquivo',
        },
      },
      required: ['component'],
    },
  • UX_GUIDELINES.materialUI object containing the instructions and example text returned by the handler.
      materialUI: {
        description: "Aplica best practices do Material-UI",
        instructions: `
    **Material-UI Best Practices:**
    
    1. Use theme.spacing (múltiplos de 8px):
       \`\`\`typescript
       sx={{ padding: theme.spacing(2), margin: theme.spacing(1, 2) }}
       \`\`\`
    
    2. Use alpha() para transparências:
       \`\`\`typescript
       import { alpha } from '@mui/material/styles';
       bgcolor: alpha(theme.palette.primary.main, 0.1)
       \`\`\`
    
    3. Prefira sx prop ao invés de styled:
       \`\`\`typescript
       <Box sx={{ display: 'flex', gap: 2 }} />
       \`\`\`
    
    4. Componentes nativos MUI:
       - Stack para layout linear
       - Box para container genérico
       - Paper para elevação/card
    
    5. Transitions suaves:
       \`\`\`typescript
       transition: theme.transitions.create(['all'], {
         duration: theme.transitions.duration.standard,
         easing: theme.transitions.easing.easeInOut,
       })
       \`\`\`
        `,
        example: `
    <Paper
      sx={{
        p: theme.spacing(3),
        bgcolor: alpha(theme.palette.background.paper, 0.95),
        transition: theme.transitions.create(['transform', 'box-shadow'], {
          duration: 250,
          easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
        }),
        '&:hover': {
          transform: 'translateY(-2px)',
          boxShadow: theme.shadows[8],
        },
      }}
    >
        `
      },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions what practices are applied but doesn't describe how the tool behaves: whether it modifies code in-place, generates recommendations, requires specific permissions, has side effects, or what format the output takes. For a tool that presumably transforms code, this lack of behavioral context is significant.

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 extremely concise - a single sentence that efficiently lists the specific Material-UI practices being applied. Every element (theme.spacing, alpha, sx prop) earns its place by specifying scope. However, it could be more front-loaded with the core purpose before listing techniques.

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 tool with no annotations, no output schema, and a single parameter, the description is incomplete. It doesn't explain what the tool actually does (transform code? generate suggestions?), what the expected outcome is, or any behavioral characteristics. While concise, it leaves too many questions unanswered for effective agent use.

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 the single 'component' parameter. The description doesn't add any parameter-specific information beyond what's in the schema. It doesn't clarify what format 'component' should be in, provide examples, or explain how the parameter interacts with the best practices application. Baseline 3 is appropriate when schema does the documentation work.

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 action ('Aplica' - applies) and the target ('best practices do Material-UI'), specifying concrete techniques like theme.spacing, alpha, and sx prop. It distinguishes itself from siblings by focusing specifically on Material-UI practices rather than other design systems or UX principles. However, it doesn't specify what exactly gets applied to (e.g., code transformation, documentation 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 its siblings. While it's clear this is for Material-UI best practices, there's no indication of appropriate contexts, prerequisites, or alternatives. The user must infer usage based solely on the tool name and description without explicit guidance.

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/MarcusViniciusBarcelos/uiux-tools-react-mui'

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