Skip to main content
Glama

Autocorrect Component

autocorrect_component

Analyze and correct React components to enforce design consistency by fixing hardcoded colors, missing glass treatments, and incorrect typography tokens against active UI presets.

Instructions

Analyze a React component and auto-correct it against the active preset. Corrects: hardcoded colors, missing glass treatment, wrong typography tokens, wrong animation tokens, non-conforming sidebar/settings structure.

Args:

  • code (string): React component source code (max 10,000 chars)

  • context ('sidebar'|'settings'|'dashboard'|'surface'|'navigation'|'form'|'auto'): Component context hint for targeted rules (default: 'auto')

  • dry_run (boolean): Return issues without changing code (default: false)

Returns:

  • corrected: Fixed component code

  • issues: Array of UIIssue objects with severity, rule, message, fix

  • appliedFixes: List of changes made

  • score: Conformance score before correction (0-100)

Requires active preset (run load_preset first).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesReact component source code (max 10,000 chars)
contextNoComponent context hint for targeted rulesauto
dry_runNoReturn issues without changing code
Behavior4/5

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

The description adds valuable behavioral context beyond annotations. Annotations indicate it's not read-only, not open-world, not idempotent, and not destructive, but the description clarifies it 'auto-corrects' code, explains what specific issues it fixes, mentions the 'dry_run' option for previewing changes, and notes the prerequisite of an active preset. This provides practical implementation details not covered by annotations.

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 well-structured and front-loaded: it starts with the core purpose, lists specific corrections, details parameters and returns in clear sections, and ends with a prerequisite. Every sentence adds value without redundancy, making it efficient and easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing and correcting code), the description is complete despite no output schema. It explains what the tool does, what it corrects, all parameters, return values (corrected code, issues, applied fixes, score), and a key prerequisite. This provides sufficient context for an agent to use it effectively, especially with annotations covering safety aspects.

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?

With 100% schema description coverage, the schema already fully documents all parameters. The description repeats some parameter details (e.g., 'code (string): React component source code (max 10,000 chars)') but adds minimal extra semantics—it briefly explains the 'context' parameter's purpose ('Component context hint for targeted rules') and the 'dry_run' effect ('Return issues without changing code'), which slightly enhances understanding. Baseline 3 is appropriate when schema does most of the work.

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

Purpose5/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 with specific verbs ('analyze', 'auto-correct') and resources ('React component'), and distinguishes it from siblings by specifying what it corrects (hardcoded colors, missing glass treatment, etc.). It explicitly mentions it works 'against the active preset', differentiating it from tools like 'validate_ui' or 'suggest_style'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: it states 'Requires active preset (run load_preset first)', which is a clear prerequisite. It also distinguishes when to use this tool by listing specific corrections it performs, helping differentiate it from siblings like 'validate_ui' (which might only check) or 'generate_component' (which creates new components).

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/ncsound919/OG-Glass'

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