Skip to main content
Glama

Compare component

compare_component

Check component availability and differences between HeroUI v2 and v3 versions to identify migration requirements and changes needed.

Instructions

Show presence/status of a component between v2 and v3, with alias lookup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYes

Implementation Reference

  • The `compareComponent` function handles the logic for comparing components between v2 and v3 versions, determining the status (same, renamed, removed, unknown, or compound) and identifying breaking changes, subcomponent mappings, and property changes.
    export async function compareComponent(component: string): Promise<ComponentComparisonResult> {
      const root = process.cwd();
      const idx2 = path.join(root, "data", "index", "components.v2.json");
      const idx3 = path.join(root, "data", "index", "components.v3.json");
      let list2: any[] = [];
      let list3: any[] = [];
      try { list2 = JSON.parse(await fs.readFile(idx2, 'utf8')); } catch { }
      try { list3 = JSON.parse(await fs.readFile(idx3, 'utf8')); } catch { }
    
      // normalize helper removes hyphen/underscore and lowercases
      const normalize = (s: string) => s.toLowerCase().replace(/[-_]/g, '');
      const targetNorm = normalize(component);
    
      const find = (list: any[]) =>
        list.find((e) => {
          if (normalize(e.slug) === targetNorm) return true;
          if (e.aliases && e.aliases.some((a: string) => normalize(a) === targetNorm)) return true;
          return false;
        });
    
      const e2 = find(list2);
      const e3 = find(list3);
      const exists2 = !!e2;
      const exists3 = !!e3;
    
      // build alias list using resolver if available
      const aliases: string[] = [];
      try {
        const { resolveAlias } = await import("../knowledge/aliases.js");
        const res = resolveAlias(component);
        if (res.alias) aliases.push(res.alias);
        if (res.canonical && res.canonical !== component) aliases.push(res.canonical);
      } catch { }
    
      // determine status
      let status: ComponentComparisonResult['status'];
      if (exists2 && exists3) {
        if (normalize(e2.slug) === normalize(e3.slug)) {
          status = 'same';
        } else {
          status = 'renamed';
        }
      } else if (exists2 && !exists3) {
        status = 'removed';
      } else if (!exists2 && exists3) {
        status = 'unknown';
      } else {
        status = 'unknown';
      }
    
      const breakingChanges: string[] = [];
      if (KNOWN_V2_IMPORTS[component]) {
        breakingChanges.push(KNOWN_V2_IMPORTS[component]);
      }
    
      // subcomponent mappings: any map entry starting with component name (case-insensitive) but not equal
      const subcomponentMappings: Array<{ legacy: string; replacement: string; note?: string }> = [];
      for (const [key, val] of Object.entries(KNOWN_V2_IMPORTS)) {
        if (key.toLowerCase().startsWith(component.toLowerCase()) && key.toLowerCase() !== component.toLowerCase()) {
          subcomponentMappings.push({ legacy: key, replacement: val, note: val });
        }
      }
    
      // prop changes relevant to this component
      const propChanges: Array<{ prop: string; replacement?: string; removed?: boolean; note: string }> = [];
      for (const p of KNOWN_V2_PROPS) {
        if (!p.components || p.components.some((c) => normalize(c) === targetNorm)) {
          propChanges.push({ prop: p.prop, replacement: p.replacement, removed: p.removed, note: p.note });
        }
      }
    
      // if component had subcomponent mappings but no v3 entry, it may have been
      // folded into a compound API rather than simply removed. We mark as
      // `compound` only if none of the mappings are just "NOT IN v3" notes.
      if (status === 'removed' && subcomponentMappings.length > 0) {
        const onlyNotIn = subcomponentMappings.every(m => /NOT IN v3/i.test(m.note || ''));
        if (!onlyNotIn) {
          status = 'compound';
        }
      }
    
      return {
        component,
        aliases,
        existsInV2: exists2,
        existsInV3: exists3,
        status,
        breakingChanges,
        subcomponentMappings,
        propChanges,
        sources: [e2?.source || '', e3?.source || ''].filter(Boolean),
      };
Behavior3/5

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

With no annotations provided, the description carries full burden. It successfully discloses the alias lookup behavior, but fails to mention safety characteristics (read-only vs destructive), return format, or error behavior when components are missing.

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?

Single sentence efficiently packages the core functionality without repetition. Front-loaded with the action ('Show'), and every phrase earns its place by conveying unique operational scope (v2/v3, alias lookup).

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

Completeness3/5

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

For a single-parameter tool, the description covers the primary function adequately, but lacks output specification (no output schema exists) and assumes domain knowledge of what v2 and v3 represent without clarifying the comparison context.

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 has 0% description coverage for the single 'component' parameter. The description implies the parameter accepts aliases via 'with alias lookup', adding some semantic meaning, but does not fully compensate for the lack of schema documentation (no format examples, constraints, or clear statement that component can be an alias).

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 identifies the resource (component) and action (show presence/status between v2 and v3), plus distinguishes from siblings via version-specific comparison and alias lookup capabilities that no other tools mention.

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?

No explicit guidance on when to use versus alternatives, nor prerequisites for the v2/v3 comparison context. The alias lookup feature implies usage when exact component names are unknown, but this is not explicitly stated.

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/sctg-development/heroui-migration-mcp'

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