@assistant-ui/mcp-docs-server 0.2.3 → 0.3.1

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 (452) hide show
  1. package/README.md +16 -43
  2. package/dist/index.d.ts +2 -3
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -91
  5. package/dist/index.js.map +1 -1
  6. package/dist/proxy.d.ts +9 -0
  7. package/dist/proxy.d.ts.map +1 -0
  8. package/dist/proxy.js +91 -0
  9. package/dist/proxy.js.map +1 -0
  10. package/package.json +8 -12
  11. package/src/index.ts +3 -115
  12. package/src/proxy.test.ts +385 -0
  13. package/src/proxy.ts +126 -0
  14. package/.docs/organized/code-examples/waterfall.md +0 -807
  15. package/.docs/organized/code-examples/with-a2a.md +0 -675
  16. package/.docs/organized/code-examples/with-ag-ui.md +0 -553
  17. package/.docs/organized/code-examples/with-ai-sdk-v7.md +0 -466
  18. package/.docs/organized/code-examples/with-artifacts.md +0 -815
  19. package/.docs/organized/code-examples/with-assistant-transport.md +0 -576
  20. package/.docs/organized/code-examples/with-browser-extension.md +0 -371
  21. package/.docs/organized/code-examples/with-chain-of-thought.md +0 -962
  22. package/.docs/organized/code-examples/with-cloud-standalone.md +0 -681
  23. package/.docs/organized/code-examples/with-cloud.md +0 -439
  24. package/.docs/organized/code-examples/with-custom-thread-list.md +0 -569
  25. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +0 -527
  26. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +0 -697
  27. package/.docs/organized/code-examples/with-eve.md +0 -405
  28. package/.docs/organized/code-examples/with-expo.md +0 -2246
  29. package/.docs/organized/code-examples/with-external-store.md +0 -421
  30. package/.docs/organized/code-examples/with-ffmpeg.md +0 -829
  31. package/.docs/organized/code-examples/with-generative-ui.md +0 -1810
  32. package/.docs/organized/code-examples/with-google-adk.md +0 -368
  33. package/.docs/organized/code-examples/with-heat-graph.md +0 -304
  34. package/.docs/organized/code-examples/with-image-generation.md +0 -463
  35. package/.docs/organized/code-examples/with-interactables.md +0 -733
  36. package/.docs/organized/code-examples/with-langchain.md +0 -446
  37. package/.docs/organized/code-examples/with-langgraph.md +0 -855
  38. package/.docs/organized/code-examples/with-livekit.md +0 -643
  39. package/.docs/organized/code-examples/with-mcp.md +0 -782
  40. package/.docs/organized/code-examples/with-nuxt.md +0 -2428
  41. package/.docs/organized/code-examples/with-opencode.md +0 -1974
  42. package/.docs/organized/code-examples/with-openui.md +0 -450
  43. package/.docs/organized/code-examples/with-pi.md +0 -2084
  44. package/.docs/organized/code-examples/with-react-hook-form.md +0 -727
  45. package/.docs/organized/code-examples/with-react-ink-web.md +0 -740
  46. package/.docs/organized/code-examples/with-react-ink.md +0 -473
  47. package/.docs/organized/code-examples/with-react-router.md +0 -936
  48. package/.docs/organized/code-examples/with-resumable-stream.md +0 -668
  49. package/.docs/organized/code-examples/with-store.md +0 -679
  50. package/.docs/organized/code-examples/with-svelte.md +0 -415
  51. package/.docs/organized/code-examples/with-sveltekit.md +0 -1061
  52. package/.docs/organized/code-examples/with-tanstack.md +0 -812
  53. package/.docs/organized/code-examples/with-tap-runtime.md +0 -813
  54. package/.docs/organized/code-examples/with-virtualized-thread.md +0 -681
  55. package/.docs/organized/code-examples/with-vue.md +0 -408
  56. package/.docs/raw/docs/(getting-started)/architecture.mdx +0 -146
  57. package/.docs/raw/docs/(getting-started)/base-ui.mdx +0 -39
  58. package/.docs/raw/docs/(getting-started)/cli.mdx +0 -542
  59. package/.docs/raw/docs/(getting-started)/devtools.mdx +0 -79
  60. package/.docs/raw/docs/(getting-started)/index.mdx +0 -23
  61. package/.docs/raw/docs/(getting-started)/installation.mdx +0 -483
  62. package/.docs/raw/docs/(getting-started)/llm.mdx +0 -211
  63. package/.docs/raw/docs/(getting-started)/rtl.mdx +0 -78
  64. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +0 -36
  65. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +0 -20
  66. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +0 -34
  67. package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +0 -44
  68. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +0 -59
  69. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +0 -20
  70. package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +0 -26
  71. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -84
  72. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +0 -22
  73. package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +0 -64
  74. package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +0 -22
  75. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +0 -57
  76. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +0 -49
  77. package/.docs/raw/docs/(reference)/api-reference/generative-ui/a2ui.mdx +0 -40
  78. package/.docs/raw/docs/(reference)/api-reference/generative-ui/actions.mdx +0 -56
  79. package/.docs/raw/docs/(reference)/api-reference/generative-ui/components.mdx +0 -86
  80. package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +0 -39
  81. package/.docs/raw/docs/(reference)/api-reference/generative-ui/json-generative-ui.mdx +0 -42
  82. package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +0 -84
  83. package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +0 -85
  84. package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +0 -45
  85. package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +0 -93
  86. package/.docs/raw/docs/(reference)/api-reference/generative-ui/tokens.mdx +0 -62
  87. package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +0 -129
  88. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +0 -31
  89. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +0 -34
  90. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +0 -350
  91. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +0 -28
  92. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +0 -97
  93. package/.docs/raw/docs/(reference)/api-reference/integrations/ai-sdk.mdx +0 -200
  94. package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +0 -24
  95. package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +0 -118
  96. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +0 -28
  97. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -37
  98. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +0 -50
  99. package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +0 -22
  100. package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +0 -20
  101. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +0 -566
  102. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +0 -152
  103. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +0 -239
  104. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +0 -208
  105. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +0 -108
  106. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -99
  107. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -145
  108. package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +0 -82
  109. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +0 -637
  110. package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -22
  111. package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -65
  112. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +0 -73
  113. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +0 -117
  114. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -339
  115. package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +0 -77
  116. package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +0 -88
  117. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +0 -81
  118. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -129
  119. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +0 -138
  120. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +0 -122
  121. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +0 -289
  122. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -20
  123. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +0 -24
  124. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +0 -32
  125. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +0 -43
  126. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +0 -43
  127. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +0 -24
  128. package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +0 -20
  129. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -24
  130. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -24
  131. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +0 -36
  132. package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +0 -85
  133. package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +0 -45
  134. package/.docs/raw/docs/(reference)/api-reference/tools/interactables-legacy.mdx +0 -55
  135. package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +0 -151
  136. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +0 -106
  137. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +0 -62
  138. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +0 -178
  139. package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +0 -48
  140. package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +0 -62
  141. package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +0 -22
  142. package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +0 -19
  143. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +0 -152
  144. package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +0 -22
  145. package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +0 -54
  146. package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +0 -36
  147. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +0 -527
  148. package/.docs/raw/docs/cloud/ai-sdk.mdx +0 -604
  149. package/.docs/raw/docs/cloud/authorization.mdx +0 -252
  150. package/.docs/raw/docs/cloud/index.mdx +0 -46
  151. package/.docs/raw/docs/cloud/langgraph.mdx +0 -554
  152. package/.docs/raw/docs/copilots/assistant-frame.mdx +0 -411
  153. package/.docs/raw/docs/copilots/make-assistant-visible.mdx +0 -82
  154. package/.docs/raw/docs/copilots/model-context.mdx +0 -156
  155. package/.docs/raw/docs/copilots/motivation.mdx +0 -202
  156. package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +0 -64
  157. package/.docs/raw/docs/guides/attachments.mdx +0 -619
  158. package/.docs/raw/docs/guides/branching.mdx +0 -76
  159. package/.docs/raw/docs/guides/chain-of-thought.mdx +0 -164
  160. package/.docs/raw/docs/guides/chatgpt-subscription.mdx +0 -108
  161. package/.docs/raw/docs/guides/context-api.mdx +0 -619
  162. package/.docs/raw/docs/guides/dictation.mdx +0 -298
  163. package/.docs/raw/docs/guides/editing.mdx +0 -102
  164. package/.docs/raw/docs/guides/electron.mdx +0 -369
  165. package/.docs/raw/docs/guides/headless-composer-input.mdx +0 -113
  166. package/.docs/raw/docs/guides/image-generation.mdx +0 -74
  167. package/.docs/raw/docs/guides/index.mdx +0 -117
  168. package/.docs/raw/docs/guides/input-history.mdx +0 -55
  169. package/.docs/raw/docs/guides/latex.mdx +0 -158
  170. package/.docs/raw/docs/guides/mentions.mdx +0 -575
  171. package/.docs/raw/docs/guides/message-timing.mdx +0 -215
  172. package/.docs/raw/docs/guides/quoting.mdx +0 -169
  173. package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +0 -212
  174. package/.docs/raw/docs/guides/resumable-stream-stores.mdx +0 -152
  175. package/.docs/raw/docs/guides/resumable-streams.mdx +0 -292
  176. package/.docs/raw/docs/guides/slash-commands.mdx +0 -358
  177. package/.docs/raw/docs/guides/speech.mdx +0 -172
  178. package/.docs/raw/docs/guides/suggestions.mdx +0 -384
  179. package/.docs/raw/docs/guides/virtualization.mdx +0 -133
  180. package/.docs/raw/docs/guides/voice.mdx +0 -310
  181. package/.docs/raw/docs/ink/adapters.mdx +0 -99
  182. package/.docs/raw/docs/ink/custom-backend.mdx +0 -254
  183. package/.docs/raw/docs/ink/hooks.mdx +0 -469
  184. package/.docs/raw/docs/ink/index.mdx +0 -237
  185. package/.docs/raw/docs/ink/migration.mdx +0 -138
  186. package/.docs/raw/docs/ink/primitives.mdx +0 -1259
  187. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +0 -528
  188. package/.docs/raw/docs/integrations/auth/better-auth.mdx +0 -188
  189. package/.docs/raw/docs/integrations/auth/clerk.mdx +0 -166
  190. package/.docs/raw/docs/integrations/auth/next-auth.mdx +0 -191
  191. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +0 -88
  192. package/.docs/raw/docs/integrations/frameworks/cloudflare-agents.mdx +0 -283
  193. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +0 -188
  194. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +0 -57
  195. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +0 -201
  196. package/.docs/raw/docs/integrations/gateways/index.mdx +0 -162
  197. package/.docs/raw/docs/integrations/index.mdx +0 -178
  198. package/.docs/raw/docs/integrations/observability/helicone.mdx +0 -129
  199. package/.docs/raw/docs/integrations/observability/langfuse.mdx +0 -161
  200. package/.docs/raw/docs/integrations/observability/langsmith.mdx +0 -151
  201. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +0 -773
  202. package/.docs/raw/docs/migrations/deprecation-policy.mdx +0 -42
  203. package/.docs/raw/docs/migrations/index.mdx +0 -50
  204. package/.docs/raw/docs/migrations/react-compatibility.mdx +0 -74
  205. package/.docs/raw/docs/migrations/react-langgraph-v0-7.mdx +0 -328
  206. package/.docs/raw/docs/migrations/toolkit-tools.mdx +0 -236
  207. package/.docs/raw/docs/migrations/v0-11.mdx +0 -172
  208. package/.docs/raw/docs/migrations/v0-12.mdx +0 -302
  209. package/.docs/raw/docs/migrations/v0-14.mdx +0 -297
  210. package/.docs/raw/docs/migrations/v0-15.mdx +0 -270
  211. package/.docs/raw/docs/primitives/action-bar.mdx +0 -352
  212. package/.docs/raw/docs/primitives/assistant-modal.mdx +0 -216
  213. package/.docs/raw/docs/primitives/attachment.mdx +0 -217
  214. package/.docs/raw/docs/primitives/branch-picker.mdx +0 -222
  215. package/.docs/raw/docs/primitives/chain-of-thought.mdx +0 -315
  216. package/.docs/raw/docs/primitives/composer.mdx +0 -659
  217. package/.docs/raw/docs/primitives/error.mdx +0 -142
  218. package/.docs/raw/docs/primitives/index.mdx +0 -99
  219. package/.docs/raw/docs/primitives/message.mdx +0 -618
  220. package/.docs/raw/docs/primitives/selection-toolbar.mdx +0 -191
  221. package/.docs/raw/docs/primitives/suggestion.mdx +0 -254
  222. package/.docs/raw/docs/primitives/thread-list.mdx +0 -467
  223. package/.docs/raw/docs/primitives/thread.mdx +0 -509
  224. package/.docs/raw/docs/react-native/adapters.mdx +0 -94
  225. package/.docs/raw/docs/react-native/custom-backend.mdx +0 -207
  226. package/.docs/raw/docs/react-native/hooks.mdx +0 -339
  227. package/.docs/raw/docs/react-native/index.mdx +0 -289
  228. package/.docs/raw/docs/react-native/migration.mdx +0 -142
  229. package/.docs/raw/docs/react-native/primitives.mdx +0 -976
  230. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +0 -399
  231. package/.docs/raw/docs/runtimes/a2a/overview.mdx +0 -60
  232. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +0 -216
  233. package/.docs/raw/docs/runtimes/ag-ui/agent-state.mdx +0 -124
  234. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +0 -70
  235. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +0 -243
  236. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +0 -267
  237. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +0 -61
  238. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -122
  239. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +0 -135
  240. package/.docs/raw/docs/runtimes/ai-sdk/v6-legacy.mdx +0 -636
  241. package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +0 -731
  242. package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +0 -118
  243. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +0 -265
  244. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +0 -167
  245. package/.docs/raw/docs/runtimes/concepts/stability.mdx +0 -68
  246. package/.docs/raw/docs/runtimes/concepts/threads.mdx +0 -513
  247. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +0 -763
  248. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +0 -339
  249. package/.docs/raw/docs/runtimes/custom/external-store.mdx +0 -957
  250. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +0 -902
  251. package/.docs/raw/docs/runtimes/custom/overview.mdx +0 -71
  252. package/.docs/raw/docs/runtimes/eve/overview.mdx +0 -151
  253. package/.docs/raw/docs/runtimes/eve/quickstart.mdx +0 -192
  254. package/.docs/raw/docs/runtimes/google-adk/api.mdx +0 -256
  255. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +0 -784
  256. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +0 -69
  257. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +0 -229
  258. package/.docs/raw/docs/runtimes/langchain.mdx +0 -901
  259. package/.docs/raw/docs/runtimes/langgraph/agent-state.mdx +0 -181
  260. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +0 -305
  261. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +0 -104
  262. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +0 -84
  263. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +0 -496
  264. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +0 -144
  265. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +0 -113
  266. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +0 -29
  267. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -93
  268. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +0 -347
  269. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -393
  270. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +0 -194
  271. package/.docs/raw/docs/runtimes/opencode/overview.mdx +0 -58
  272. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +0 -119
  273. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +0 -133
  274. package/.docs/raw/docs/tools/a2ui.mdx +0 -107
  275. package/.docs/raw/docs/tools/backend.mdx +0 -147
  276. package/.docs/raw/docs/tools/defining-tools.mdx +0 -574
  277. package/.docs/raw/docs/tools/dynamic-tools.mdx +0 -112
  278. package/.docs/raw/docs/tools/generative-ui-primitive.mdx +0 -180
  279. package/.docs/raw/docs/tools/generative-ui-slack.mdx +0 -167
  280. package/.docs/raw/docs/tools/generative-ui-teams.mdx +0 -160
  281. package/.docs/raw/docs/tools/generative-ui.mdx +0 -322
  282. package/.docs/raw/docs/tools/index.mdx +0 -72
  283. package/.docs/raw/docs/tools/interactables.mdx +0 -1084
  284. package/.docs/raw/docs/tools/mcp-apps.mdx +0 -363
  285. package/.docs/raw/docs/tools/mcp.mdx +0 -466
  286. package/.docs/raw/docs/tools/multi-agent.mdx +0 -237
  287. package/.docs/raw/docs/tools/openui.mdx +0 -175
  288. package/.docs/raw/docs/tools/tool-ui.mdx +0 -1020
  289. package/.docs/raw/docs/tools/user-managed-mcp.mdx +0 -428
  290. package/.docs/raw/docs/ui/assistant-modal.mdx +0 -166
  291. package/.docs/raw/docs/ui/assistant-sidebar.mdx +0 -89
  292. package/.docs/raw/docs/ui/attachment.mdx +0 -279
  293. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +0 -247
  294. package/.docs/raw/docs/ui/context-display.mdx +0 -148
  295. package/.docs/raw/docs/ui/directive-text.mdx +0 -114
  296. package/.docs/raw/docs/ui/file.mdx +0 -159
  297. package/.docs/raw/docs/ui/follow-up-suggestions.mdx +0 -82
  298. package/.docs/raw/docs/ui/image.mdx +0 -102
  299. package/.docs/raw/docs/ui/markdown.mdx +0 -103
  300. package/.docs/raw/docs/ui/mcp-config.mdx +0 -107
  301. package/.docs/raw/docs/ui/mermaid.mdx +0 -92
  302. package/.docs/raw/docs/ui/message-timing.mdx +0 -93
  303. package/.docs/raw/docs/ui/model-selector.mdx +0 -455
  304. package/.docs/raw/docs/ui/part-grouping.mdx +0 -614
  305. package/.docs/raw/docs/ui/quote.mdx +0 -211
  306. package/.docs/raw/docs/ui/reasoning.mdx +0 -214
  307. package/.docs/raw/docs/ui/scrollbar.mdx +0 -77
  308. package/.docs/raw/docs/ui/sources.mdx +0 -186
  309. package/.docs/raw/docs/ui/streamdown.mdx +0 -392
  310. package/.docs/raw/docs/ui/syntax-highlighting.mdx +0 -205
  311. package/.docs/raw/docs/ui/thread-list.mdx +0 -411
  312. package/.docs/raw/docs/ui/thread.mdx +0 -559
  313. package/.docs/raw/docs/ui/tool-fallback.mdx +0 -141
  314. package/.docs/raw/docs/ui/tool-group.mdx +0 -240
  315. package/.docs/raw/docs/ui/voice.mdx +0 -173
  316. package/.docs/raw/docs/utilities/heat-graph.mdx +0 -237
  317. package/.docs/raw/docs/utilities/react-o11y.mdx +0 -362
  318. package/.docs/raw/docs/utilities/tw-shimmer.mdx +0 -212
  319. package/dist/constants.d.ts +0 -14
  320. package/dist/constants.d.ts.map +0 -1
  321. package/dist/constants.js +0 -19
  322. package/dist/constants.js.map +0 -1
  323. package/dist/prepare-docs/code-examples.d.ts +0 -5
  324. package/dist/prepare-docs/code-examples.d.ts.map +0 -1
  325. package/dist/prepare-docs/code-examples.js +0 -117
  326. package/dist/prepare-docs/code-examples.js.map +0 -1
  327. package/dist/prepare-docs/copy-raw.d.ts +0 -5
  328. package/dist/prepare-docs/copy-raw.d.ts.map +0 -1
  329. package/dist/prepare-docs/copy-raw.js +0 -49
  330. package/dist/prepare-docs/copy-raw.js.map +0 -1
  331. package/dist/prepare-docs/prepare.d.ts +0 -1
  332. package/dist/prepare-docs/prepare.js +0 -22
  333. package/dist/prepare-docs/prepare.js.map +0 -1
  334. package/dist/prompts/xulux-playground.d.ts +0 -12
  335. package/dist/prompts/xulux-playground.d.ts.map +0 -1
  336. package/dist/prompts/xulux-playground.js +0 -33
  337. package/dist/prompts/xulux-playground.js.map +0 -1
  338. package/dist/tools/docs.d.ts +0 -22
  339. package/dist/tools/docs.d.ts.map +0 -1
  340. package/dist/tools/docs.js +0 -177
  341. package/dist/tools/docs.js.map +0 -1
  342. package/dist/tools/examples.d.ts +0 -24
  343. package/dist/tools/examples.d.ts.map +0 -1
  344. package/dist/tools/examples.js +0 -87
  345. package/dist/tools/examples.js.map +0 -1
  346. package/dist/tools/resources.d.ts +0 -6
  347. package/dist/tools/resources.d.ts.map +0 -1
  348. package/dist/tools/resources.js +0 -75
  349. package/dist/tools/resources.js.map +0 -1
  350. package/dist/tools/search.d.ts +0 -24
  351. package/dist/tools/search.d.ts.map +0 -1
  352. package/dist/tools/search.js +0 -39
  353. package/dist/tools/search.js.map +0 -1
  354. package/dist/tools/tests/mcp-test-client.d.ts +0 -15
  355. package/dist/tools/tests/mcp-test-client.d.ts.map +0 -1
  356. package/dist/tools/tests/mcp-test-client.js +0 -68
  357. package/dist/tools/tests/mcp-test-client.js.map +0 -1
  358. package/dist/tools/tests/test-setup.d.ts +0 -7
  359. package/dist/tools/tests/test-setup.d.ts.map +0 -1
  360. package/dist/tools/tests/test-setup.js +0 -36
  361. package/dist/tools/tests/test-setup.js.map +0 -1
  362. package/dist/tools/xulux-templates.d.ts +0 -58
  363. package/dist/tools/xulux-templates.d.ts.map +0 -1
  364. package/dist/tools/xulux-templates.js +0 -84
  365. package/dist/tools/xulux-templates.js.map +0 -1
  366. package/dist/utils/cache.d.ts +0 -5
  367. package/dist/utils/cache.d.ts.map +0 -1
  368. package/dist/utils/cache.js +0 -18
  369. package/dist/utils/cache.js.map +0 -1
  370. package/dist/utils/logger.d.ts +0 -10
  371. package/dist/utils/logger.d.ts.map +0 -1
  372. package/dist/utils/logger.js +0 -20
  373. package/dist/utils/logger.js.map +0 -1
  374. package/dist/utils/mcp-format.d.ts +0 -11
  375. package/dist/utils/mcp-format.d.ts.map +0 -1
  376. package/dist/utils/mcp-format.js +0 -14
  377. package/dist/utils/mcp-format.js.map +0 -1
  378. package/dist/utils/mdx.d.ts +0 -12
  379. package/dist/utils/mdx.d.ts.map +0 -1
  380. package/dist/utils/mdx.js +0 -45
  381. package/dist/utils/mdx.js.map +0 -1
  382. package/dist/utils/paths.d.ts +0 -12
  383. package/dist/utils/paths.d.ts.map +0 -1
  384. package/dist/utils/paths.js +0 -93
  385. package/dist/utils/paths.js.map +0 -1
  386. package/dist/utils/search.d.ts +0 -10
  387. package/dist/utils/search.d.ts.map +0 -1
  388. package/dist/utils/search.js +0 -97
  389. package/dist/utils/search.js.map +0 -1
  390. package/dist/utils/security.d.ts +0 -5
  391. package/dist/utils/security.d.ts.map +0 -1
  392. package/dist/utils/security.js +0 -22
  393. package/dist/utils/security.js.map +0 -1
  394. package/dist/xulux/catalog-client.d.ts +0 -14
  395. package/dist/xulux/catalog-client.d.ts.map +0 -1
  396. package/dist/xulux/catalog-client.js +0 -112
  397. package/dist/xulux/catalog-client.js.map +0 -1
  398. package/dist/xulux/fallback-catalog.d.ts +0 -7
  399. package/dist/xulux/fallback-catalog.d.ts.map +0 -1
  400. package/dist/xulux/fallback-catalog.js +0 -47
  401. package/dist/xulux/fallback-catalog.js.map +0 -1
  402. package/dist/xulux/fetch-sandbox.d.ts +0 -5
  403. package/dist/xulux/fetch-sandbox.d.ts.map +0 -1
  404. package/dist/xulux/fetch-sandbox.js +0 -40
  405. package/dist/xulux/fetch-sandbox.js.map +0 -1
  406. package/dist/xulux/template-service.d.ts +0 -84
  407. package/dist/xulux/template-service.d.ts.map +0 -1
  408. package/dist/xulux/template-service.js +0 -223
  409. package/dist/xulux/template-service.js.map +0 -1
  410. package/dist/xulux/types.d.ts +0 -55
  411. package/dist/xulux/types.d.ts.map +0 -1
  412. package/dist/xulux/types.js +0 -6
  413. package/dist/xulux/types.js.map +0 -1
  414. package/src/constants.ts +0 -24
  415. package/src/prepare-docs/code-examples.ts +0 -158
  416. package/src/prepare-docs/copy-raw.ts +0 -50
  417. package/src/prepare-docs/prepare.ts +0 -24
  418. package/src/prompts/xulux-playground.ts +0 -36
  419. package/src/tools/docs.ts +0 -255
  420. package/src/tools/examples.ts +0 -114
  421. package/src/tools/resources.ts +0 -111
  422. package/src/tools/search.ts +0 -46
  423. package/src/tools/tests/completions.test.ts +0 -60
  424. package/src/tools/tests/directory-size-cap.test.ts +0 -50
  425. package/src/tools/tests/docs.test.ts +0 -147
  426. package/src/tools/tests/examples.test.ts +0 -94
  427. package/src/tools/tests/integration.test.ts +0 -45
  428. package/src/tools/tests/json-parsing.test.ts +0 -23
  429. package/src/tools/tests/listings-cache.test.ts +0 -19
  430. package/src/tools/tests/mcp-protocol.test.ts +0 -216
  431. package/src/tools/tests/mcp-test-client.ts +0 -111
  432. package/src/tools/tests/path-traversal.test.ts +0 -84
  433. package/src/tools/tests/resources.test.ts +0 -133
  434. package/src/tools/tests/search.test.ts +0 -37
  435. package/src/tools/tests/test-setup.ts +0 -50
  436. package/src/tools/tests/xulux-templates.test.ts +0 -325
  437. package/src/tools/xulux-templates.ts +0 -141
  438. package/src/utils/cache.ts +0 -20
  439. package/src/utils/logger.ts +0 -20
  440. package/src/utils/mcp-format.ts +0 -14
  441. package/src/utils/mdx.ts +0 -59
  442. package/src/utils/paths.ts +0 -139
  443. package/src/utils/search.ts +0 -131
  444. package/src/utils/security.ts +0 -52
  445. package/src/utils/tests/cache.test.ts +0 -51
  446. package/src/utils/tests/mcp-format.test.ts +0 -22
  447. package/src/utils/tests/security.test.ts +0 -119
  448. package/src/xulux/catalog-client.ts +0 -150
  449. package/src/xulux/fallback-catalog.ts +0 -63
  450. package/src/xulux/fetch-sandbox.ts +0 -56
  451. package/src/xulux/template-service.ts +0 -406
  452. package/src/xulux/types.ts +0 -64
@@ -1,1020 +0,0 @@
1
- ---
2
- title: Tool UI
3
- description: Render AI tool calls as custom React components — show loading, result, and interactive states for each tool invocation in assistant-ui.
4
- platforms: ["react"]
5
- ---
6
-
7
- import { ToolUISample } from "@/components/pages/docs/samples/tool-ui";
8
- import { PreviewCode } from "@/components/pages/docs/preview-code.server";
9
- import { ToolUIRendererSample } from "@/components/pages/docs/samples/tool-ui/custom-renderer";
10
-
11
- Create custom UI components for AI tool calls, providing visual feedback and interactive experiences when tools are executed.
12
-
13
- <ToolUISample />
14
-
15
- ## Overview
16
-
17
- Tool UIs in assistant-ui allow you to create custom interfaces that appear when AI tools are called. These generative UI components enhance the user experience by:
18
-
19
- - **Visualizing tool execution** with loading states and progress indicators
20
- - **Displaying results** in rich, formatted layouts
21
- - **Enabling user interaction** through forms and controls
22
- - **Providing error feedback** with helpful recovery options
23
-
24
- This guide demonstrates building tool UIs with the **Vercel AI SDK**.
25
-
26
- To let the model compose UI from a vocabulary instead of binding one component per tool, see [Generative UI](/docs/tools/generative-ui).
27
-
28
- ## Creating Tool UIs
29
-
30
- Tool UI is registered on toolkit entries. The same entry can define a browser-executed frontend tool, a human tool that completes through `addResult`, or a render-only backend tool whose schema and execution live on the server.
31
-
32
- ### 1. Client-Defined Tools
33
-
34
- If you're creating tools on the client side, register them in a toolkit with `Tools({ toolkit })`.
35
-
36
- ```tsx title="app/toolkit.tsx"
37
- "use generative";
38
-
39
- import { defineToolkit } from "@assistant-ui/react";
40
- import { z } from "zod";
41
-
42
- export default defineToolkit({
43
- getWeather: {
44
- description: "Get current weather for a location",
45
- parameters: z.object({
46
- location: z.string(),
47
- unit: z.enum(["celsius", "fahrenheit"]),
48
- }),
49
- execute: async ({ location, unit }) => {
50
- "use client";
51
- return fetchWeatherAPI(location, unit);
52
- },
53
- render: ({ args, result, status }) => {
54
- if (status.type === "running") {
55
- return <div>Checking weather in {args.location}...</div>;
56
- }
57
-
58
- return (
59
- <div className="weather-card">
60
- <h3>{args.location}</h3>
61
- <p>
62
- {result.temperature}°{args.unit === "celsius" ? "C" : "F"}
63
- </p>
64
- <p>{result.description}</p>
65
- </div>
66
- );
67
- },
68
- },
69
- });
70
- ```
71
-
72
- ```tsx title="app/MyRuntimeProvider.tsx"
73
- import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
74
- import { useChatRuntime } from "@assistant-ui/ai-sdk";
75
- import toolkit from "./toolkit";
76
-
77
- function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
78
- const runtime = useChatRuntime();
79
- const config = AuiConfig({ tools: Tools({ toolkit }) });
80
- return (
81
- <AssistantRuntimeProvider runtime={runtime} config={config}>
82
- {children}
83
- </AssistantRuntimeProvider>
84
- );
85
- }
86
- ```
87
-
88
- `useChatRuntime()` targets `/api/chat` by default. To point at a different endpoint or customize requests, see [Custom transport](/docs/runtimes/ai-sdk/v7#custom-transport).
89
-
90
- <Callout type="tip">
91
- Frontend toolkit entries can be passed to your backend using the
92
- `frontendTools` utility.
93
- </Callout>
94
-
95
- Learn more about creating tools in the [Tools Guide](/docs/tools/defining-tools).
96
-
97
- ### 2. UI-Only for Existing Tools
98
-
99
- If your tool is defined elsewhere (e.g., in your backend API, MCP server, or LangGraph), register a backend toolkit entry with just `render`:
100
-
101
- ```tsx
102
- const toolkit = defineToolkit({
103
- getWeather: {
104
- type: "backend",
105
- render: ({ args, result, status }) => {
106
- // UI rendering logic only
107
- },
108
- },
109
- });
110
- ```
111
-
112
- ## Quick Start Example
113
-
114
- This example uses a backend toolkit entry for a tool that the server defines. The preview uses a shorter renderer than the steps below.
115
-
116
- <PreviewCode
117
- file="components/pages/docs/samples/tool-ui/custom-renderer"
118
- name="WeatherToolUI"
119
- >
120
- <ToolUIRendererSample />
121
- </PreviewCode>
122
-
123
- <Steps>
124
- <Step>
125
-
126
- ### Create a Tool UI Renderer
127
-
128
- ```tsx
129
- import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
130
- import { z } from "zod";
131
-
132
- type WeatherArgs = {
133
- location: string;
134
- unit: "celsius" | "fahrenheit";
135
- };
136
-
137
- type WeatherResult = {
138
- temperature: number;
139
- description: string;
140
- humidity: number;
141
- windSpeed: number;
142
- };
143
-
144
- const WeatherToolUI: ToolCallMessagePartComponent<
145
- WeatherArgs,
146
- WeatherResult
147
- > = ({ args, status, result }) => {
148
- if (status.type === "running") {
149
- return (
150
- <div className="flex items-center gap-2">
151
- <Spinner />
152
- <span>Checking weather in {args.location}...</span>
153
- </div>
154
- );
155
- }
156
-
157
- if (status.type === "incomplete" && status.reason === "error") {
158
- return (
159
- <div className="text-red-500">
160
- Failed to get weather for {args.location}
161
- </div>
162
- );
163
- }
164
-
165
- return (
166
- <div className="weather-card rounded-lg bg-blue-50 p-4">
167
- <h3 className="text-lg font-bold">{args.location}</h3>
168
- <div className="mt-2 grid grid-cols-2 gap-4">
169
- <div>
170
- <p className="text-2xl">
171
- {result.temperature}°{args.unit === "celsius" ? "C" : "F"}
172
- </p>
173
- <p className="text-gray-600">{result.description}</p>
174
- </div>
175
- <div className="text-sm">
176
- <p>Humidity: {result.humidity}%</p>
177
- <p>Wind: {result.windSpeed} km/h</p>
178
- </div>
179
- </div>
180
- </div>
181
- );
182
- };
183
- ```
184
-
185
- </Step>
186
- <Step>
187
-
188
- ### Register the Tool UI
189
-
190
- Put the renderer on the related backend toolkit entry.
191
-
192
- Set `display` to `"standalone"` to keep the tool UI outside the collapsed tool group. A backend tool uses the inline display by default.
193
-
194
- ```tsx
195
- const toolkit = defineToolkit({
196
- getWeather: {
197
- type: "backend",
198
- display: "standalone",
199
- render: WeatherToolUI,
200
- },
201
- });
202
-
203
- function App({ runtime }: { runtime: AssistantRuntime }) {
204
- const config = AuiConfig({ tools: Tools({ toolkit }) });
205
- return (
206
- <AssistantRuntimeProvider runtime={runtime} config={config}>
207
- <Thread />
208
- </AssistantRuntimeProvider>
209
- );
210
- }
211
- ```
212
-
213
- </Step>
214
- <Step>
215
-
216
- ### Define the Backend Tool (Vercel AI SDK)
217
-
218
- When using the Vercel AI SDK, define the corresponding tool in your API route:
219
-
220
- ```tsx title="/app/api/chat/route.ts"
221
- import { streamText, tool, zodSchema } from "ai";
222
- import { z } from "zod";
223
-
224
- export async function POST(req: Request) {
225
- const { messages } = await req.json();
226
-
227
- const result = streamText({
228
- model: openai("gpt-5.6-luna"),
229
- messages: await convertToModelMessages(messages),
230
- tools: {
231
- getWeather: tool({
232
- description: "Get current weather for a location",
233
- inputSchema: zodSchema(
234
- z.object({
235
- location: z.string(),
236
- unit: z.enum(["celsius", "fahrenheit"]),
237
- }),
238
- ),
239
- execute: async ({ location, unit }) => {
240
- const weather = await fetchWeatherAPI(location);
241
- return {
242
- temperature: weather.temp,
243
- description: weather.condition,
244
- humidity: weather.humidity,
245
- windSpeed: weather.wind,
246
- };
247
- },
248
- }),
249
- },
250
- });
251
-
252
- return result.toUIMessageStreamResponse();
253
- }
254
- ```
255
-
256
- </Step>
257
- </Steps>
258
-
259
- ## Tool UI Patterns
260
-
261
- ### Component Pattern
262
-
263
- Create standalone tool UI components:
264
-
265
- ```tsx
266
- import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
267
-
268
- export const WebSearchToolUI: ToolCallMessagePartComponent<
269
- { query: string },
270
- { results: SearchResult[] }
271
- > = ({ args, status, result }) => {
272
- return (
273
- <div className="search-container">
274
- <div className="mb-3 flex items-center gap-2">
275
- <SearchIcon />
276
- <span>Search results for: "{args.query}"</span>
277
- </div>
278
-
279
- {status.type === "running" && <LoadingSpinner />}
280
-
281
- {result && (
282
- <div className="space-y-2">
283
- {result.results.map((item, index) => (
284
- <div key={index} className="rounded border p-3">
285
- <a href={item.url} className="font-medium text-blue-600">
286
- {item.title}
287
- </a>
288
- <p className="text-sm text-gray-600">{item.snippet}</p>
289
- </div>
290
- ))}
291
- </div>
292
- )}
293
- </div>
294
- );
295
- };
296
- ```
297
-
298
- Register it on the toolkit:
299
-
300
- ```tsx
301
- const toolkit = defineToolkit({
302
- webSearch: {
303
- type: "backend",
304
- render: WebSearchToolUI,
305
- },
306
- });
307
- ```
308
-
309
- ### Dynamic Toolkit Pattern
310
-
311
- Use a toolkit hook in its own file when the renderer needs component state:
312
-
313
- ```tsx title="analyze-data-toolkit.tsx"
314
- "use client";
315
-
316
- import { defineToolkit, useInlineRender } from "@assistant-ui/react";
317
- import { useMemo } from "react";
318
-
319
- export function useAnalyzeDataToolkit(theme: "light" | "dark") {
320
- const renderAnalyzeData = useInlineRender(({ result, status }) => {
321
- return (
322
- <DataVisualization
323
- data={result}
324
- theme={theme}
325
- loading={status.type === "running"}
326
- />
327
- );
328
- });
329
-
330
- return useMemo(
331
- () =>
332
- defineToolkit({
333
- analyzeData: {
334
- type: "backend",
335
- render: renderAnalyzeData,
336
- },
337
- }),
338
- [renderAnalyzeData],
339
- );
340
- }
341
- ```
342
-
343
- ```tsx title="DynamicToolUI.tsx"
344
- import { AuiConfig, AuiProvider, Tools, useAui } from "@assistant-ui/react";
345
- import { useState } from "react";
346
- import { useAnalyzeDataToolkit } from "./analyze-data-toolkit";
347
-
348
- function DynamicToolUI({ children }: { children: React.ReactNode }) {
349
- const [theme] = useState<"light" | "dark">("light");
350
- const toolkit = useAnalyzeDataToolkit(theme);
351
- const aui = useAui();
352
- const config = AuiConfig({ tools: Tools({ toolkit }) });
353
-
354
- return (
355
- <AuiProvider extends={aui} config={config}>
356
- {children}
357
- </AuiProvider>
358
- );
359
- }
360
- ```
361
-
362
- ### Inline Pattern
363
-
364
- For tools that need access to parent component props:
365
-
366
- <Callout type="tip">
367
- **Why `useInlineRender`?** By default, a tool UI's `render` function is
368
- static. Use `useInlineRender` when your UI needs access to dynamic component
369
- props (for example, to pass in an `id` or other contextual data).
370
- </Callout>
371
-
372
- ```tsx title="inventory-toolkit.tsx"
373
- "use client";
374
-
375
- import { defineToolkit, useInlineRender } from "@assistant-ui/react";
376
- import { useMemo } from "react";
377
-
378
- export function useInventoryToolkit(productId: string, productName: string) {
379
- const renderInventory = useInlineRender(({ result }) => {
380
- return (
381
- <div className="inventory-status">
382
- <h4>{productName} Inventory</h4>
383
- <p>
384
- Stock for {productId}: {result.quantity} units
385
- </p>
386
- <p>Location: {result.warehouse}</p>
387
- </div>
388
- );
389
- });
390
-
391
- return useMemo(
392
- () =>
393
- defineToolkit({
394
- checkInventory: {
395
- type: "backend",
396
- render: renderInventory,
397
- },
398
- }),
399
- [renderInventory],
400
- );
401
- }
402
- ```
403
-
404
- ```tsx title="ProductPage.tsx"
405
- import { AuiConfig, AuiProvider, Tools, useAui } from "@assistant-ui/react";
406
- import { useInventoryToolkit } from "./inventory-toolkit";
407
-
408
- function ProductPage({ productId, productName }) {
409
- const toolkit = useInventoryToolkit(productId, productName);
410
- const aui = useAui();
411
- const config = AuiConfig({ tools: Tools({ toolkit }) });
412
-
413
- return (
414
- <AuiProvider extends={aui} config={config}>
415
- <div>Product details...</div>
416
- </AuiProvider>
417
- );
418
- }
419
- ```
420
-
421
- ## Interactive Tool UIs
422
-
423
- ### User Input Collection
424
-
425
- Create tools that collect user input during execution:
426
-
427
- <Callout type="tip">
428
- **Pro tip:** Call `addResult(...)` exactly once to complete the tool call.
429
- After it's invoked, the assistant will resume the conversation with your
430
- provided data.
431
- </Callout>
432
-
433
- ```tsx
434
- const toolkit = defineToolkit({
435
- selectDate: {
436
- type: "human",
437
- description: "Ask the user to select a date.",
438
- parameters: z.object({ prompt: z.string() }),
439
- render: ({ args, result, addResult }) => {
440
- if (result) {
441
- return (
442
- <div className="rounded bg-green-50 p-3">
443
- ✅ Selected date: {new Date(result.date).toLocaleDateString()}
444
- </div>
445
- );
446
- }
447
-
448
- return (
449
- <div className="rounded border p-4">
450
- <p className="mb-3">{args.prompt}</p>
451
- <DatePicker
452
- onChange={(date) => {
453
- addResult({ date: date.toISOString() });
454
- }}
455
- />
456
- </div>
457
- );
458
- },
459
- },
460
- });
461
- ```
462
-
463
- ### Multi-Step Interactions
464
-
465
- Build complex workflows with human-in-the-loop patterns for multi-step user interactions:
466
-
467
- ```tsx title="app/approval-toolkit.tsx"
468
- "use generative";
469
-
470
- import { defineToolkit } from "@assistant-ui/react";
471
- import { z } from "zod";
472
-
473
- export default defineToolkit({
474
- requestApproval: {
475
- description: "Request user approval for an action",
476
- parameters: z.object({
477
- action: z.string(),
478
- details: z.any(),
479
- }),
480
- execute: async ({ action, details }, { human }) => {
481
- "use client";
482
- // Request approval from user
483
- const response = await human({ action, details });
484
-
485
- return {
486
- approved: response.approved,
487
- reason: response.reason,
488
- };
489
- },
490
- render: ({ args, result, interrupt, resume }) => {
491
- const [reason, setReason] = useState("");
492
-
493
- // Show result after approval/rejection
494
- if (result) {
495
- return (
496
- <div className={result.approved ? "text-green-600" : "text-red-600"}>
497
- {result.approved ? "✅ Approved" : `❌ Rejected: ${result.reason}`}
498
- </div>
499
- );
500
- }
501
-
502
- // Show approval UI when waiting for user input
503
- if (interrupt) {
504
- return (
505
- <div className="rounded border-2 border-yellow-400 p-4">
506
- <h4 className="font-bold">Approval Required</h4>
507
- <p className="my-2">{interrupt.payload.action}</p>
508
- <pre className="rounded bg-gray-100 p-2 text-sm">
509
- {JSON.stringify(interrupt.payload.details, null, 2)}
510
- </pre>
511
-
512
- <div className="mt-4 flex gap-2">
513
- <button
514
- onClick={() => resume({ approved: true })}
515
- className="rounded bg-green-500 px-4 py-2 text-white"
516
- >
517
- Approve
518
- </button>
519
- <button
520
- onClick={() => resume({ approved: false, reason })}
521
- className="rounded bg-red-500 px-4 py-2 text-white"
522
- >
523
- Reject
524
- </button>
525
- <input
526
- type="text"
527
- placeholder="Rejection reason..."
528
- value={reason}
529
- onChange={(e) => setReason(e.target.value)}
530
- className="flex-1 rounded border px-2"
531
- />
532
- </div>
533
- </div>
534
- );
535
- }
536
-
537
- return <div>Processing...</div>;
538
- },
539
- },
540
- });
541
- ```
542
-
543
- <Callout type="tip">
544
- Use tool human input (`human()` / `resume()`) for workflows that need to
545
- pause tool execution and wait for user input. Use `addResult()` for "human
546
- tools" where the AI requests a tool call but the entire execution happens
547
- through user interaction.
548
- </Callout>
549
-
550
- ### Server-side approval gates
551
-
552
- Some runtimes (notably AI SDK v7's `toolApproval`-gated tools) pause on the server and emit an approval request that the client must acknowledge before the tool runs. assistant-ui surfaces this on the tool part as `approval` and exposes `respondToApproval({ approved, reason? })` on the renderer:
553
-
554
- ```tsx
555
- const toolkit = defineToolkit({
556
- deploy: {
557
- type: "backend",
558
- render: ({ args, approval, respondToApproval, result }) => {
559
- if (approval?.approved === undefined) {
560
- return (
561
- <div>
562
- <p>Approve deploy to {args.target}?</p>
563
- <button onClick={() => respondToApproval({ approved: true })}>
564
- Approve
565
- </button>
566
- <button
567
- onClick={() =>
568
- respondToApproval({ approved: false, reason: "user denied" })
569
- }
570
- >
571
- Deny
572
- </button>
573
- </div>
574
- );
575
- }
576
-
577
- if (approval?.approved === false) {
578
- return <p>Denied{approval.reason ? `: ${approval.reason}` : ""}</p>;
579
- }
580
-
581
- if (result === undefined) return <p>Approved, running…</p>;
582
- return <p>Deployed</p>;
583
- },
584
- },
585
- });
586
- ```
587
-
588
- `approval.approved` is a three-state signal:
589
-
590
- - `undefined`: gate is open, the renderer should ask the user. This is the only state in which `respondToApproval` is legal.
591
- - `true`: decision recorded as allow. The server is producing the result (or has produced one, available on `result`).
592
- - `false`: decision recorded as deny. The runtime records an error result (`isError`) and exposes `approval.reason`.
593
-
594
- `approval.isAutomatic` is `true` when the runtime granted the decision from a server-side policy rather than the user; render a "auto-approved" badge instead of buttons in that case.
595
-
596
- Approval gates require a runtime that implements them: the AI SDK v7 runtime emits them for `toolApproval`-gated tools, and `LocalRuntime` supports gates emitted by your `ChatModelAdapter`; see [LocalRuntime approval gates](/docs/runtimes/custom/local-runtime#approval-gates). For tools where the user supplies the result itself, use `unstable_humanToolNames` with `addResult` instead; see [human-in-the-loop tools](/docs/runtimes/custom/local-runtime#human-in-the-loop-tools).
597
-
598
- For the wire-side setup (`needsApproval`, `sendAutomaticallyWhen`), see [AI SDK v7 server-side tool approval](/docs/runtimes/ai-sdk/v7#server-side-tool-approval).
599
-
600
- ### Approval options
601
-
602
- Beyond the plain allow / deny pair, the host can attach a list of decision options to an approval, for example "allow once", "allow for this session", and "always allow". Each option carries a machine-readable `kind` (`"allow-once"`, `"allow-always"`, `"reject-once"`, `"reject-always"`); scope semantics like session versus global belong to the option's `id` and `label`, which only the host interprets:
603
-
604
- ```ts
605
- const approval = {
606
- id: "a1",
607
- options: [
608
- { id: "once", kind: "allow-once" },
609
- { id: "session", kind: "allow-always", label: "Allow for this session" },
610
- {
611
- id: "always",
612
- kind: "allow-always",
613
- label: "Always allow",
614
- grants: ["git *"],
615
- confirm: true,
616
- },
617
- { id: "deny", kind: "reject-once" },
618
- ],
619
- };
620
- ```
621
-
622
- Renderers respond with the chosen option instead of a boolean; the option's kind resolves the decision:
623
-
624
- ```tsx
625
- respondToApproval({ optionId: "session" });
626
- ```
627
-
628
- The runtime receives `{ approvalId, approved, optionId, reason? }`, so a host that persists "always allow" decisions can key its store off `optionId`. Persistence is entirely host-owned: assistant-ui never stores a decision and never auto-answers future approvals. `grants` lists the patterns an option would persist (shown to the user before they commit), and `confirm` opts the option into a confirmation step. Options with custom `_`-prefixed kinds must be answered with an explicit `approved` value, optionally alongside the `optionId` so the chosen option is still recorded. The default `ToolFallback` bar renders them next to the known kinds and sends `{ optionId, approved: true }` when one is chosen, since picking a declared option is an answer rather than a refusal; it also keeps a Deny control available whenever the request declares no reject-kind option.
629
-
630
- Approvals that end without a decision (a cancelled run or an expired request) are recorded by the host as `approval.resolution: "cancelled" | "expired"`, which closes the gate without recording a deny.
631
-
632
- The default `ToolFallback` component renders supplied options automatically, including the confirmation step.
633
-
634
- ## Advanced Features
635
-
636
- ### Tool Status Handling
637
-
638
- The `status` prop provides detailed execution state:
639
-
640
- ```tsx
641
- render: ({ status, args }) => {
642
- switch (status.type) {
643
- case "running":
644
- return <LoadingState />;
645
-
646
- case "requires-action":
647
- return <UserInputRequired reason={status.reason} />;
648
-
649
- case "incomplete":
650
- if (status.reason === "cancelled") {
651
- return <div>Operation cancelled</div>;
652
- }
653
- if (status.reason === "error") {
654
- return <ErrorDisplay error={status.error} />;
655
- }
656
- return <div>Failed: {status.reason}</div>;
657
-
658
- case "complete":
659
- return <SuccessDisplay />;
660
- }
661
- };
662
- ```
663
-
664
- ### Deferred Rendering
665
-
666
- <Callout type="info">
667
- 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.
668
- </Callout>
669
-
670
- 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.
671
-
672
- #### Inline at the end of streaming
673
-
674
- 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:
675
-
676
- ```tsx
677
- const toolkit = defineToolkit({
678
- renderChart: {
679
- type: "backend",
680
- render: ({ args, status }) => {
681
- if (status.type !== "complete") return null;
682
- return <Chart title={args.title} data={args.series} />;
683
- },
684
- },
685
- });
686
- ```
687
-
688
- The chart mounts once, with the final args, after streaming finishes. No re-renders during the stream.
689
-
690
- The same `render` shape works inside the [`Tools()`](/docs/tools/defining-tools) toolkit's `render` field and with `MessagePrimitive.Parts`'s inline `tools.by_name` overrides.
691
-
692
- #### Below the message body
693
-
694
- 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`:
695
-
696
- ```tsx
697
- import { MessagePrimitive, AuiIf, useAuiState } from "@assistant-ui/react";
698
-
699
- function PostMessageCard() {
700
- const parts = useAuiState((s) => s.message.parts);
701
- const chartCall = parts.find(
702
- (p) => p.type === "tool-call" && p.toolName === "renderChart",
703
- );
704
- if (!chartCall) return null;
705
- return <Chart {...chartCall.args} />;
706
- }
707
-
708
- <MessagePrimitive.Root>
709
- <MessagePrimitive.Parts />
710
-
711
- <AuiIf
712
- condition={(s) =>
713
- s.message.role === "assistant" &&
714
- s.message.status?.type === "complete"
715
- }
716
- >
717
- <PostMessageCard />
718
- </AuiIf>
719
- </MessagePrimitive.Root>;
720
- ```
721
-
722
- 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.
723
-
724
- 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.
725
-
726
- ### Field-Level Streaming State
727
-
728
- 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:
729
-
730
- ```tsx
731
- import { useToolArgsStatus } from "@assistant-ui/react";
732
-
733
- const toolkit = defineToolkit({
734
- submitForm: {
735
- type: "backend",
736
- render: ({ args }) => {
737
- const { propStatus } = useToolArgsStatus<{
738
- email: string;
739
- phone: string;
740
- }>();
741
-
742
- return (
743
- <form className="space-y-4">
744
- <div>
745
- <input
746
- type="email"
747
- value={args.email ?? ""}
748
- className={propStatus.email === "streaming" ? "loading" : ""}
749
- disabled
750
- />
751
- </div>
752
-
753
- <div>
754
- <input
755
- type="tel"
756
- value={args.phone ?? ""}
757
- className={propStatus.phone === "streaming" ? "loading" : ""}
758
- disabled
759
- />
760
- </div>
761
- </form>
762
- );
763
- },
764
- },
765
- });
766
- ```
767
-
768
- ### Partial Results & Streaming
769
-
770
- Display results as they stream in:
771
-
772
- ```tsx
773
- const toolkit = defineToolkit({
774
- analyzeData: {
775
- type: "backend",
776
- render: ({ result, status }) => {
777
- const progress = result?.progress || 0;
778
- const insights = result?.insights || [];
779
-
780
- return (
781
- <div className="analysis-container">
782
- {status.type === "running" && (
783
- <div className="mb-4">
784
- <div className="mb-1 flex justify-between">
785
- <span>Analyzing...</span>
786
- <span>{progress}%</span>
787
- </div>
788
- <div className="w-full rounded bg-gray-200">
789
- <div
790
- className="h-2 rounded bg-blue-500"
791
- style={{ width: `${progress}%` }}
792
- />
793
- </div>
794
- </div>
795
- )}
796
-
797
- <div className="space-y-2">
798
- {insights.map((insight, i) => (
799
- <div key={i} className="rounded bg-gray-50 p-2">
800
- {insight}
801
- </div>
802
- ))}
803
- </div>
804
- </div>
805
- );
806
- },
807
- },
808
- });
809
- ```
810
-
811
- ### Custom Tool Fallback
812
-
813
- 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.
814
-
815
- ## Execution Context
816
-
817
- Generative UI components have access to execution context through props:
818
-
819
- ```tsx
820
- type ToolCallMessagePartProps<TArgs, TResult> = {
821
- // Tool arguments
822
- args: TArgs;
823
- argsText: string; // JSON stringified args
824
-
825
- // Execution status
826
- status: ToolCallMessagePartStatus;
827
- isError?: boolean;
828
-
829
- // Tool result (may be partial during streaming)
830
- result?: TResult;
831
-
832
- // Tool metadata
833
- toolName: string;
834
- toolCallId: string;
835
-
836
- // Interactive callbacks
837
- addResult: (result: TResult | ToolResponse<TResult>) => void;
838
- resume: (payload: unknown) => void;
839
-
840
- // Interrupt state
841
- interrupt?: { type: "human"; payload: unknown }; // Payload from context.human()
842
-
843
- // Optional artifact data
844
- artifact?: unknown;
845
- };
846
- ```
847
-
848
- ### Human Input Handling
849
-
850
- When a tool calls `human()` during execution, the payload becomes available in the render function as `interrupt.payload`:
851
-
852
- ```tsx
853
- const toolkit = defineToolkit({
854
- confirmAction: {
855
- type: "backend",
856
- render: ({ args, result, interrupt, resume }) => {
857
- // Tool is waiting for user input
858
- if (interrupt) {
859
- return (
860
- <div className="confirmation-dialog">
861
- <p>Confirm: {interrupt.payload.message}</p>
862
- <button onClick={() => resume(true)}>Yes</button>
863
- <button onClick={() => resume(false)}>No</button>
864
- </div>
865
- );
866
- }
867
-
868
- // Tool completed
869
- if (result) {
870
- return <div>Action {result.confirmed ? "confirmed" : "cancelled"}</div>;
871
- }
872
-
873
- return <div>Processing...</div>;
874
- },
875
- },
876
- });
877
- ```
878
-
879
- Learn more about tool human input in the [Tools Guide](/docs/tools/defining-tools#human-tools).
880
-
881
- ## Best Practices
882
-
883
- ### 1. Handle All Status States
884
-
885
- Always handle loading, error, and success states:
886
-
887
- ```tsx
888
- render: ({ status, result, args }) => {
889
- if (status.type === "running") return <Skeleton />;
890
- if (status.type === "incomplete") return <ErrorState />;
891
- if (!result) return null;
892
- return <ResultDisplay result={result} />;
893
- };
894
- ```
895
-
896
- ### 2. Provide Visual Feedback
897
-
898
- Use animations and transitions for better UX:
899
-
900
- ```tsx
901
- <div
902
- className={cn(
903
- "transition-all duration-300",
904
- status.type === "running" && "opacity-50",
905
- status.type === "complete" && "opacity-100",
906
- )}
907
- >
908
- {/* Tool UI content */}
909
- </div>
910
- ```
911
-
912
- ### 3. Make UIs Accessible
913
-
914
- Ensure keyboard navigation and screen reader support:
915
-
916
- ```tsx
917
- <button
918
- onClick={() => addResult(value)}
919
- aria-label="Confirm selection"
920
- className="focus:outline-none focus:ring-2"
921
- >
922
- Confirm
923
- </button>
924
- ```
925
-
926
- ### 4. Optimize Performance
927
-
928
- Use `useInlineRender` to prevent unnecessary re-renders:
929
-
930
- ```tsx title="heavy-computation-toolkit.tsx"
931
- "use client";
932
-
933
- import { defineToolkit, useInlineRender } from "@assistant-ui/react";
934
- import { useMemo } from "react";
935
-
936
- export function useHeavyComputationToolkit() {
937
- const renderHeavyComputation = useInlineRender(({ result }) => {
938
- return <ComplexVisualization data={result} />;
939
- });
940
-
941
- return useMemo(
942
- () =>
943
- defineToolkit({
944
- heavyComputation: {
945
- type: "backend",
946
- render: renderHeavyComputation,
947
- },
948
- }),
949
- [renderHeavyComputation],
950
- );
951
- }
952
- ```
953
-
954
- ```tsx title="HeavyComputationToolProvider.tsx"
955
- import { AuiConfig, AuiProvider, Tools, useAui } from "@assistant-ui/react";
956
- import type { ReactNode } from "react";
957
- import { useHeavyComputationToolkit } from "./heavy-computation-toolkit";
958
-
959
- function HeavyComputationToolProvider({ children }: { children: ReactNode }) {
960
- const toolkit = useHeavyComputationToolkit();
961
- const aui = useAui();
962
- const config = AuiConfig({ tools: Tools({ toolkit }) });
963
-
964
- return (
965
- <AuiProvider extends={aui} config={config}>
966
- {children}
967
- </AuiProvider>
968
- );
969
- }
970
- ```
971
-
972
- <Callout>
973
- Generative UI components are only displayed in the chat interface. The actual
974
- tool execution happens on the backend. This separation allows you to create
975
- rich, interactive experiences while keeping sensitive logic secure on the
976
- server.
977
- </Callout>
978
-
979
- ## Data-Part Generative UI
980
-
981
- 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.
982
-
983
- **When to choose which:**
984
-
985
- - **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/tools/defining-tools) toolkit's `render` field. 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.
986
- - **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.
987
-
988
- 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.
989
-
990
- Use `makeAssistantDataUI` to register a renderer for a named data part:
991
-
992
- ```tsx
993
- import { makeAssistantDataUI } from "@assistant-ui/react";
994
-
995
- type ChartProps = { series: number[]; title: string };
996
-
997
- export const ChartUI = makeAssistantDataUI<ChartProps>({
998
- name: "chart",
999
- render: ({ data }) => (
1000
- <div>
1001
- <h3>{data.title}</h3>
1002
- <Chart series={data.series} />
1003
- </div>
1004
- ),
1005
- });
1006
- ```
1007
-
1008
- Mount `<ChartUI />` once inside the `AssistantRuntimeProvider` tree; it renders nothing itself and only registers the renderer.
1009
-
1010
- 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).
1011
-
1012
- A fallback renderer for unmatched data parts is available internally but `setFallbackDataUI` is not yet a public API.
1013
-
1014
- ## Related Guides
1015
-
1016
- - [Tools Guide](/docs/tools/defining-tools) - Learn how to create and use tools with AI models
1017
- - [Multi-Agent](/docs/tools/multi-agent) - Render sub-agent conversations inside tool call UIs
1018
- - [Tool Fallback](/docs/ui/tool-fallback) - Default UI for tools without custom components
1019
- - [API Reference](/docs/api-reference/primitives/message-part) - Detailed type definitions and component APIs
1020
- - [Message Primitive](/docs/api-reference/primitives/message) - Complete Message component documentation