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

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 +76 -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 +250 -0
  13. package/src/proxy.ts +111 -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,574 +0,0 @@
1
- ---
2
- title: Defining Tools
3
- description: Define tools for your AI chat with assistant-ui toolkits and the "use generative" directive — frontend, backend, human, and provider tools with type safety and streaming.
4
- platforms: ["react"]
5
- ---
6
-
7
- Tools let the model take actions: fetch data, call an API, query a database, drive your UI, or run a workflow. In assistant-ui you declare tools in a **toolkit** — a named map where each key is the tool name the model sees and each value describes the tool's schema, where it runs, and how its call renders.
8
-
9
- This page covers how to **author** tools. To render a tool call as a custom component, see [Tool UI](/docs/tools/tool-ui). To wire tools into your server, see [Backend tools](/docs/tools/backend).
10
-
11
- ## Define tools with `"use generative"`
12
-
13
- Use `"use generative"` + `defineToolkit` for toolkits. The compiler co-locates
14
- the schema, executor, and renderer in one file and splits them across the
15
- client/server boundary for you.
16
-
17
- <Callout type="info">
18
- You can still use the generative toolkit pattern when a tool executes
19
- elsewhere:
20
-
21
- - for MCP servers, spread `defineMcpToolkit({ ... })`;
22
- - for non-MCP tools defined by another backend or runtime, write
23
- `execute: externalTool()` and provide a renderer.
24
- </Callout>
25
-
26
- In a `"use generative"` file every tool declares an `execute`, and you never
27
- write `type` yourself — the compiler infers it. For render-only external tools,
28
- `externalTool()` is the escape hatch that satisfies the compiler without
29
- emitting schema or executable code on the server.
30
-
31
- ## Quick start (`"use generative"`)
32
-
33
- A `"use generative"` file is a single module that holds a tool's schema, its executor, and its renderer together. A build plugin splits it into a server build (schema + backend executors) and a client build (schema + renderers + browser executors), so a backend `execute` never reaches the browser and a `render` never reaches your server.
34
-
35
- <Steps>
36
- <Step>
37
-
38
- ### Add the build plugin
39
-
40
- The directive does nothing without a compiler. Wrap your Next.js config with `withAui`:
41
-
42
- ```ts title="next.config.ts"
43
- import { withAui } from "@assistant-ui/next";
44
-
45
- export default withAui({
46
- /* ...your Next config... */
47
- });
48
- ```
49
-
50
- For Vite / TanStack Start, add the `aui()` plugin instead:
51
-
52
- ```ts title="vite.config.ts"
53
- import { aui } from "@assistant-ui/vite";
54
-
55
- export default defineConfig({
56
- plugins: [aui()],
57
- });
58
- ```
59
-
60
- For Expo, wrap your Metro config with `withAui`:
61
-
62
- ```js title="metro.config.js"
63
- const { getDefaultConfig } = require("expo/metro-config");
64
- const { withAui } = require("@assistant-ui/metro");
65
-
66
- module.exports = withAui(getDefaultConfig(__dirname));
67
- ```
68
-
69
- For a bare React Native app, import `getDefaultConfig` from `@react-native/metro-config` instead of `expo/metro-config`.
70
-
71
- </Step>
72
- <Step>
73
-
74
- ### Write the toolkit
75
-
76
- The file's first line is `"use generative"`, and its default export is `defineToolkit({ ... })`. Each tool is an inline object literal with a `parameters` schema, an `execute`, and a `render` (or `renderText`):
77
-
78
- ```tsx title="app/toolkit.tsx"
79
- "use generative";
80
-
81
- import { defineToolkit } from "@assistant-ui/react";
82
- import { z } from "zod";
83
-
84
- export default defineToolkit({
85
- get_weather: {
86
- description: "Get current weather for a location.",
87
- parameters: z.object({
88
- location: z.string().describe("City name or zip code"),
89
- unit: z.enum(["celsius", "fahrenheit"]).default("celsius"),
90
- }),
91
- execute: async ({ location, unit }) => {
92
- "use client";
93
- return fetchWeatherAPI(location, unit);
94
- },
95
- render: ({ args, result }) => {
96
- if (!result) return <div>Fetching weather for {args.location}…</div>;
97
- return (
98
- <div className="weather-card">
99
- <h3>{args.location}</h3>
100
- <p>
101
- {result.temperature}° {args.unit}
102
- </p>
103
- <p>{result.conditions}</p>
104
- </div>
105
- );
106
- },
107
- },
108
- });
109
- ```
110
-
111
- The inner `"use client"` inside `execute` marks this as a **frontend** tool — its executor runs in the browser. (Omit it to run on the server; see [Tool kinds](#tool-kinds).)
112
-
113
- </Step>
114
- <Step>
115
-
116
- ### Register the toolkit
117
-
118
- Import the toolkit in your runtime provider and pass it to `config` via `Tools`:
119
-
120
- ```tsx title="app/MyRuntimeProvider.tsx"
121
- "use client";
122
-
123
- import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
124
- import { useChatRuntime } from "@assistant-ui/ai-sdk";
125
- import toolkit from "./toolkit";
126
-
127
- export function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
128
- const runtime = useChatRuntime();
129
- const config = AuiConfig({ tools: Tools({ toolkit }) });
130
- return (
131
- <AssistantRuntimeProvider
132
- runtime={runtime}
133
- config={config}
134
- >
135
- {children}
136
- </AssistantRuntimeProvider>
137
- );
138
- }
139
- ```
140
-
141
- `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).
142
-
143
- </Step>
144
- <Step>
145
-
146
- ### Expose the toolkit to the model on your server
147
-
148
- The same import resolves to the **server build** inside a route handler. Wrap it in an `AISDKToolkit` so the model is configured with every tool's schema:
149
-
150
- ```ts title="app/api/chat/route.ts"
151
- import { AISDKToolkit } from "@assistant-ui/ai-sdk";
152
- import { streamText, convertToModelMessages } from "ai";
153
- import { openai } from "@ai-sdk/openai";
154
- import toolkit from "../../toolkit";
155
-
156
- const aiToolkit = new AISDKToolkit({ toolkit });
157
-
158
- export async function POST(req: Request) {
159
- const { messages, tools } = await req.json();
160
-
161
- const result = streamText({
162
- model: openai("gpt-5.6-luna"),
163
- messages: await convertToModelMessages(messages),
164
- tools: await aiToolkit.tools({ frontend: tools }),
165
- });
166
-
167
- return result.toUIMessageStreamResponse();
168
- }
169
- ```
170
-
171
- See [Backend tools](/docs/tools/backend) for the full server setup.
172
-
173
- </Step>
174
- </Steps>
175
-
176
- ## How the compiler splits a generative file
177
-
178
- You author one file; the plugin forks it per build target. The schema (`description` + `parameters`) is kept on **both** builds, so the model contract is identical and authoritative on the backend. The client marks its frontend/human schemas as backend-known and skips re-uploading them.
179
-
180
- The tool's **kind is inferred from its `execute`** and written back as a `type` field — you never author `type` in a `"use generative"` file:
181
-
182
- | `execute` you write | Inferred kind | Server build keeps | Client build keeps |
183
- | --- | --- | --- | --- |
184
- | plain `async () => …` | **backend** | schema + `execute` (guarded `server-only`) | schema + `render` |
185
- | `async () => { "use client"; … }` | **frontend** | schema only | schema + `execute` + `render`/`renderText` |
186
- | `humanTool()` | **human** | schema only | schema + `render` |
187
- | `stubTool()` | **frontend** (executor supplied at runtime) | schema only | schema + `render`/`renderText` |
188
- | `providerTool({ … })` | **provider** | schema + provider config | schema + provider config |
189
- | `externalTool()` | **backend** (defined elsewhere) | omitted | `type: "backend"` + `render`/`renderText` |
190
-
191
- The compiler also enforces, at build time:
192
-
193
- - every tool declares an `execute`;
194
- - a **frontend** tool declares a `render` or `renderText`;
195
- - a **human** tool declares a `render`.
196
-
197
- ### Running without your own backend
198
-
199
- The client build skips uploading frontend/human schemas because it assumes your backend imported the same file's server build and already knows them. When no server of yours does — for example, cloud-hosted runs — that assumption breaks and the model never learns about those tools. Compile with the `backendless` option so the client keeps every schema uploadable, including the `present`/`prompt_user` schema of a `JSONGenerativeUI` component library:
200
-
201
- ```ts title="next.config.ts"
202
- export default withAui({ ...yourConfig, aui: { backendless: true } });
203
- ```
204
-
205
- ```ts title="vite.config.ts"
206
- plugins: [aui({ backendless: true })];
207
- ```
208
-
209
- ```js title="metro.config.js"
210
- module.exports = withAui({
211
- ...getDefaultConfig(__dirname),
212
- aui: { backendless: true },
213
- });
214
- ```
215
-
216
- ## Tool kinds
217
-
218
- ### Backend tools
219
-
220
- Run on your server. Author a plain `execute` (no `"use client"`); the compiler moves it to the server build behind `import "server-only"` and keeps only the schema and `render` on the client. A backend tool can still carry a `render` to show its call as a trace:
221
-
222
- ```tsx
223
- geocode_location: {
224
- description: "Geocode a location name into latitude/longitude.",
225
- parameters: z.object({ query: z.string() }),
226
- execute: async ({ query }) => geocodeLocation(query),
227
- render: GeocodeToolUI,
228
- },
229
- ```
230
-
231
- <Callout type="tip">
232
- A backend tool authored this way **has** an `execute`. To attach a renderer to
233
- a tool whose execution lives entirely elsewhere (an MCP server, a different
234
- backend route) — where there is no real executor to write — use
235
- `externalTool()` or `defineMcpToolkit()`.
236
- </Callout>
237
-
238
- ### Frontend tools
239
-
240
- Run in the browser. Author a real `execute` with a leading `"use client"`:
241
-
242
- ```tsx
243
- copy_to_clipboard: {
244
- description: "Copy text to the user's clipboard.",
245
- parameters: z.object({ text: z.string() }),
246
- execute: async ({ text }) => {
247
- "use client";
248
- await navigator.clipboard.writeText(text);
249
- return { copied: true };
250
- },
251
- renderText: {
252
- running: "Copying text…",
253
- complete: "Copied text to clipboard",
254
- },
255
- },
256
- ```
257
-
258
- ### Human tools
259
-
260
- Pause the run until the user supplies a result through the rendered UI. Author `execute: humanTool()` and a `render` that calls `addResult` exactly once:
261
-
262
- ```tsx
263
- select_date: {
264
- description: "Ask the user to select a date.",
265
- parameters: z.object({ prompt: z.string() }),
266
- execute: humanTool(),
267
- render: ({ args, result, addResult }) => {
268
- if (result) return <p>Selected {result.date}</p>;
269
- return (
270
- <DatePicker
271
- prompt={args.prompt}
272
- onChange={(date) => addResult({ date })}
273
- />
274
- );
275
- },
276
- },
277
- ```
278
-
279
- `humanTool` is imported from `@assistant-ui/react`. See [Tool UI → Human-in-the-loop](/docs/tools/tool-ui#user-input-collection) for the full pattern.
280
-
281
- ### Provider tools
282
-
283
- Executed by the model provider (e.g. OpenAI web search). Author `execute: providerTool({ … })`; the compiler lifts the config onto the tool entry:
284
-
285
- ```tsx
286
- web_search: {
287
- execute: providerTool({
288
- providerId: "openai.web_search_preview",
289
- args: { searchContextSize: "low" },
290
- }),
291
- },
292
- ```
293
-
294
- ### Externally defined tools
295
-
296
- Use `externalTool()` when a non-MCP tool is already defined and executed by
297
- another system (for example a separate backend route or LangGraph node), but you
298
- want assistant-ui to render its tool calls. Import `externalTool` from
299
- `@assistant-ui/react`:
300
-
301
- ```tsx
302
- web_search: {
303
- parameters: z.object({ query: z.string() }),
304
- execute: externalTool(),
305
- render: ({ args, result }) => (
306
- <SearchResults query={args.query} results={result?.results ?? []} />
307
- ),
308
- },
309
- ```
310
-
311
- The compiler omits this entry from the server build, so the model still gets
312
- the tool definition from the external system. The client build keeps only
313
- `type: "backend"` and the renderer (or `renderText`) for matching tool-call
314
- message parts.
315
-
316
- ### Tool stubs (supply the executor elsewhere)
317
-
318
- Sometimes a tool's executor can't live in the build-split `"use generative"` file, usually because it has to close over React state (a `useState` setter, a ref). Declare the model-facing contract with `execute: stubTool()`, then supply the real executor at runtime with `useAuiToolOverrides` from the component that owns the state:
319
-
320
- ```tsx title="app/toolkit.tsx"
321
- "use generative";
322
-
323
- import { defineToolkit, stubTool } from "@assistant-ui/react";
324
- import { manageTasksParameters } from "./state";
325
-
326
- export default defineToolkit({
327
- manage_tasks: {
328
- description: "Add, toggle, or clear tasks on the board.",
329
- parameters: manageTasksParameters,
330
- execute: stubTool(),
331
- renderText: { running: "Updating tasks…", complete: "Tasks updated" },
332
- },
333
- });
334
- ```
335
-
336
- ```tsx title="app/TaskBoard.tsx"
337
- import { useAuiToolOverrides } from "@assistant-ui/react";
338
-
339
- function TaskBoardToolOverrides({ setTasks }) {
340
- useAuiToolOverrides({
341
- manage_tasks: {
342
- execute: async ({ action, title }) => {
343
- // close over setTasks here, then return a payload for the model
344
- },
345
- },
346
- });
347
- return null;
348
- }
349
- ```
350
-
351
- `stubTool()` has no runtime implementation: it marks the executor as supplied later, while the compiler still ships the schema to the backend so the model can call the tool. The override registers above the toolkit default, so its `execute` wins for that name. To turn a tool off at runtime instead, see [Disabling a tool](#disabling-a-tool). See [Dynamic tools](/docs/tools/dynamic-tools) for the full walkthrough.
352
-
353
- <Callout type="warn">
354
- `useAuiToolOverrides` is experimental and its API may change.
355
- </Callout>
356
-
357
- ## Rendering a tool call
358
-
359
- `render` receives the live `args`, `result`, and `status` of the call and returns a React node. For a one-line status instead of a component, use `renderText` with a `running` and/or `complete` value (each a string or an `({ args, result }) => …` function):
360
-
361
- ```tsx
362
- renderText: {
363
- running: ({ args }) => `Searching for ${args.query}…`,
364
- complete: "Search complete",
365
- },
366
- ```
367
-
368
- If you don't provide a renderer, add the [`ToolFallback`](/docs/ui/tool-fallback) component to render a default tool card. The full rendering API — status states, streaming args, deferred rendering, approvals — is covered in [Tool UI](/docs/tools/tool-ui).
369
-
370
- ## Render-only tools (for externally-executed tools)
371
-
372
- Prefer `"use generative"` with `externalTool()` for non-MCP tools, or
373
- `defineMcpToolkit()` for MCP servers. If a file cannot go through the generative
374
- compiler, declare a `"use client"` toolkit object with an explicit
375
- `type: "backend"` and only a `render`:
376
-
377
- ```tsx title="app/tool-ui.tsx"
378
- "use client";
379
-
380
- import { defineToolkit } from "@assistant-ui/react";
381
-
382
- export const toolkit = defineToolkit({
383
- web_search: {
384
- type: "backend",
385
- render: ({ args, result }) => (
386
- <SearchResults query={args.query} results={result?.results ?? []} />
387
- ),
388
- },
389
- });
390
- ```
391
-
392
- Register it exactly like a generative toolkit: hoist `const config = AuiConfig({ tools: Tools({ toolkit }) })` in the component body and pass `config={config}`. The key must match the tool name your backend or MCP server publishes. Render-only entries upload no schema and run no browser code — they only attach UI to matching tool-call message parts.
393
-
394
- <Callout type="warn">
395
- This `{ type: "backend", render }` shape is **plain-toolkit only**. Inside a
396
- `"use generative"` file, use `execute: externalTool()` instead; generative
397
- tools must declare an `execute`, and you never author `type` there.
398
- </Callout>
399
-
400
- ## Organizing toolkits
401
-
402
- ### Keep schemas in a separate module
403
-
404
- Importing your Zod schemas (and the `z.infer` arg types) from a plain `.ts` file keeps them out of the compiled boundary and lets your route handler and components share the same types:
405
-
406
- ```ts title="app/tools/schemas.ts"
407
- import { z } from "zod";
408
-
409
- export const getWeatherParameters = z.object({ location: z.string() });
410
- export type GetWeatherArgs = z.infer<typeof getWeatherParameters>;
411
- ```
412
-
413
- ### Split tools across files and merge them
414
-
415
- Each file you split into is its own `"use generative"` module that default-exports a `defineToolkit(...)`:
416
-
417
- ```tsx title="app/tools/weather.tsx"
418
- "use generative";
419
-
420
- import { defineToolkit } from "@assistant-ui/react";
421
-
422
- export default defineToolkit({
423
- get_weather: {
424
- /* description, parameters, execute, render */
425
- },
426
- });
427
- ```
428
-
429
- Merge them by spreading their default imports into a parent toolkit:
430
-
431
- ```tsx title="app/toolkit.tsx"
432
- "use generative";
433
-
434
- import { defineToolkit } from "@assistant-ui/react";
435
- import weatherTools from "./tools/weather";
436
- import databaseTools from "./tools/database";
437
-
438
- export default defineToolkit({
439
- ...weatherTools,
440
- ...databaseTools,
441
- });
442
- ```
443
-
444
- The compiler splits each file across the client/server boundary on its own, then checks that the spread import resolves to a `"use generative"` module before allowing it, so a backend `execute` can't leak to the client. Two rules follow:
445
-
446
- - **Spread a default import** (`import weatherTools from "./tools/weather"`). Relative paths and `tsconfig` path aliases like `@/tools/weather` both resolve. Only the default export crosses the generative-module boundary, so a named import (or any opaque, non-generative import) is rejected.
447
- - You can also spread a local `defineToolkit(...)` or `defineMcpToolkit(...)` binding declared in the same file.
448
-
449
- The compiler checks static tool names across inline entries and compiler-visible
450
- spreads. If two fragments define the same tool name, the build warns that
451
- JavaScript object spread will keep the later tool definition.
452
-
453
- If the compiler reports that `tool "weather" cannot be makeTool()`, that entry
454
- came from an opaque factory call. Rewrite it as an inline tool object, or spread
455
- a compiler-visible `defineToolkit(...)` / `defineMcpToolkit(...)` fragment
456
- instead.
457
-
458
- ### Add MCP server tools
459
-
460
- `defineMcpToolkit` exposes tools from an MCP server. For an MCP-only toolkit, export it directly:
461
-
462
- ```tsx title="app/mcp-toolkit.tsx"
463
- "use generative";
464
-
465
- import { defineMcpToolkit } from "@assistant-ui/react";
466
-
467
- export default defineMcpToolkit({
468
- docs: { type: "http", url: "https://mcp.example.com/mcp" },
469
- });
470
- ```
471
-
472
- To expose MCP tools alongside your own, spread it into a `defineToolkit`:
473
-
474
- ```tsx
475
- "use generative";
476
-
477
- import { defineToolkit, defineMcpToolkit } from "@assistant-ui/react";
478
-
479
- export default defineToolkit({
480
- ...defineMcpToolkit({
481
- docs: { type: "http", url: "https://mcp.example.com/mcp" },
482
- }),
483
- // ...your own tools
484
- });
485
- ```
486
-
487
- When two MCP servers expose the same tool name, use `{ server, prefix }` on an
488
- entry so the model sees distinct names such as `docs_search` and
489
- `github_search`.
490
-
491
- See [MCP](/docs/tools/mcp) for the full server-side and user-managed MCP flows.
492
-
493
- ## Advanced
494
-
495
- ### Multi-modal tool results
496
-
497
- By default a tool's `execute` result is sent to the model as a JSON blob. When the useful output is a file or image, add `toModelOutput` to project the result into the multi-modal content the model sees — your `render` still receives the rich, typed `result`:
498
-
499
- ```tsx
500
- read_pdf: {
501
- description: "Fetch a PDF from a URL and return it.",
502
- parameters: z.object({ url: z.string().url() }),
503
- execute: async ({ url }) => {
504
- const buf = new Uint8Array(await (await fetch(url)).arrayBuffer());
505
- return { mediaType: "application/pdf", base64: toBase64(buf) };
506
- },
507
- toModelOutput: ({ output }) => [
508
- { type: "text", text: "PDF contents:" },
509
- { type: "file", data: output.base64, mediaType: output.mediaType },
510
- ],
511
- },
512
- ```
513
-
514
- `ToolModelContentPart` is a union of `{ type: "text"; text }` and `{ type: "file"; data; mediaType; filename? }`. With the AI SDK runtime, also pass the tool registry to `convertToModelMessages` so `toModelOutput` fires on round-tripped results — see [Backend tools](/docs/tools/backend#multi-modal-results).
515
-
516
- ### Per-tool provider options
517
-
518
- Every tool accepts a `providerOptions` field. assistant-ui serializes it verbatim under the tool entry; the AI SDK route forwards it; the provider SDK reads the keys it cares about. This is how you opt into provider-specific behaviors (such as Anthropic's progressive tool disclosure) without provider-aware code:
519
-
520
- ```tsx
521
- search_docs: {
522
- description: "Search the documentation index.",
523
- parameters: z.object({ query: z.string() }),
524
- providerOptions: { anthropic: { deferLoading: true } },
525
- execute: async ({ query }) => {
526
- "use client";
527
- return searchIndex(query);
528
- },
529
- renderText: { running: "Searching…", complete: "Done" },
530
- },
531
- ```
532
-
533
- The outer key is the provider name; the inner object is whatever that provider's AI SDK package expects under `tool.providerOptions[provider]`.
534
-
535
- ### Cancellation
536
-
537
- `execute` receives a context object whose `abortSignal` fires when the user stops the run. Pass it to any async I/O so the work stops immediately:
538
-
539
- ```tsx
540
- execute: async ({ query }, { abortSignal }) => {
541
- "use client";
542
- const res = await fetch(`/api/search?q=${query}`, { signal: abortSignal });
543
- return res.json();
544
- },
545
- ```
546
-
547
- The context also carries `toolCallId` and a `human()` function for requesting input mid-execution.
548
-
549
- ### Streaming arguments
550
-
551
- While a tool runs, its arguments arrive as partial JSON. Use [`useToolArgsStatus`](/docs/tools/tool-ui#field-level-streaming-state) inside a renderer to react to each field as it streams in.
552
-
553
- ### Disabling a tool
554
-
555
- Set `disabled: true` to keep a tool known to the client but hidden from the model in the current scope.
556
-
557
- To toggle a tool off at runtime without editing the toolkit, register the same flag through `useAuiToolOverrides`:
558
-
559
- ```tsx
560
- import { useAuiToolOverrides } from "@assistant-ui/react";
561
-
562
- function GuestModeTools() {
563
- useAuiToolOverrides({
564
- delete_account: { disabled: true },
565
- });
566
- return null;
567
- }
568
- ```
569
-
570
- The override registers above the toolkit default, so the tool drops out of the set sent to the model. Mount the override only while the tool should be hidden (for example, for signed-out users); unmounting it restores the toolkit default.
571
-
572
- ## Migrating from the component APIs
573
-
574
- `makeAssistantTool`, `useAssistantTool`, `makeAssistantToolUI`, and `useAssistantToolUI` are deprecated. See [Migrating Tools to Toolkits](/docs/migrations/toolkit-tools) for the mechanical migration.
@@ -1,112 +0,0 @@
1
- ---
2
- title: Dynamic Tools
3
- description: Tools whose executor closes over React state — declare the contract with stubTool() in a "use generative" file and supply the executor with useAuiToolOverrides.
4
- platforms: ["react"]
5
- ---
6
-
7
- Most tools are static: their executor is fixed at build time. But some tools need to read or write **component state** — adding to a list the user can also edit, mutating a canvas, pre-filling a form. The executor for those has to close over a React setter, which can't live in a build-split `"use generative"` file.
8
-
9
- The pattern: declare the model-facing **contract** in the toolkit with `execute: stubTool()`, and supply the **real executor** at runtime in the component that owns the state with `useAuiToolOverrides`.
10
-
11
- <Callout type="warn">
12
- `useAuiToolOverrides` is experimental and its API may change.
13
- </Callout>
14
-
15
- ## 1. Declare the contract with `stubTool()`
16
-
17
- In your `"use generative"` file, give the tool its description, parameters, and renderer, and mark the executor as a stub. The compiler ships the schema to the backend and strips the stub — the model can call the tool, but nothing executes until the component supplies the real implementation. Keeping schemas in a separate non-directive module lets the component import the arg types too:
18
-
19
- ```tsx title="app/task-board-toolkit.tsx"
20
- "use generative";
21
-
22
- import { defineToolkit, stubTool } from "@assistant-ui/react";
23
- import { manageTasksParameters } from "./state";
24
-
25
- export default defineToolkit({
26
- manage_tasks: {
27
- description:
28
- 'Manage tasks on the board. Actions: "add" (requires title), ' +
29
- '"toggle" (requires id), "remove" (requires id), "clear".',
30
- parameters: manageTasksParameters,
31
- execute: stubTool(),
32
- renderText: {
33
- running: ({ args }) => `Updating tasks: ${args.action}`,
34
- complete: "Tasks updated",
35
- },
36
- },
37
- });
38
- ```
39
-
40
- ## 2. Supply the executor with `useAuiToolOverrides`
41
-
42
- The component that owns the state registers the toolkit, then renders a small null-returning child that provides the executor closing over its `setState`:
43
-
44
- ```tsx title="app/TaskBoard.tsx"
45
- import {
46
- AuiConfig,
47
- AuiProvider,
48
- Tools,
49
- useAui,
50
- useAuiToolOverrides,
51
- } from "@assistant-ui/react";
52
- import { useState, type Dispatch, type SetStateAction } from "react";
53
- import type { Task } from "./state";
54
- import toolkit from "./task-board-toolkit";
55
-
56
- function TaskBoard() {
57
- const [tasks, setTasks] = useState<Task[]>([]);
58
- const aui = useAui();
59
- const config = AuiConfig({ tools: Tools({ toolkit }) });
60
- return (
61
- <AuiProvider extends={aui} config={config}>
62
- <TaskBoardToolOverrides setTasks={setTasks} />
63
- <TaskList tasks={tasks} />
64
- </AuiProvider>
65
- );
66
- }
67
-
68
- function TaskBoardToolOverrides({
69
- setTasks,
70
- }: {
71
- setTasks: Dispatch<SetStateAction<Task[]>>;
72
- }) {
73
- useAuiToolOverrides({
74
- manage_tasks: {
75
- execute: async ({ action, id, title }) => {
76
- switch (action) {
77
- case "add":
78
- setTasks((prev) => [
79
- ...prev,
80
- { id: crypto.randomUUID(), title: title ?? "Untitled", done: false },
81
- ]);
82
- return { success: true };
83
- case "toggle":
84
- setTasks((prev) =>
85
- prev.map((t) => (t.id === id ? { ...t, done: !t.done } : t)),
86
- );
87
- return { success: true };
88
- case "clear":
89
- setTasks([]);
90
- return { success: true };
91
- default:
92
- return { success: false, error: "Unknown action" };
93
- }
94
- },
95
- },
96
- });
97
- return null;
98
- }
99
- ```
100
-
101
- The override supplies **only** the `execute`; the description, parameters, and `renderText` stay in the toolkit file. An override registers above toolkit defaults, so it wins for that tool name — return a useful payload (e.g. a new item's `id`) and the model picks it up on the next turn.
102
-
103
- <Callout type="info">
104
- Keep the override keys stable after mount, and let only one mounted provider
105
- define a given tool name at a time. The null-returning overrides component
106
- re-binds the executor whenever the setter changes, without remounting the
107
- provider.
108
- </Callout>
109
-
110
- ## When to reach for this vs. Interactables
111
-
112
- If you mainly want the model to update a piece of component state with a partial-update tool generated for you, [Interactables](/docs/tools/interactables) does that out of the box — no `stubTool` needed. Use dynamic tools when you want full control over the tool's name, schema, executor logic, and return value. The two compose: the [with-interactables example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-interactables) uses both side by side.