Skip to main content

evaluate_principle_alignment

Assess UI code against the active design system's DECLARED design principles.

Reference

Parameters

  • Name
    code
    Type
    string · required
    Description

    Component source code to assess (min 1)

  • Name
    framework
    Type
    enum · optional
    Description

    Source framework: 'jsx' | 'tsx' | 'svelte'. Defaults to 'tsx'. (jsx · tsx · svelte)

  • Name
    designSystemId
    Type
    string · optional
    Description

    Design system UUID (defaults to active design system) (uuid)

  • Name
    layerId
    Type
    string · optional
    Description

    Layer UUID (defaults to active layer) (uuid)

Returns

{
  verdict   'assessed' | 'not_scored'
  findings  [{ principle, tier, verdict, rationale, evidence, source, confidence, suggestion }], T1-first
  posture   { T1..T5: 'aligned' | 'weakens' | 'mixed' | 'not_assessed' }
  unscored  [{ principle, tier, reason }] — what was not assessed, and why
  metadata  { structuralFindings, judgmentFindings, principlesAssessed }
}

Description

Assess UI code against the active design system's DECLARED design principles.

Tier-2 governance — a DISTINCT axis from validate_code (conformance to rules). It answers "does this embody the design system's philosophy?", graded against the team's OWN ranked principles and named anti-patterns (the principle layer), not generic taste.

Honesty-first: returns findings + per-tier posture, NOT a numeric score. Each finding cites the principle, the evidence (element + line), its source (structural = deterministic AST; model-judgment = a grounded Sonnet call), and a confidence banded by citation quality. Principles it cannot ground are returned in 'unscored' — it never fabricates alignment. If the design system has declared no principles, returns verdict:'not_scored' (the honest empty state).

Parameters:

  • code (required): JSX/TSX source to assess.
  • designSystemId (optional): Defaults to the active design system from context.
  • layerId (optional): Defaults to the active layer; principles resolve base + this layer.

Source

Defined in packages/mcp/src/tools.ts. The request handler lives alongside its registration in packages/mcp/src/tools/.

Was this page helpful?

Last reviewed by @jschuyler