Workflows

All 10 MCP tools, resource URIs, design guidelines, and example agent workflows for building UI with AI.

MCP Workflows

Once the UI Lab MCP server is connected, AI agents have access to 10 tools and 4 resource URI types. This page documents each tool, how they chain together in real workflows, and the design system rules that are automatically enforced in every response.

Tools overview

ToolPurpose
search_componentsFind components by natural language query
get_componentGet full component metadata: API, examples, design guidance
get_semantic_colorGet ONE authoritative color recommendation for a component + intent
get_theme_setupGet complete light/dark theme setup with provider code
search_patternsFind design patterns by use case
get_patternGet a pattern's full TSX code and design rationale
search_elementsFind pre-built multi-component UI blocks
get_elementGet an element's variations and file structure
search_sectionsFind landing page sections
get_sectionGet a section's variations

Components

search_components

Searches all UI Lab components using natural language. Returns up to 10 results ranked by relevance.

Input:

Returns: Array of component summaries with id, name, description, tags.

Example queries:

  • "button primary action" → Button
  • "dropdown select option" → Select
  • "text input form field" → Input
  • "modal dialog overlay" → Modal
  • "data table rows columns" → Table
  • "toast notification message" → Toast

get_component

Fetches complete component metadata by ID. Use after search_components to get the full API.

Input:

detail options:

  • "api" — props + subComponents only. Use when writing code — smallest response, no examples.
  • "examples" — description + usage examples only. Use when learning patterns.
  • "full" — everything: API, examples, design guidelines (default).

Returns: Component metadata including:

  • api.props — all props with types, defaults, descriptions
  • api.subComponents — compound component slots (e.g. Card.Header, Card.Footer)
  • api.examples — working TSX code examples
  • designGuidelines — mandatory color token rules (only in full mode)

Typical workflow:

Design tokens

get_semantic_color

Returns ONE authoritative color recommendation for a component and intent combination. Does not offer options — it returns the correct choice.

Input:

semantic_intent values: primary, secondary, danger, success, warning, info

Returns:

Call this before generating component code to get the right Tailwind token classes to use.

Theme

get_theme_setup

Returns complete setup instructions and code for integrating the UI Lab theme system with light/dark mode.

Input:

Returns:

  • setup.providerThemeProvider wrapper code for your root layout
  • setup.hooksuseTheme, useThemeMode, etc. with signatures
  • setup.toggleComponent — ready-to-use ThemeToggle component code
  • setup.fouc_prevention — explanation of automatic FOUC prevention (no setup needed)
  • setup.colorBehavior — how shades invert automatically in dark mode
  • setup.integrationSteps — step-by-step instructions

FOUC prevention is automatic. ThemeProvider injects a blocking script into document.head on mount that reads localStorage and applies CSS variables before the page renders. No manual script tag needed.

How dark mode color inversion works:

Shades invert automatically — no dark: prefix needed in Tailwind classes:

ShadeDark mode equivalent
background-500background-500 (stays constant)
background-600background-900
background-700background-800
background-900background-600
background-950background-500

Patterns

Patterns are opinionated, ready-to-use TSX implementations of common UI problems. They use the correct design tokens and component APIs.

search_patterns

Input:

Example queries:

  • "auth login form" → auth-form
  • "destructive confirm dialog" → destructive-confirm
  • "empty state placeholder" → empty-state
  • "settings form layout" → settings-form-layout
  • "status list item" → status-list-item
  • "pricing cards" → pricing-cards
  • "feature grid" → feature-grid

Returns: Array of pattern summaries with id, name, description, category, complexity, tags.

get_pattern

Fetches the full pattern including complete TSX code and design notes.

Input:

Returns:

  • pattern.code — complete working TSX implementation
  • pattern.designNotes — why each token and component choice was made
  • designGuidelines — mandatory color rules

Patterns are meant to be copied as-is and adapted. They demonstrate the correct way to combine UI Lab components for common scenarios.

Elements

Elements are pre-built, multi-component UI blocks that solve complete UI problems — chat interfaces, sidebars, tables of contents, AI input areas, etc.

search_elements

Input:

Available elements:

CategoryElements
AIChat, AIChatInput, ChainOfThought
DocumentationTOC, NextArticle, CopyPage
FoundationPage, Sidebar, Header, Carousel, Timeline, Rating, TreeView

Example queries:

  • "chat interface" → Chat
  • "AI input prompt" → AIChatInput
  • "sidebar navigation" → Sidebar
  • "table of contents" → TOC
  • "reasoning steps" → ChainOfThought

get_element

Input:

Returns:

  • element.variations — all available variations with names and descriptions
  • element.files — file structure for each variation
  • element.packageId — which UI Lab package the element belongs to

Elements have multiple variations (e.g. Chat has "basic" and "with actions"). Each variation is a self-contained set of files you can copy into your project.

Sections

Sections are full-width landing page blocks ready to drop into marketing pages.

search_sections

Input:

Available sections: Hero, Features, CTA, Pricing, Testimonials

Each has multiple variations:

  • hero → simple, with-image, with-video
  • features → grid, list
  • pricing → cards, comparison
  • cta → centered, split
  • testimonials → cards, featured

get_section

Input:

Returns: All variations with complete TSX code for each.

Resources

In addition to tools, the server exposes all content as MCP resources. Agents can enumerate and read resources directly by URI — useful for agents that prefer resource-based access over tool calls.

Resource URI schemes:

SchemeExampleContent
component://component://buttonFull component metadata
pattern://pattern://auth-formPattern with TSX code
element://element://chatElement variations and files
section://section://heroSection variations

ListResources returns every component, pattern, element, and section indexed together. ReadResource reads a specific URI.

Design guidelines (always injected)

Every get_component, get_pattern, get_semantic_color, and get_theme_setup response includes a designGuidelines field with the complete set of mandatory color token rules. These are injected automatically so agents always have the constraints in context when generating code.

Color families

These are the only color families allowed. No Tailwind built-in colors, no hex codes.

FamilyUse for
accentPrimary actions, CTAs, brand elements
successSuccess states, confirmations, approved
dangerErrors, destructive actions, delete
warningWarnings, cautions, pending states
infoInformation, help, neutral messages
backgroundPage and card backgrounds (grayscale)
foregroundText, borders, labels (grayscale)

Shade ranges

Shades are strictly bounded per family:

FamilyMin shadeMax shadeNotes
background (bg)500950500 = lightest, 950 = darkest
foreground (text/border)5040050 = lightest, 400 = darkest
accent50600
success, danger, warning, info50600

Class format

Common mistakes and corrections

WrongCorrect
bg-whitebg-background-500
text-gray-900text-foreground-300
bg-zinc-100bg-background-600
shadow-md(remove — no shadows)
from-blue-500 to-purple-600(remove — no gradients)
border-red-500border-danger-500
bg-background-50bg-background-500 (min is 500)
text-foreground-500text-foreground-400 (max is 400)
bg-accent-700bg-accent-600 (max is 600)

Correct examples

Typical agent workflows

Workflow 1: Build a component from scratch

Workflow 2: Find and use a pattern

Workflow 3: Set up theming

Workflow 4: Build a landing page

Workflow 5: Find a pre-built UI block

Next steps