tool-ui

Render custom React UI components for Mastra tool outputs in streaming and history.

18|4|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/ataschz/tanstack-start-mastra-example --skill tool-ui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tool-ui
Source: https://github.com/ataschz/tanstack-start-mastra-example/tree/main/.agent/skills/tool-ui
Command: npx skills add https://github.com/ataschz/tanstack-start-mastra-example --skill tool-ui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to render custom UI components for Mastra tools within chat streaming and history, enabling rich, tool-specific visualizations.

Core Features & Use Cases

  • Custom Tool Cards: Render tool outputs with type-safe UI components in streaming and history.
  • Debugging UI: Quickly verify rendering of new tools in development.
  • Registry-driven UI: Use a single registry to map tool IDs to React components and data validators.

Quick Start

Add a new tool UI component under src/components/ai-elements/, then register it in the UI registry with its toolId so Mastra renders it in both streaming and history views.

Frequently Asked Questions about tool-ui

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render custom UI components for Mastra tool outputs in chat?

To render custom UI components for Mastra tool outputs, you add a React component under your elements directory and register it with its toolId in the UI registry. This maps tool results to type-safe visualizations across streaming and history.

Why do my Mastra tool results show as raw text instead of custom cards in chat history?

Tool results show as raw text when the UI registry lacks the toolId mapping or the type guard fails. Register the React component and its data validator in the registry so Mastra can render the custom card UI in both streaming and history views.

Does Mastra support streaming custom tool cards with dynamic React components?

Yes, Mastra supports streaming custom tool cards. By using a registry-driven approach, you map tool IDs to React components and type guards, enabling dynamic rendering of tool-specific visualizations during chat streaming.

What's the best way to debug custom tool UI rendering in Mastra deployments?

The best way to debug custom tool UI rendering is using a registry-driven setup. Map tool IDs to their React components and data validators, then quickly verify rendering behavior across streaming and history contexts during development.

Do I need a type guard to render custom tool UIs in Mastra chat?

Yes, a type guard is required for output data. The UI registry uses this validator alongside the React component and toolId entry to ensure correct, type-safe rendering of tool outputs in both streaming and history contexts.

Can I use a single registry to map multiple Mastra tools to different UI components?

Yes, you can use a single registry-driven UI to map multiple tools. Register each toolId with its corresponding React component and type guard to render distinct, type-safe custom cards for different tools in Mastra chat.

Related Skills