Problem: Apps involve three actors (the host, your server, your view) communicating in complex patterns. Understanding this flow is essential. Solution: Skybridge provides clear abstractions for each communication pattern.Documentation Index
Fetch the complete documentation index at: https://docs-staging.skybridge.tech/llms.txt
Use this file to discover all available pages before exploring further.
The Three Actors
- The MCP Host: The conversational interface where users type messages and the model responds (ChatGPT, Claude, Goose, VSCode, etc.)
- Your MCP Server: The backend that exposes tools and business logic
- Your View (Guest): The React component rendered in an iframe inside the host
Key Terms
Tool responses contain three fields:content: Text array shown to the model in the conversationstructuredContent: Typed JSON data surfaced to your view and the host_meta: Delivered only to the view and hidden from the model
Tools and views
Before diving into the data flow, understand the difference between plain tools and tools with a view. Both useregisterTool, differentiated by the optional view field:
registerTool (no view) | registerTool (with view) | |
|---|---|---|
| Has UI? | No | Yes |
| Returns | content and/or structuredContent | structuredContent and optional content/_meta |
| Renders | Nothing | A React component from src/views/ |
| Use case | Background operations, calculations | Interactive UI |
Data Flow Patterns
1. Tool → View (Initial Hydration)
When the host calls a tool returning a view, it returnsstructuredContent to hydrate the React component:
Server:
useToolInfo for the initial data that renders your view. This data is set once when the view loads.
useToolInfo is read-only
useToolInfo provides the initial hydration data and should not be used as a mutable data store. For persistent view state that survives re-renders, use useViewState.2. View → Server (Tool Calls)
Views can trigger additional tool calls in response to user actions:useCallTool when the user performs an action that requires fetching more data.
3. View → Model (Context Sync)
Your view needs to communicate its state back to the model. Use thedata-llm attribute to declaratively describe what the user sees. See LLM Context Sync.
4. View → Chat (Follow-up Messages)
Views can send messages back into the conversation:Response Fields Explained
Tool responses have three fields:| Field | Purpose | Consumed by |
|---|---|---|
content | Text description | The host (shown in conversation) |
structuredContent | Typed data | Host and view (useToolInfo, useCallTool) |
_meta | Response metadata | View |
When to Use What
| Need | Use | Why |
|---|---|---|
| Initial view data | useToolInfo | Data passed at hydration, no extra calls |
| User-triggered fetch | useCallTool | Model sees the result, can answer questions |
| Silent background fetch | Direct API call | Model doesn’t need to know |
| Describe current UI state | data-llm | Passive context for user questions |
| Trigger model response | useSendFollowUpMessage | Active prompt, immediate reply |
| Persist view state | useViewState | Survives re-renders |
The Communication Loop
- Host calls your tool → Server responds with
structuredContent - View hydrates with
useToolInfo - User interacts → View updates
data-llm→ Model sees the context - User triggers action → View calls
useCallTool→ Server responds - View sends follow-up →
useSendFollowUpMessage→ Model replies
Related
- LLM Context Sync - Keep the model informed of view state (read this next)
- Fetching Data Guide - Patterns for useToolInfo and useCallTool
- useToolInfo API - Initial data access
- useCallTool API - User-triggered data fetching
- useViewState API - Persistent view state