Skip to main content
Glama

Generate UI Preview

generate_ui_preview

Turns natural-language UI descriptions into mockup images with Google Gemini, returning the preview inline and saving a PNG to disk for review.

Instructions

Generate a high-fidelity UI mockup image using Google Gemini image generation. Returns an inline image and saves the PNG to disk.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>",
      "component_name": "<component_name>"
    },
    "name": "generate_ui_preview"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoGemini model to use for image generationgemini-2.0-flash-exp
promptYesDescription of the UI component or page to generate
output_dirNoDirectory to save the generated image./previews
style_hintsNoAdditional style guidance (e.g. 'dark mode', 'mobile layout', 'minimal')
aspect_ratioNoAspect ratio for the generated image16:9
component_nameYesName for the component (used in the output filename)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It does disclose useful behavior: the result is returned as an inline image and the PNG is persisted to disk. However, it omits whether an existing file is overwritten, whether the output directory is created automatically, and what happens on failure or timeout — meaningful gaps for a tool with a filesystem side effect.

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?

Two sentences, both load-bearing: the first defines the operation and engine, the second defines the return and persistence behavior. Nothing is redundant and the key facts are front-loaded.

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 six-parameter tool with no annotations and no output schema, the description covers the core purpose and return medium reasonably well. It leaves out important operational context such as authentication requirements, directory creation, and overwrite semantics, which an agent would need before invoking it in a real environment.

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 every parameter is already documented in the schema. The description adds no parameter meaning beyond that baseline, which is acceptable but not additive.

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 states a specific verb and resource: 'Generate a high-fidelity UI mockup image', and names the underlying engine (Google Gemini image generation). An agent can tell exactly what is produced. There are no siblings to differentiate from, so the lack of sibling routing is not a fault.

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?

There is no guidance on when to use this tool versus alternatives, no mention of prerequisites such as an API key or network access, and no indication of cost or latency. The description only says what it does, not when it is appropriate.

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

Deploy Server

Other Tools