@assistant-ui/mcp-docs-server 0.1.29 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/.docs/organized/code-examples/waterfall.md +15 -7
  2. package/.docs/organized/code-examples/with-a2a.md +9 -21
  3. package/.docs/organized/code-examples/with-ag-ui.md +11 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
  5. package/.docs/organized/code-examples/with-artifacts.md +12 -10
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -12
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +83 -54
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
  9. package/.docs/organized/code-examples/with-cloud.md +9 -10
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +61 -16
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +17 -12
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +13 -13
  13. package/.docs/organized/code-examples/with-expo.md +25 -21
  14. package/.docs/organized/code-examples/with-external-store.md +8 -8
  15. package/.docs/organized/code-examples/with-ffmpeg.md +17 -12
  16. package/.docs/organized/code-examples/with-generative-ui.md +9 -9
  17. package/.docs/organized/code-examples/with-google-adk.md +8 -8
  18. package/.docs/organized/code-examples/with-heat-graph.md +5 -5
  19. package/.docs/organized/code-examples/with-interactables.md +10 -25
  20. package/.docs/organized/code-examples/with-langchain.md +437 -0
  21. package/.docs/organized/code-examples/with-langgraph.md +16 -16
  22. package/.docs/organized/code-examples/with-livekit.md +18 -13
  23. package/.docs/organized/code-examples/with-opencode.md +105 -62
  24. package/.docs/organized/code-examples/with-parent-id-grouping.md +10 -10
  25. package/.docs/organized/code-examples/with-react-hook-form.md +220 -148
  26. package/.docs/organized/code-examples/with-react-ink.md +2 -2
  27. package/.docs/organized/code-examples/with-react-router.md +12 -12
  28. package/.docs/organized/code-examples/with-store.md +8 -5
  29. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  30. package/.docs/organized/code-examples/with-tap-runtime.md +10 -6
  31. package/.docs/raw/docs/(docs)/cli.mdx +2 -1
  32. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  33. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  34. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  35. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  38. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  39. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/index.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/installation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/rtl.mdx +80 -0
  43. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
  44. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
  45. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
  50. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
  51. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
  53. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +149 -40
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +2 -0
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
  63. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
  64. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +9 -0
  65. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
  66. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +231 -3
  67. package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
  68. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  69. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
  70. package/.docs/raw/docs/guides/branching.mdx +76 -0
  71. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  72. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
  73. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
  74. package/.docs/raw/docs/guides/editing.mdx +102 -0
  75. package/.docs/raw/docs/guides/index.mdx +103 -0
  76. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
  77. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
  78. package/.docs/raw/docs/guides/mentions.mdx +520 -0
  79. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
  80. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
  81. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
  82. package/.docs/raw/docs/guides/slash-commands.mdx +361 -0
  83. package/.docs/raw/docs/guides/speech.mdx +156 -0
  84. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
  85. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
  86. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
  87. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
  88. package/.docs/raw/docs/ink/index.mdx +1 -3
  89. package/.docs/raw/docs/ink/migration.mdx +1 -3
  90. package/.docs/raw/docs/ink/primitives.mdx +37 -1
  91. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  92. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  93. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  94. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  95. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  96. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  97. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  98. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  99. package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
  100. package/.docs/raw/docs/integrations/index.mdx +173 -0
  101. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  102. package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
  103. package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
  104. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  105. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  106. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  107. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  108. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  109. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  110. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  111. package/.docs/raw/docs/primitives/composer.mdx +96 -63
  112. package/.docs/raw/docs/primitives/error.mdx +1 -0
  113. package/.docs/raw/docs/primitives/index.mdx +2 -1
  114. package/.docs/raw/docs/primitives/message.mdx +68 -5
  115. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  116. package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
  117. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  118. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  119. package/.docs/raw/docs/react-native/index.mdx +1 -3
  120. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  121. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  122. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  123. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  124. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  125. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  126. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
  127. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  128. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
  129. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
  130. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +365 -101
  131. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  132. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  133. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  134. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  135. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  136. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
  137. package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
  138. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  139. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  140. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  141. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  142. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  143. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  144. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  145. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  146. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  147. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  148. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  149. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  150. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  151. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  152. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  153. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  154. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  155. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  156. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  157. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +74 -198
  158. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  159. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  160. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  161. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  162. package/.docs/raw/docs/ui/badge.mdx +1 -0
  163. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +200 -0
  164. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  165. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  166. package/.docs/raw/docs/ui/directive-text.mdx +114 -0
  167. package/.docs/raw/docs/ui/file.mdx +1 -0
  168. package/.docs/raw/docs/ui/image.mdx +1 -0
  169. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  170. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  171. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  172. package/.docs/raw/docs/ui/model-selector.mdx +1 -0
  173. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  174. package/.docs/raw/docs/ui/quote.mdx +1 -0
  175. package/.docs/raw/docs/ui/reasoning.mdx +69 -32
  176. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  177. package/.docs/raw/docs/ui/select.mdx +1 -0
  178. package/.docs/raw/docs/ui/sources.mdx +1 -0
  179. package/.docs/raw/docs/ui/streamdown.mdx +1 -0
  180. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  181. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  182. package/.docs/raw/docs/ui/thread-list.mdx +17 -0
  183. package/.docs/raw/docs/ui/thread.mdx +56 -1
  184. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  185. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  186. package/.docs/raw/docs/ui/voice.mdx +1 -0
  187. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  188. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  189. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  190. package/dist/utils/logger.js +1 -1
  191. package/dist/utils/logger.js.map +1 -1
  192. package/package.json +4 -4
  193. package/src/tools/tests/path-traversal.test.ts +1 -1
  194. package/src/utils/logger.ts +1 -1
  195. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  196. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  197. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  198. package/.docs/raw/docs/(docs)/guides/mentions.mdx +0 -406
  199. package/.docs/raw/docs/(docs)/guides/slash-commands.mdx +0 -275
  200. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  201. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  202. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  203. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -268
  204. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  205. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  206. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  207. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  208. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -607
  209. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  210. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  211. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  212. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  213. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  214. package/.docs/raw/docs/ui/mention.mdx +0 -168
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: Suggestions
3
3
  description: Display suggested prompts to help users get started with your assistant.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  Suggestions are pre-defined prompts that help users discover what your assistant can do. They appear in the welcome screen and provide a quick way to start conversations.
@@ -85,7 +86,7 @@ The default Thread component from the shadcn registry already includes suggestio
85
86
 
86
87
  ### Customizing Suggestion Display
87
88
 
88
- If you want to customize how suggestions are displayed, you can modify your Thread component:
89
+ If you want to customize how suggestions are displayed, you can modify your Thread component. The idiomatic pattern is to wrap the suggestions in `AuiIf` so they only appear when the thread is empty:
89
90
 
90
91
  ```tsx
91
92
  import {
@@ -96,17 +97,18 @@ import {
96
97
 
97
98
  const ThreadWelcome = () => {
98
99
  return (
99
- <div className="flex flex-col items-center justify-center">
100
- <h1>Welcome!</h1>
101
- <p>How can I help you today?</p>
102
-
103
- {/* Display suggestions */}
104
- <div className="grid grid-cols-2 gap-2">
105
- <ThreadPrimitive.Suggestions>
106
- {() => <SuggestionItem />}
107
- </ThreadPrimitive.Suggestions>
100
+ <AuiIf condition={(s) => s.thread.isEmpty}>
101
+ <div className="flex flex-col items-center justify-center">
102
+ <h1>Welcome!</h1>
103
+ <p>How can I help you today?</p>
104
+
105
+ <div className="grid grid-cols-2 gap-2">
106
+ <ThreadPrimitive.Suggestions>
107
+ {() => <SuggestionItem />}
108
+ </ThreadPrimitive.Suggestions>
109
+ </div>
108
110
  </div>
109
- </div>
111
+ </AuiIf>
110
112
  );
111
113
  };
112
114
 
@@ -126,53 +128,13 @@ const SuggestionItem = () => {
126
128
  };
127
129
  ```
128
130
 
129
- ## Suggestion Primitives
130
-
131
- ### ThreadPrimitive.Suggestions
132
-
133
- Renders all suggestions from the suggestions scope.
134
-
135
- ```tsx
136
- <ThreadPrimitive.Suggestions>
137
- {() => <CustomSuggestionComponent />}
138
- </ThreadPrimitive.Suggestions>
139
- ```
140
-
141
- ### SuggestionPrimitive.Title
142
-
143
- Displays the suggestion's title (the first part when using object format, or the full text when using strings).
144
-
145
- ```tsx
146
- <SuggestionPrimitive.Title />
147
- ```
148
-
149
- ### SuggestionPrimitive.Description
131
+ ### Dismissal
150
132
 
151
- Displays the suggestion's description/label (only shown when using object format).
133
+ Suggestions dismiss automatically once the user sends a message because `thread.isEmpty` becomes false. No extra state management is needed. If you want to dismiss suggestions without sending (for example, after a user clicks away), manage a local boolean and combine it with the `AuiIf` condition or a plain conditional render.
152
134
 
153
- ```tsx
154
- <SuggestionPrimitive.Description />
155
- ```
156
-
157
- ### SuggestionPrimitive.Trigger
158
-
159
- A button that triggers the suggestion action when clicked.
160
-
161
- ```tsx
162
- <SuggestionPrimitive.Trigger
163
- send={true}
164
- clearComposer={true}
165
- asChild
166
- >
167
- <button>Click me</button>
168
- </SuggestionPrimitive.Trigger>
169
- ```
170
-
171
- **Props:**
135
+ ## Suggestion Primitives
172
136
 
173
- - `send` (boolean): When true, automatically sends the message. When false, only populates the composer.
174
- - `clearComposer` (boolean, default: true): When `send` is false, determines if the composer is cleared before adding the suggestion (true) or if the suggestion is appended (false).
175
- - `asChild` (boolean): Merge props with child element instead of rendering a button.
137
+ The primitives available for rendering suggestions are `ThreadPrimitive.Suggestions`, `ThreadPrimitive.SuggestionByIndex`, `SuggestionPrimitive.Title`, `SuggestionPrimitive.Description`, and `SuggestionPrimitive.Trigger`. `ThreadPrimitive.SuggestionByIndex` is useful when you need layout control over a specific suggestion slot rather than iterating all of them. For the full prop reference and usage patterns, see the [Suggestion primitive docs](/docs/primitives/suggestion).
176
138
 
177
139
  ## Dynamic Suggestions
178
140
 
@@ -213,30 +175,6 @@ function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
213
175
  }
214
176
  ```
215
177
 
216
- ## Context-Aware Suggestions
217
-
218
- Suggestions can be tailored to different contexts or user intents:
219
-
220
- ```tsx
221
- const suggestions = [
222
- {
223
- title: "Code Review",
224
- label: "Get feedback on your code",
225
- prompt: "Can you review this code for me?",
226
- },
227
- {
228
- title: "Debug Help",
229
- label: "Find and fix issues",
230
- prompt: "Help me debug this error",
231
- },
232
- {
233
- title: "Best Practices",
234
- label: "Learn recommended patterns",
235
- prompt: "What are the best practices for this?",
236
- },
237
- ];
238
- ```
239
-
240
178
  ## Best Practices
241
179
 
242
180
  1. **Keep suggestions concise**: Use clear, actionable prompts that users can understand at a glance
@@ -246,11 +184,11 @@ const suggestions = [
246
184
  5. **Limit the number**: 3-6 suggestions work best to avoid overwhelming users
247
185
  6. **Make them actionable**: Each suggestion should lead to a meaningful interaction
248
186
 
249
- ## Migration from Legacy API
187
+ ## Switching from `ThreadPrimitive.Suggestion`
250
188
 
251
- If you're using the deprecated `ThreadPrimitive.Suggestion` component, migrate to the new API:
189
+ If your codebase uses the inline `ThreadPrimitive.Suggestion` component (which renders one suggestion at a time with hardcoded `prompt` / `send` props), you can move to the runtime-driven `Suggestions()` API for centralized configuration. The inline component is still supported, but the runtime-driven approach scales better when suggestions need to update dynamically.
252
190
 
253
- ### Before (Deprecated)
191
+ ### Inline form
254
192
 
255
193
  ```tsx
256
194
  <ThreadPrimitive.Suggestion
@@ -259,7 +197,7 @@ If you're using the deprecated `ThreadPrimitive.Suggestion` component, migrate t
259
197
  />
260
198
  ```
261
199
 
262
- ### After (Recommended)
200
+ ### Runtime-driven form
263
201
 
264
202
  1. Configure suggestions in your runtime provider:
265
203
 
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: Generative UI
3
3
  description: Render tool calls as interactive UI instead of plain text.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  import { ToolUISample } from "@/components/docs/samples/tool-ui";
@@ -26,7 +27,7 @@ There are two main approaches to creating tool UIs in assistant-ui:
26
27
 
27
28
  ### 1. Client-Defined Tools (`makeAssistantTool`)
28
29
 
29
- If you're creating tools on the client side, use `makeAssistantTool` to register them with the assistant context. Then create a UI component with `makeAssistantToolUI`:
30
+ If you're creating tools on the client side, use `makeAssistantTool` to register them with the assistant context. Then create a UI component with `makeAssistantToolUI`. This component-based API coexists with the [Tools()](/docs/guides/tools) toolkit API; pick whichever fits your codebase better.
30
31
 
31
32
  ```tsx
32
33
  import { makeAssistantTool, tool } from "@assistant-ui/react";
@@ -503,44 +504,97 @@ render: ({ status, args }) => {
503
504
  };
504
505
  ```
505
506
 
506
- ### Field-Level Validation
507
+ ### Deferred Rendering
507
508
 
508
- <Callout type="warn">
509
- `useToolArgsFieldStatus` is not currently exported from `@assistant-ui/react`.
510
- The hook exists internally but is not part of the public API. This section is
511
- included for reference and may become available in a future release.
509
+ <Callout type="info">
510
+ This section applies when the model **drives** the component through a tool call (args arrive incrementally and you want to wait for the final shape). If your backend or orchestrator pushes the component instead, prefer [Data-Part Generative UI](#data-part-generative-ui) with `makeAssistantDataUI`. Data parts arrive as terminal events, so the renderer only fires once with the final data, no deferred rendering needed.
512
511
  </Callout>
513
512
 
514
- Use `useToolArgsFieldStatus` to show validation states:
513
+ Sometimes you want to capture a tool call's streaming arguments but only render the final UI once the call completes. This is useful when partial args would render misleading or jarring intermediate states (a chart that flashes through half-populated data), when the component is expensive to mount (heavy visualizations, embedded iframes, third-party widgets), or when the model controls *whether* the component appears at all.
514
+
515
+ #### Inline at the end of streaming
516
+
517
+ Return `null` from the tool UI's `render` until `status.type === "complete"`. The streaming args still arrive in `args` as the model emits them, you just ignore them until the call is done:
518
+
519
+ ```tsx
520
+ const ChartToolUI = makeAssistantToolUI<
521
+ { title: string; series: number[] },
522
+ void
523
+ >({
524
+ toolName: "renderChart",
525
+ render: ({ args, status }) => {
526
+ if (status.type !== "complete") return null;
527
+ return <Chart title={args.title} data={args.series} />;
528
+ },
529
+ });
530
+ ```
531
+
532
+ The chart mounts once, with the final args, after streaming finishes. No re-renders during the stream.
533
+
534
+ The same `render` shape works inside the [`Tools()`](/docs/guides/tools) toolkit's `render` field, with `useAssistantToolUI`, and with `MessagePrimitive.Parts`'s inline `tools.by_name` overrides. The deferred-rendering pattern applies regardless of how you registered the tool UI.
535
+
536
+ #### Below the message body
537
+
538
+ If the component should sit *outside* the message parts (for example, a card attached under the avatar block rather than inline with text), gate at the message level with [`AuiIf`](/docs/api-reference/primitives/assistant-if) and read `s.message.status`:
515
539
 
516
540
  ```tsx
517
- import { useToolArgsFieldStatus } from "@assistant-ui/react";
541
+ import { MessagePrimitive, AuiIf, useAuiState } from "@assistant-ui/react";
542
+
543
+ function PostMessageCard() {
544
+ const parts = useAuiState((s) => s.message.parts);
545
+ const chartCall = parts.find(
546
+ (p) => p.type === "tool-call" && p.toolName === "renderChart",
547
+ );
548
+ if (!chartCall) return null;
549
+ return <Chart {...chartCall.args} />;
550
+ }
551
+
552
+ <MessagePrimitive.Root>
553
+ <MessagePrimitive.Parts />
554
+
555
+ <AuiIf
556
+ condition={(s) =>
557
+ s.message.role === "assistant" &&
558
+ s.message.status?.type === "complete"
559
+ }
560
+ >
561
+ <PostMessageCard />
562
+ </AuiIf>
563
+ </MessagePrimitive.Root>;
564
+ ```
565
+
566
+ The `AuiIf` predicate fires whenever the assistant state changes; children mount only when both checks pass. `PostMessageCard` then reads the captured tool-call part from `s.message.parts` and renders from its args.
567
+
568
+ For the opposite pattern (showing partial data as it streams in), see [Field-Level Streaming State](#field-level-streaming-state) and [Partial Results & Streaming](#partial-results--streaming) below.
569
+
570
+ ### Field-Level Streaming State
571
+
572
+ Use `useToolArgsStatus` to react to per-field streaming state. The hook returns a `propStatus` map where each top-level key in the args object resolves from `"streaming"` to `"complete"` as the partial JSON arrives. Call it inside a tool-call message part context:
518
573
 
519
- const FormToolUI = makeAssistantToolUI({
574
+ ```tsx
575
+ import { useToolArgsStatus } from "@assistant-ui/react";
576
+
577
+ const FormToolUI = makeAssistantToolUI<{ email: string; phone: string }, unknown>({
520
578
  toolName: "submitForm",
521
579
  render: ({ args }) => {
522
- const emailStatus = useToolArgsFieldStatus(["email"]);
523
- const phoneStatus = useToolArgsFieldStatus(["phone"]);
580
+ const { propStatus } = useToolArgsStatus<{ email: string; phone: string }>();
524
581
 
525
582
  return (
526
583
  <form className="space-y-4">
527
584
  <div>
528
585
  <input
529
586
  type="email"
530
- value={args.email}
531
- className={emailStatus.type === "running" ? "loading" : ""}
587
+ value={args.email ?? ""}
588
+ className={propStatus.email === "streaming" ? "loading" : ""}
532
589
  disabled
533
590
  />
534
- {emailStatus.type === "incomplete" && (
535
- <span className="text-red-500">Invalid email</span>
536
- )}
537
591
  </div>
538
592
 
539
593
  <div>
540
594
  <input
541
595
  type="tel"
542
- value={args.phone}
543
- className={phoneStatus.type === "running" ? "loading" : ""}
596
+ value={args.phone ?? ""}
597
+ className={propStatus.phone === "streaming" ? "loading" : ""}
544
598
  disabled
545
599
  />
546
600
  </div>
@@ -596,24 +650,7 @@ const AnalysisToolUI = makeAssistantToolUI<
596
650
 
597
651
  ### Custom Tool Fallback
598
652
 
599
- Provide a custom UI for tools without specific UIs:
600
-
601
- ```tsx
602
- <Thread
603
- components={{
604
- ToolFallback: ({ toolName, args, result }) => (
605
- <div className="tool-fallback rounded bg-gray-100 p-3">
606
- <code className="text-sm">
607
- {toolName}({JSON.stringify(args)})
608
- </code>
609
- {result && (
610
- <pre className="mt-2 text-xs">{JSON.stringify(result, null, 2)}</pre>
611
- )}
612
- </div>
613
- ),
614
- }}
615
- />
616
- ```
653
+ For tools that have no dedicated UI, add the `ToolFallback` shadcn component to your project. See the [ToolFallback install guide](/docs/ui/tool-fallback) for setup instructions and the [ToolGroup guide](/docs/ui/tool-group) for grouping consecutive tool calls into a collapsible container.
617
654
 
618
655
  ## Execution Context
619
656
 
@@ -777,6 +814,41 @@ const WeatherUI = makeAssistantToolUI({
777
814
 
778
815
  `propStatus` maps each key to `"streaming"` | `"complete"` once the key appears in the partial JSON. Keys not yet present in the stream are absent from `propStatus`.
779
816
 
817
+ ## Data-Part Generative UI
818
+
819
+ Alongside tool-call rendering, assistant-ui supports a second generative UI mechanism based on `DataMessagePart`. Instead of attaching UI to a tool invocation, the backend (or the LangGraph graph) emits named data events that are appended as `{ type: "data", name, data }` parts on the parent assistant message.
820
+
821
+ **When to choose which:**
822
+
823
+ - **Tool UI**: the **model** decides what to render by calling a tool whose args become the component's data. Register the renderer via the [`Tools()`](/docs/guides/tools) toolkit's `render` field (recommended), or standalone with `makeAssistantToolUI` / `useAssistantToolUI` when the tool itself is defined elsewhere (backend, MCP, LangGraph). Args stream incrementally, so you observe partial state via `status` / `useToolArgsStatus` and may need [Deferred Rendering](#deferred-rendering) for components that should only mount with final data.
824
+ - **Data UI** (`makeAssistantDataUI`): the **backend or orchestrator** decides what to render and pushes a named data event onto the assistant message. Data parts arrive as terminal events with no streaming partials, so the renderer naturally fires once with the final data.
825
+
826
+ If you want a component to appear only after the message is complete and you control the backend, Data UI is usually the more direct fit; reach for Tool UI's deferred pattern when the model itself must drive the choice.
827
+
828
+ Use `makeAssistantDataUI` to register a renderer for a named data part:
829
+
830
+ ```tsx
831
+ import { makeAssistantDataUI } from "@assistant-ui/react";
832
+
833
+ type ChartProps = { series: number[]; title: string };
834
+
835
+ export const ChartUI = makeAssistantDataUI<ChartProps>({
836
+ name: "chart",
837
+ render: ({ data }) => (
838
+ <div>
839
+ <h3>{data.title}</h3>
840
+ <Chart series={data.series} />
841
+ </div>
842
+ ),
843
+ });
844
+ ```
845
+
846
+ Mount `<ChartUI />` once inside the `AssistantRuntimeProvider` tree; it renders nothing itself and only registers the renderer.
847
+
848
+ For LangGraph-specific patterns (emitting UI from a Python/TypeScript graph node via `push_ui_message` / `typedUi`, dynamic loading with `LoadExternalComponent`, and the `useLangGraphUIMessages` escape hatch), see [LangGraph Generative UI](/docs/runtimes/langgraph/generative-ui).
849
+
850
+ A fallback renderer for unmatched data parts is available internally but `setFallbackDataUI` is not yet a public API.
851
+
780
852
  ## Related Guides
781
853
 
782
854
  - [Tools Guide](/docs/guides/tools) - Learn how to create and use tools with AI models
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: Tools
3
3
  description: Give your assistant actions like API calls, database queries, and more.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  Tools enable LLMs to take actions and interact with external systems. assistant-ui provides a comprehensive toolkit for creating, managing, and visualizing tool interactions in real-time.
@@ -24,9 +25,9 @@ When tools are executed, you can display custom generative UI components that pr
24
25
  creating your own Tool UI component for the tool's name.
25
26
  </Callout>
26
27
 
27
- ## Recommended: Tools() API
28
+ ## Tools() API
28
29
 
29
- The `Tools()` API is the recommended way to register tools in assistant-ui. It provides centralized tool registration that prevents duplicate registrations and works seamlessly with all runtimes.
30
+ The `Tools()` API is the recommended starting point for registering tools in assistant-ui. It provides centralized tool registration that prevents duplicate registrations and works seamlessly with all runtimes. For tools whose availability depends on a specific part of your UI being mounted, see the [component-based APIs](#component-based-apis) below; both styles are supported and can be mixed in the same app.
30
31
 
31
32
  ### Quick Start
32
33
 
@@ -207,6 +208,32 @@ execute: async (args, context) => {
207
208
  };
208
209
  ```
209
210
 
211
+ ### Cancellation
212
+
213
+ `context.abortSignal` is an `AbortSignal` that fires when the user stops the run. Pass it to any async I/O so the work stops immediately:
214
+
215
+ ```tsx
216
+ execute: async ({ query }, { abortSignal }) => {
217
+ const res = await fetch(`/api/search?q=${query}`, { signal: abortSignal });
218
+ return res.json();
219
+ },
220
+ ```
221
+
222
+ When using LangGraph with `unstable_createLangGraphStream`, the default `onDisconnect` value is already `"cancel"`, which tells the LangGraph server to cancel the run on abort:
223
+
224
+ ```ts
225
+ import { unstable_createLangGraphStream } from "@assistant-ui/react-langgraph";
226
+
227
+ const stream = unstable_createLangGraphStream({
228
+ client,
229
+ assistantId,
230
+ // onDisconnect defaults to "cancel"; the server cancels the run when the
231
+ // client disconnects or the user stops the message.
232
+ });
233
+ ```
234
+
235
+ See the [LangGraph quickstart](/docs/runtimes/langgraph/quickstart) for full setup.
236
+
210
237
  ### Human-in-the-Loop
211
238
 
212
239
  Tools can pause execution to request user input or approval:
@@ -260,15 +287,51 @@ const confirmationToolkit: Toolkit = {
260
287
  };
261
288
  ```
262
289
 
263
- ## Alternative Methods (Legacy)
290
+ ### Streaming Tool Args
291
+
292
+ While a tool is running, its arguments arrive as partial JSON. Use `useToolArgsStatus` inside a tool UI render function to react to each top-level field as it streams in. The hook is exported from `@assistant-ui/react`.
293
+
294
+ ```tsx
295
+ import { useToolArgsStatus } from "@assistant-ui/react";
296
+
297
+ const SearchToolUI = makeAssistantToolUI<{ query: string; limit: number }, unknown>({
298
+ toolName: "search",
299
+ render: ({ args }) => {
300
+ const { propStatus } = useToolArgsStatus<{ query: string; limit: number }>();
301
+
302
+ return (
303
+ <div>
304
+ <span className={propStatus.query === "streaming" ? "animate-pulse" : ""}>
305
+ {args.query ?? "..."}
306
+ </span>
307
+ {propStatus.limit === "complete" && <span> (limit: {args.limit})</span>}
308
+ </div>
309
+ );
310
+ },
311
+ });
312
+ ```
313
+
314
+ `propStatus` maps each top-level key in the args object to `"streaming"` while it is still being parsed and to `"complete"` once that field is fully present.
315
+
316
+ ## Component-Based APIs
317
+
318
+ `makeAssistantTool`, `useAssistantTool`, and `makeAssistantToolUI` are component-and-hook-based APIs that coexist with the [`Tools()`](#tools-api) toolkit pattern. They are fully supported and the natural fit for the [intelligent components](/docs/copilots/motivation) pattern, where each part of your UI registers the tools it owns when it is mounted, for example a product-specific tool that should only be exposed while that product's screen is open.
319
+
320
+ <Callout type="info">
321
+ Be careful not to register the same tool from both APIs at once: each API
322
+ registers under `toolName`, and duplicate registrations will be rejected.
323
+ </Callout>
264
324
 
265
- <Callout type="warning">
266
- The following methods are supported for backwards compatibility but are not
267
- recommended for new code. They can cause duplicate registration errors and are
268
- harder to maintain. Use the `Tools()` API instead.
325
+ <Callout type="warn">
326
+ Tool **execution** can be registered dynamically (when a component mounts),
327
+ but tool **UI** should generally be pre-registered. A `render` function that
328
+ is only registered while a specific component is mounted will not render
329
+ when chat history is replayed or during server-side rendering. Either
330
+ declare the tool's `render` in a `Tools()` toolkit, or mount
331
+ `makeAssistantToolUI` near the root of your tree.
269
332
  </Callout>
270
333
 
271
- ### Using `makeAssistantTool` (Deprecated)
334
+ ### Using `makeAssistantTool`
272
335
 
273
336
  Register tools with the assistant context. Returns a React component that registers the tool when rendered:
274
337
 
@@ -303,9 +366,9 @@ function App() {
303
366
  }
304
367
  ```
305
368
 
306
- **Why this is deprecated**: Component-based registration can lead to duplicate registrations if components are remounted or if the same tool is defined in multiple places.
369
+ Tradeoff: component-based registration is tied to React lifecycle, so the tool is registered when the component mounts and unregistered when it unmounts. Take care not to remount it accidentally if you also register the same tool elsewhere.
307
370
 
308
- ### Using `useAssistantTool` Hook (Deprecated)
371
+ ### Using the `useAssistantTool` Hook
309
372
 
310
373
  Register tools dynamically using React hooks:
311
374
 
@@ -329,9 +392,9 @@ function DynamicTools() {
329
392
  }
330
393
  ```
331
394
 
332
- **Why this is deprecated**: Hook-based registration ties tool definitions to component lifecycle, making them harder to test and potentially causing duplicate registrations.
395
+ Tradeoff: like `makeAssistantTool`, the registration follows the component lifecycle. Useful for dynamic tools that depend on component state or props.
333
396
 
334
- ### Using `makeAssistantToolUI` (Deprecated)
397
+ ### Using `makeAssistantToolUI`
335
398
 
336
399
  Create UI-only components for tools defined elsewhere:
337
400
 
@@ -365,7 +428,7 @@ function App() {
365
428
  }
366
429
  ```
367
430
 
368
- **Why this is deprecated**: Component-based UI registration can cause issues with tool UI not appearing or appearing multiple times.
431
+ Tradeoff: like the other component-based APIs, the UI is registered while the component is mounted. Useful when the tool UI needs access to surrounding component state or context.
369
432
 
370
433
  ## Tool Paradigms
371
434
 
@@ -391,37 +454,32 @@ const frontendToolkit: Toolkit = {
391
454
 
392
455
  ### Backend Tools
393
456
 
394
- Tools executed server-side:
457
+ Tools executed server-side live in your API route. A minimal example with the AI SDK:
458
+
459
+ ```ts title="@/app/api/chat/route.ts"
460
+ import { openai } from "@ai-sdk/openai";
461
+ import { streamText, convertToModelMessages, tool, zodSchema } from "ai";
462
+ import { z } from "zod";
395
463
 
396
- ```tsx
397
- // Backend route (AI SDK)
398
464
  export async function POST(req: Request) {
399
465
  const { messages } = await req.json();
400
-
401
466
  const result = streamText({
402
467
  model: openai("gpt-4o"),
403
468
  messages: await convertToModelMessages(messages),
404
469
  tools: {
405
- queryDatabase: {
470
+ queryDatabase: tool({
406
471
  description: "Query the application database",
407
- inputSchema: zodSchema(
408
- z.object({
409
- query: z.string(),
410
- table: z.string(),
411
- }),
412
- ),
413
- execute: async ({ query, table }) => {
414
- const results = await db.query(query, { table });
415
- return results;
416
- },
417
- },
472
+ inputSchema: zodSchema(z.object({ query: z.string(), table: z.string() })),
473
+ execute: async ({ query, table }) => db.query(query, { table }),
474
+ }),
418
475
  },
419
476
  });
420
-
421
477
  return result.toUIMessageStreamResponse();
422
478
  }
423
479
  ```
424
480
 
481
+ For the full AI SDK v6 backend setup including multi-step tool calls, frontend tools, history persistence with `withFormat`, and more, see the [AI SDK v6 guide](/docs/runtimes/ai-sdk/v6).
482
+
425
483
  ### Client-Defined Tools with frontendTools
426
484
 
427
485
  The Vercel AI SDK adapter implements automatic serialization of client-defined tools. Tools registered via the `Tools()` API are automatically included in API requests:
@@ -512,9 +570,47 @@ export async function POST(req: Request) {
512
570
  }
513
571
  ```
514
572
 
573
+ ## LangGraph subgraph events
574
+
575
+ When a LangGraph graph contains sub-agents (nested subgraphs), events from those subgraphs arrive with a `metadata.namespace` field identifying the originating subgraph. Pass event handlers to `useLangGraphRuntime` (or `useLangGraphMessages`) to react to them:
576
+
577
+ ```ts
578
+ const runtime = useLangGraphRuntime({
579
+ stream,
580
+ eventHandlers: {
581
+ onSubgraphValues: (namespace, values) => {
582
+ console.log("subgraph", namespace, "state:", values);
583
+ },
584
+ onSubgraphUpdates: (namespace, updates) => {
585
+ console.log("subgraph", namespace, "updates:", updates);
586
+ },
587
+ onSubgraphError: (namespace, error) => {
588
+ console.error("subgraph", namespace, "error:", error);
589
+ },
590
+ },
591
+ });
592
+ ```
593
+
594
+ `namespace` is a pipe-separated string like `"parent|child_agent"`. Messages emitted by a subgraph include `metadata.namespace` so you can attribute tool results to the correct sub-agent.
595
+
596
+ ## `useLangChainState`
597
+
598
+ When using `@assistant-ui/react-langchain` (`useStreamRuntime`), the `useLangChainState` hook lets you read any key from the current LangChain/LangGraph state on the client without a separate API call:
599
+
600
+ ```tsx
601
+ import { useLangChainState } from "@assistant-ui/react-langchain";
602
+
603
+ function TodoSidebar() {
604
+ const todos = useLangChainState<string[]>("todos", []);
605
+ return <ul>{todos.map((t) => <li key={t}>{t}</li>)}</ul>;
606
+ }
607
+ ```
608
+
609
+ The second argument is an optional default value. The hook re-renders whenever the state key changes during a stream.
610
+
515
611
  ## Best Practices
516
612
 
517
- 1. **Use Tools() API**: Always prefer the `Tools()` API over legacy component/hook-based registration
613
+ 1. **Pick one registration style per tool**: avoid registering the same tool through both the `Tools()` toolkit and a component-based API; both routes will register, and duplicates are rejected
518
614
  2. **Centralize Definitions**: Keep all tools in a toolkit file for easy management
519
615
  3. **Clear Descriptions**: Write descriptive tool descriptions that help the LLM understand when to use each tool
520
616
  4. **Parameter Validation**: Use Zod schemas to ensure type safety
@@ -524,9 +620,9 @@ export async function POST(req: Request) {
524
620
  8. **Performance**: Use abort signals for cancellable operations
525
621
  9. **Testing**: Test tools in isolation and with the full assistant flow
526
622
 
527
- ## Migration from Legacy APIs
623
+ ## Switching from Component-Based to Toolkit
528
624
 
529
- To migrate from legacy APIs to the `Tools()` API:
625
+ If you prefer the toolkit shape, switching is mechanical:
530
626
 
531
627
  1. **Create a toolkit object** with all your tools
532
628
  2. **Move tool definitions** from `makeAssistantTool`/`useAssistantTool` calls into the toolkit
@@ -537,7 +633,7 @@ To migrate from legacy APIs to the `Tools()` API:
537
633
  Example migration:
538
634
 
539
635
  ```tsx
540
- // Before (Legacy)
636
+ // Component-based API
541
637
  const WeatherTool = makeAssistantTool({
542
638
  toolName: "getWeather",
543
639
  description: "Get weather",
@@ -554,7 +650,7 @@ function App() {
554
650
  );
555
651
  }
556
652
 
557
- // After (Recommended)
653
+ // Toolkit API
558
654
  const toolkit: Toolkit = {
559
655
  getWeather: {
560
656
  description: "Get weather",