Skip to main content
Glama

StyleKit

Repair code so it follows a StyleKit style

stylekit_repair_code
Read-onlyIdempotent

Rewrite code that drifts from a style, using the style's own tokens as replacements. Use this instead of hand-editing class names after stylekit_lint_code reports violations.

Every applied rewrite comes from the style's tokens, never from a guess: variants (dark:, md:, hover:) are preserved, multi-class replacements are deduplicated, and string literals inside cn()/clsx() expressions are rewritten while variable references and interpolation spans are left untouched. JSX/HTML class attributes, template literals, and a bare class string are all handled. Spacing, layout and structure are never changed.

Args:

  • slug (string): style identifier.

  • code (string, 1-100000 chars): source to repair.

Returns JSON: { slug, code, edits: [{ from, to, line }], unfixed: [{ className, line, reason }], before, report, origin, contentSource, fallbackReason? }. Apply the returned code as-is, then review any entries in unfixed yourself — the rules flagged them but no concrete replacement exists.

Examples:

  • "make this hero match neo-brutalist" -> slug: "neo-brutalist", code: "<section className="rounded-2xl shadow-2xl">"

  • If edits is empty and before.status is "pass", the code already matched. Do not invent further changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesSource code or class string to repair
slugYesStyle slug, e.g. 'glassmorphism'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
slugYes
editsYes
beforeYes
originYes
reportYes
unfixedYes
contentSourceYes
fallbackReasonNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations by describing exact transformation behavior: replacements come only from style tokens, variants (dark:/md:/hover:) are preserved, multi-class replacements are deduplicated, cn()/clsx() string literals are rewritten while variable references and interpolation spans are untouched, and spacing/layout/structure are never changed. This is rich context the readOnlyHint/idempotentHint annotations do not convey, and it is consistent with readOnlyHint=true since it returns rewritten code rather than mutating anything.

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?

Front-loads the core action and the routing decision, then adds behavior, args, return shape and examples in a tight structure. Every section earns its place and there is no filler despite the length.

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?

An output schema exists, yet the description still usefully summarizes the return shape (slug, code, edits, unfixed with reasons) and prescribes the correct follow-up action: apply returned code as-is, then manually review unfixed entries. Nothing an agent needs to invoke and use the tool correctly is missing.

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 both parameters. The description restates them ('slug: style identifier', 'code: 1-100000 chars source to repair') with no added syntax, format, or constraint detail beyond the schema, so the baseline of 3 applies.

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?

States a specific verb+resource+scope: 'Rewrite code that drifts from a style, using the style's own tokens as replacements.' It also explicitly names the sibling it replaces (stylekit_lint_code), so an agent can distinguish it from the linter and other stylekit tools without opening schemas.

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?

Gives explicit when-to-use: 'Use this instead of hand-editing class names after stylekit_lint_code reports violations.' It names the alternative (manual editing) and the triggering condition (lint reports violations), plus an exclusion example noting that an empty edits list with before.status='pass' means no changes should be made.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.