Skip to main content
Glama

design_from_reference

Extract design tokens from a reference image or generate a matching HTML component using Gemini Vision.

Instructions

Design a component based on a reference image using Gemini Vision.

This tool analyzes a screenshot or design reference image and creates a similar component with matching visual style. Uses Gemini's vision capabilities to extract design tokens (colors, typography, spacing, etc.) and then generates HTML matching those tokens.

Two modes:

  • extract_only=True: Only extract design tokens, don't generate HTML

  • extract_only=False: Extract tokens AND generate matching component

Content language is configurable (default: Turkish).

Args: image_path: Path to the reference image file. Supported formats: PNG, JPG, JPEG, WEBP, GIF. Example: "/path/to/screenshot.png" component_type: Type of component to design based on the reference. If empty and extract_only=False, will auto-detect from image. Options: hero, navbar, card, pricing_card, footer, etc. instructions: Additional instructions for modifications. Examples: - "Buna benzer ama mavi tonlarında" - "Daha minimalist bir versiyon" - "Aynı stilde ama dark mode" - "Spacing'i daha geniş tut" context: Usage context for the component. Example: "Hero section for a Turkish restaurant website" project_context: Project-specific context for design consistency. Example: "Project: KokoreçUsta - Traditional restaurant. Target: Local customers. Tone: Warm, nostalgic." extract_only: If True, only extract and return design tokens. If False, also generate a matching HTML component. Default: False auto_fix: Apply JavaScript fallback fixes to generated HTML. Default: True content_language: Language code for content generation (default: "tr"). Supported: "tr" (Turkish), "en" (English), "de" (German).

Returns: Dict containing: - design_tokens: Extracted design tokens from the reference image - colors: Color palette with hex codes - typography: Font sizes, weights, line heights - spacing: Padding, margin, gap patterns - borders: Border radius, border styles - shadows: Shadow styles - layout: Grid/flex patterns detected - aesthetic: Overall design aesthetic (minimal, bold, etc.) - component_hints: Detected UI component types in the image - html: Generated HTML (only if extract_only=False) - design_notes: How the reference was interpreted - modifications: Changes made based on instructions - model_used: Always gemini-3-pro-preview

Examples: # Extract only - useful for understanding a design design_from_reference( image_path="/path/to/inspiration.png", extract_only=True )

# Full design from reference
design_from_reference(
    image_path="/path/to/competitor-hero.png",
    component_type="hero",
    instructions="Buna benzer ama marka renklerimizle",
    project_context="Project: TeknoSoft - B2B SaaS"
)

# Match style but different component
design_from_reference(
    image_path="/path/to/navbar-design.png",
    component_type="footer",  # Use navbar's style for footer
    instructions="Aynı stilde footer tasarla"
)

Workflow: 1. Gemini Vision analyzes the reference image 2. Extracts design tokens (colors, typography, spacing, etc.) 3. Identifies aesthetic and component types 4. (If extract_only=False) Generates matching HTML with TailwindCSS 5. Applies JS fallback fixes if auto_fix=True

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNo
auto_fixNo
image_pathYes
extract_onlyNo
instructionsNo
use_trifectaNo
component_typeNo
project_contextNo
content_languageNotr
inject_js_fallbacksNo
Behavior4/5

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

With no annotations, the description carries full burden. It details the use of Gemini Vision, extraction of design tokens, HTML generation with TailwindCSS, JS fallback fixes, content language, and the exact return structure. It does not cover error handling or performance, but is otherwise very transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections, bullet points, and code blocks, front-loading the purpose. It is somewhat long due to multiple examples and detailed return type, but every part serves a purpose for an AI agent. Could be slightly more concise, but still effective.

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

Completeness4/5

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

Given the tool complexity (10 params, no output schema, no annotations), the description is comprehensive. It covers return values in detail, modes, examples, and workflow. It implicitly differentiates from siblings by focus on reference images, but could explicitly mention alternatives. Overall, sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so description must compensate. It provides thorough explanations and examples for 8 of 10 parameters (e.g., image_path, instructions, context). Missing documentation for 'use_trifecta' and 'inject_js_fallbacks', but overall adds significant value beyond the schema.

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 'Design a component based on a reference image using Gemini Vision', specifying the verb, resource, and method. It distinguishes from sibling tools like design_frontend or design_section by focusing on reference-based design, making it unambiguous.

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

Usage Guidelines4/5

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

The description explains two modes (extract_only true/false) and provides various examples (extract only, full design, style match for different component). However, it does not explicitly state when not to use this tool versus alternatives, such as when no reference image is available.

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/archolet/claude-gemini-bridge'

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