@frontmcp/ui library to build professional-looking tool outputs.
Prerequisites:
- A working FrontMCP tool (see Your First Tool)
- Basic understanding of HTML/CSS
What You’ll Build
A weather tool that displays temperature, conditions, and other data in a styled card with badges and description lists.Step 1: Install the UI Package
Step 2: Create a Tool with UI Template
Theui property in the @Tool decorator lets you define a template function that renders HTML:
UI Configuration Options
string
Human-readable description of what the widget displays. Shown to users in UI-capable hosts.
'inline' | 'modal' | 'panel'
How the widget should be displayed:
inline- Rendered directly in the conversationmodal- Opens in a modal dialogpanel- Shows in a side panel
'static' | 'iframe'
How the HTML is served:
static- HTML string is returned directlyiframe- Content is served via iframe URL
function
A function that receives the execution context and returns an HTML string.
Available UI Components
Card
Wrap content in a styled container:Badge
Display status or category labels:Description List
Show key-value pairs:Button
Create styled buttons:Form and Input
Build forms with validation:Template Context
The template function receives a context object with:Available Helpers
Practical Example: Expense Summary
Platform Detection
Different platforms (OpenAI, Claude, browsers) have different capabilities. Use theme utilities to adapt:Next Steps
React SDK Components
Pre-built React components
Tool Reference
Full @Tool decorator options
CodeCall CRM Demo
See UI in a full application
Create Prompts
Build prompts alongside tools