@assistant-ui/mcp-docs-server 0.1.33 → 0.1.35

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 (102) hide show
  1. package/.docs/organized/code-examples/waterfall.md +7 -7
  2. package/.docs/organized/code-examples/with-a2a.md +8 -8
  3. package/.docs/organized/code-examples/with-ag-ui.md +12 -12
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
  5. package/.docs/organized/code-examples/with-artifacts.md +40 -34
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
  7. package/.docs/organized/code-examples/with-browser-extension.md +9 -9
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +72 -51
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +10 -10
  10. package/.docs/organized/code-examples/with-cloud.md +10 -10
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +10 -10
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -12
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -12
  14. package/.docs/organized/code-examples/with-expo.md +66 -31
  15. package/.docs/organized/code-examples/with-external-store.md +8 -8
  16. package/.docs/organized/code-examples/with-ffmpeg.md +13 -13
  17. package/.docs/organized/code-examples/with-generative-ui.md +98 -368
  18. package/.docs/organized/code-examples/with-google-adk.md +9 -9
  19. package/.docs/organized/code-examples/with-heat-graph.md +7 -7
  20. package/.docs/organized/code-examples/with-image-generation.md +10 -10
  21. package/.docs/organized/code-examples/with-interactables.md +10 -10
  22. package/.docs/organized/code-examples/with-langchain.md +10 -10
  23. package/.docs/organized/code-examples/with-langgraph.md +33 -29
  24. package/.docs/organized/code-examples/with-livekit.md +12 -12
  25. package/.docs/organized/code-examples/with-mcp.md +11 -11
  26. package/.docs/organized/code-examples/with-opencode.md +109 -583
  27. package/.docs/organized/code-examples/with-pi.md +2044 -0
  28. package/.docs/organized/code-examples/with-react-hook-form.md +11 -11
  29. package/.docs/organized/code-examples/with-react-ink-web.md +691 -0
  30. package/.docs/organized/code-examples/with-react-ink.md +309 -102
  31. package/.docs/organized/code-examples/with-react-router.md +14 -14
  32. package/.docs/organized/code-examples/with-resumable-stream.md +11 -11
  33. package/.docs/organized/code-examples/with-store.md +70 -66
  34. package/.docs/organized/code-examples/with-tanstack.md +25 -11
  35. package/.docs/organized/code-examples/with-tap-runtime.md +8 -8
  36. package/.docs/organized/code-examples/with-virtualized-thread.md +656 -0
  37. package/.docs/raw/docs/(docs)/architecture.mdx +65 -53
  38. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +1 -1
  39. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +3 -0
  40. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +44 -1
  41. package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +14 -3
  42. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -1
  43. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +2 -23
  44. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +22 -0
  45. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +93 -9
  46. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +21 -86
  47. package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
  48. package/.docs/raw/docs/guides/index.mdx +3 -0
  49. package/.docs/raw/docs/guides/input-history.mdx +55 -0
  50. package/.docs/raw/docs/guides/virtualization.mdx +63 -0
  51. package/.docs/raw/docs/ink/adapters.mdx +23 -1
  52. package/.docs/raw/docs/ink/hooks.mdx +22 -19
  53. package/.docs/raw/docs/migrations/toolkit-tools.mdx +14 -8
  54. package/.docs/raw/docs/react-native/hooks.mdx +26 -18
  55. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +39 -0
  56. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +3 -3
  57. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +46 -4
  58. package/.docs/raw/docs/runtimes/concepts/stability.mdx +1 -1
  59. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +54 -12
  60. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +1 -1
  61. package/.docs/raw/docs/runtimes/custom/external-store.mdx +62 -4
  62. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +120 -4
  63. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -9
  64. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +13 -0
  65. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +5 -5
  66. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +3 -3
  67. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +6 -6
  68. package/.docs/raw/docs/tools/backend.mdx +19 -11
  69. package/.docs/raw/docs/tools/defining-tools.mdx +177 -52
  70. package/.docs/raw/docs/tools/index.mdx +7 -12
  71. package/.docs/raw/docs/tools/mcp.mdx +83 -15
  72. package/.docs/raw/docs/tools/multi-agent.mdx +5 -5
  73. package/.docs/raw/docs/tools/tool-ui.mdx +64 -28
  74. package/.docs/raw/docs/tools/user-managed-mcp.mdx +4 -4
  75. package/.docs/raw/docs/ui/dot-matrix.mdx +133 -0
  76. package/.docs/raw/docs/ui/mermaid.mdx +16 -9
  77. package/.docs/raw/docs/ui/model-selector.mdx +219 -52
  78. package/.docs/raw/docs/ui/number-roll.mdx +154 -0
  79. package/.docs/raw/docs/ui/part-grouping.mdx +2 -2
  80. package/.docs/raw/docs/ui/reasoning.mdx +3 -3
  81. package/.docs/raw/docs/ui/streamdown.mdx +2 -0
  82. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
  83. package/.docs/raw/docs/ui/thread.mdx +52 -0
  84. package/.docs/raw/docs/ui/tool-fallback.mdx +16 -0
  85. package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
  86. package/dist/constants.js.map +1 -1
  87. package/dist/index.js.map +1 -1
  88. package/dist/prepare-docs/code-examples.js.map +1 -1
  89. package/dist/prepare-docs/copy-raw.js.map +1 -1
  90. package/dist/prepare-docs/prepare.js.map +1 -1
  91. package/dist/stdio.js.map +1 -1
  92. package/dist/tools/docs.js.map +1 -1
  93. package/dist/tools/examples.js.map +1 -1
  94. package/dist/tools/tests/test-setup.js.map +1 -1
  95. package/dist/utils/mdx.js.map +1 -1
  96. package/dist/utils/paths.js.map +1 -1
  97. package/package.json +4 -4
  98. /package/.docs/raw/docs/{(docs)/copilots → copilots}/assistant-frame.mdx +0 -0
  99. /package/.docs/raw/docs/{(docs)/copilots → copilots}/make-assistant-visible.mdx +0 -0
  100. /package/.docs/raw/docs/{(docs)/copilots → copilots}/model-context.mdx +0 -0
  101. /package/.docs/raw/docs/{(docs)/copilots → copilots}/motivation.mdx +0 -0
  102. /package/.docs/raw/docs/{(docs)/copilots → copilots}/use-assistant-instructions.mdx +0 -0
@@ -774,19 +774,19 @@ export default withAui(nextConfig);
774
774
  "@assistant-ui/react-o11y": "workspace:*",
775
775
  "@assistant-ui/store": "workspace:*",
776
776
  "@assistant-ui/tap": "workspace:*",
777
- "next": "^16.2.6",
778
- "react": "^19.2.6",
779
- "react-dom": "^19.2.6"
777
+ "next": "^16.2.9",
778
+ "react": "^19.2.7",
779
+ "react-dom": "^19.2.7"
780
780
  },
781
781
  "devDependencies": {
782
782
  "@assistant-ui/next": "workspace:*",
783
783
  "@assistant-ui/x-buildutils": "workspace:*",
784
- "@tailwindcss/postcss": "^4.3.0",
785
- "@types/node": "^25.9.1",
786
- "@types/react": "^19.2.15",
784
+ "@tailwindcss/postcss": "^4.3.1",
785
+ "@types/node": "^25.9.3",
786
+ "@types/react": "^19.2.17",
787
787
  "@types/react-dom": "^19.2.3",
788
788
  "postcss": "^8.5.15",
789
- "tailwindcss": "^4.3.0",
789
+ "tailwindcss": "^4.3.1",
790
790
  "typescript": "^6.0.3"
791
791
  }
792
792
  }
@@ -555,21 +555,21 @@ export default withAui(nextConfig);
555
555
  "@assistant-ui/ui": "workspace:*",
556
556
  "class-variance-authority": "^0.7.1",
557
557
  "clsx": "^2.1.1",
558
- "lucide-react": "^1.17.0",
559
- "next": "^16.2.6",
560
- "react": "^19.2.6",
561
- "react-dom": "^19.2.6",
558
+ "lucide-react": "^1.18.0",
559
+ "next": "^16.2.9",
560
+ "react": "^19.2.7",
561
+ "react-dom": "^19.2.7",
562
562
  "tailwind-merge": "^3.6.0"
563
563
  },
564
564
  "devDependencies": {
565
565
  "@assistant-ui/next": "workspace:*",
566
566
  "@assistant-ui/x-buildutils": "workspace:*",
567
- "@tailwindcss/postcss": "^4.3.0",
568
- "@types/node": "^25.9.1",
569
- "@types/react": "^19.2.15",
567
+ "@tailwindcss/postcss": "^4.3.1",
568
+ "@types/node": "^25.9.3",
569
+ "@types/react": "^19.2.17",
570
570
  "@types/react-dom": "^19.2.3",
571
571
  "postcss": "^8.5.15",
572
- "tailwindcss": "^4.3.0",
572
+ "tailwindcss": "^4.3.1",
573
573
  "tw-animate-css": "^1.4.0",
574
574
  "typescript": "^6.0.3"
575
575
  }
@@ -263,16 +263,16 @@ export function MyRuntimeProvider({
263
263
  "use client";
264
264
 
265
265
  import {
266
+ defineToolkit,
266
267
  useAui,
267
268
  AuiProvider,
268
269
  Suggestions,
269
270
  Tools,
270
- type Toolkit,
271
271
  } from "@assistant-ui/react";
272
272
  import { Thread } from "@/components/assistant-ui/thread";
273
273
  import { PlusIcon } from "lucide-react";
274
274
 
275
- const toolkit = {
275
+ const toolkit = defineToolkit({
276
276
  browser_alert: {
277
277
  description: "Display a native browser alert dialog to the user.",
278
278
  parameters: {
@@ -306,7 +306,7 @@ const toolkit = {
306
306
  </div>
307
307
  ),
308
308
  },
309
- } satisfies Toolkit;
309
+ });
310
310
 
311
311
  function NewThreadButton() {
312
312
  const aui = useAui();
@@ -420,28 +420,28 @@ export default withAui(nextConfig);
420
420
  "start": "next start"
421
421
  },
422
422
  "dependencies": {
423
- "@ag-ui/client": "^0.0.54",
423
+ "@ag-ui/client": "^0.0.57",
424
424
  "@assistant-ui/react": "workspace:*",
425
425
  "@assistant-ui/react-ag-ui": "workspace:*",
426
426
  "@assistant-ui/react-markdown": "workspace:*",
427
427
  "@assistant-ui/ui": "workspace:*",
428
428
  "class-variance-authority": "^0.7.1",
429
429
  "clsx": "^2.1.1",
430
- "lucide-react": "^1.17.0",
431
- "next": "^16.2.6",
432
- "react": "^19.2.6",
433
- "react-dom": "^19.2.6",
430
+ "lucide-react": "^1.18.0",
431
+ "next": "^16.2.9",
432
+ "react": "^19.2.7",
433
+ "react-dom": "^19.2.7",
434
434
  "tailwind-merge": "^3.6.0"
435
435
  },
436
436
  "devDependencies": {
437
437
  "@assistant-ui/next": "workspace:*",
438
438
  "@assistant-ui/x-buildutils": "workspace:*",
439
- "@tailwindcss/postcss": "^4.3.0",
440
- "@types/node": "^25.9.1",
441
- "@types/react": "^19.2.15",
439
+ "@tailwindcss/postcss": "^4.3.1",
440
+ "@types/node": "^25.9.3",
441
+ "@types/react": "^19.2.17",
442
442
  "@types/react-dom": "^19.2.3",
443
443
  "postcss": "^8.5.15",
444
- "tailwindcss": "^4.3.0",
444
+ "tailwindcss": "^4.3.1",
445
445
  "tw-animate-css": "^1.4.0",
446
446
  "typescript": "^6.0.3"
447
447
  }
@@ -316,30 +316,30 @@ export default withAui(nextConfig);
316
316
  "start": "next start"
317
317
  },
318
318
  "dependencies": {
319
- "@ai-sdk/openai": "^3.0.67",
319
+ "@ai-sdk/openai": "^3.0.71",
320
320
  "@assistant-ui/react": "workspace:*",
321
321
  "@assistant-ui/react-ai-sdk": "workspace:*",
322
322
  "@assistant-ui/react-markdown": "workspace:*",
323
323
  "@assistant-ui/ui": "workspace:*",
324
- "ai": "^6.0.193",
324
+ "ai": "^6.0.204",
325
325
  "class-variance-authority": "^0.7.1",
326
326
  "clsx": "^2.1.1",
327
- "lucide-react": "^1.17.0",
328
- "next": "^16.2.6",
329
- "react": "^19.2.6",
330
- "react-dom": "^19.2.6",
327
+ "lucide-react": "^1.18.0",
328
+ "next": "^16.2.9",
329
+ "react": "^19.2.7",
330
+ "react-dom": "^19.2.7",
331
331
  "tailwind-merge": "^3.6.0",
332
332
  "zod": "^4.4.3"
333
333
  },
334
334
  "devDependencies": {
335
335
  "@assistant-ui/next": "workspace:*",
336
336
  "@assistant-ui/x-buildutils": "workspace:*",
337
- "@tailwindcss/postcss": "^4.3.0",
338
- "@types/node": "^25.9.1",
339
- "@types/react": "^19.2.15",
337
+ "@tailwindcss/postcss": "^4.3.1",
338
+ "@types/node": "^25.9.3",
339
+ "@types/react": "^19.2.17",
340
340
  "@types/react-dom": "^19.2.3",
341
341
  "postcss": "^8.5.15",
342
- "tailwindcss": "^4.3.0",
342
+ "tailwindcss": "^4.3.1",
343
343
  "tw-animate-css": "^1.4.0",
344
344
  "typescript": "^6.0.3"
345
345
  }
@@ -212,7 +212,6 @@ import { Thread } from "@/components/assistant-ui/thread";
212
212
  import {
213
213
  AssistantRuntimeProvider,
214
214
  Tools,
215
- type Toolkit,
216
215
  useAui,
217
216
  useAuiState,
218
217
  AuiProvider,
@@ -220,30 +219,9 @@ import {
220
219
  } from "@assistant-ui/react";
221
220
  import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
222
221
  import type { ToolCallMessagePart } from "@assistant-ui/react";
223
- import { TerminalIcon, CodeIcon, EyeIcon } from "lucide-react";
222
+ import { CodeIcon, EyeIcon } from "lucide-react";
224
223
  import { useState } from "react";
225
- import { z } from "zod";
226
-
227
- const toolkit = {
228
- render_html: {
229
- description:
230
- "Whenever the user asks for HTML code, call this function. The user will see the HTML code rendered in their browser.",
231
- parameters: z.object({
232
- code: z.string(),
233
- }),
234
- execute: async () => {
235
- return {};
236
- },
237
- render: () => {
238
- return (
239
- <div className="bg-primary text-primary-foreground my-2 inline-flex items-center gap-2 rounded-full border px-4 py-2">
240
- <TerminalIcon className="size-4" />
241
- render_html(&#123; code: &quot;...&quot; &#125;)
242
- </div>
243
- );
244
- },
245
- },
246
- } satisfies Toolkit;
224
+ import toolkit from "./toolkit";
247
225
 
248
226
  function ArtifactsView() {
249
227
  const [tab, setTab] = useState<"source" | "preview">("source");
@@ -359,6 +337,34 @@ export default function Home() {
359
337
 
360
338
  ```
361
339
 
340
+ ## app/toolkit.tsx
341
+
342
+ ```tsx
343
+ "use generative";
344
+
345
+ import { defineToolkit, externalTool } from "@assistant-ui/react";
346
+ import { TerminalIcon } from "lucide-react";
347
+ import { z } from "zod";
348
+
349
+ export default defineToolkit({
350
+ render_html: {
351
+ parameters: z.object({
352
+ code: z.string(),
353
+ }),
354
+ execute: externalTool(),
355
+ render: () => {
356
+ return (
357
+ <div className="bg-primary text-primary-foreground my-2 inline-flex items-center gap-2 rounded-full border px-4 py-2">
358
+ <TerminalIcon className="size-4" />
359
+ render_html(&#123; code: &quot;...&quot; &#125;)
360
+ </div>
361
+ );
362
+ },
363
+ },
364
+ });
365
+
366
+ ```
367
+
362
368
  ## components.json
363
369
 
364
370
  ```json
@@ -420,30 +426,30 @@ export default withAui(nextConfig);
420
426
  "start": "next start"
421
427
  },
422
428
  "dependencies": {
423
- "@ai-sdk/openai": "^3.0.67",
429
+ "@ai-sdk/openai": "^3.0.71",
424
430
  "@assistant-ui/react": "workspace:*",
425
431
  "@assistant-ui/react-ai-sdk": "workspace:*",
426
432
  "@assistant-ui/react-markdown": "workspace:*",
427
433
  "@assistant-ui/ui": "workspace:*",
428
- "ai": "^6.0.193",
434
+ "ai": "^6.0.204",
429
435
  "class-variance-authority": "^0.7.1",
430
436
  "clsx": "^2.1.1",
431
- "lucide-react": "^1.17.0",
432
- "next": "^16.2.6",
433
- "react": "^19.2.6",
434
- "react-dom": "^19.2.6",
437
+ "lucide-react": "^1.18.0",
438
+ "next": "^16.2.9",
439
+ "react": "^19.2.7",
440
+ "react-dom": "^19.2.7",
435
441
  "tailwind-merge": "^3.6.0",
436
442
  "zod": "^4.4.3"
437
443
  },
438
444
  "devDependencies": {
439
445
  "@assistant-ui/next": "workspace:*",
440
446
  "@assistant-ui/x-buildutils": "workspace:*",
441
- "@tailwindcss/postcss": "^4.3.0",
442
- "@types/node": "^25.9.1",
443
- "@types/react": "^19.2.15",
447
+ "@tailwindcss/postcss": "^4.3.1",
448
+ "@types/node": "^25.9.3",
449
+ "@types/react": "^19.2.17",
444
450
  "@types/react-dom": "^19.2.3",
445
451
  "postcss": "^8.5.15",
446
- "tailwindcss": "^4.3.0",
452
+ "tailwindcss": "^4.3.1",
447
453
  "tw-animate-css": "^1.4.0",
448
454
  "typescript": "^6.0.3"
449
455
  }
@@ -170,9 +170,9 @@ export default function RootLayout({
170
170
 
171
171
  import {
172
172
  AssistantRuntimeProvider,
173
+ defineToolkit,
173
174
  Tools,
174
175
  type AssistantTransportConnectionMetadata,
175
- type Toolkit,
176
176
  unstable_createMessageConverter as createMessageConverter,
177
177
  useAui,
178
178
  useAssistantTransportRuntime,
@@ -184,7 +184,7 @@ import {
184
184
  import type { ReactNode } from "react";
185
185
  import { z } from "zod";
186
186
 
187
- const toolkit = {
187
+ const toolkit = defineToolkit({
188
188
  get_weather: {
189
189
  type: "frontend",
190
190
  description: "Get the current weather for a city",
@@ -232,7 +232,7 @@ const toolkit = {
232
232
  : "Weather lookup complete",
233
233
  },
234
234
  },
235
- } satisfies Toolkit;
235
+ });
236
236
 
237
237
  type MyRuntimeProviderProps = {
238
238
  children: ReactNode;
@@ -433,22 +433,22 @@ export default withAui(nextConfig);
433
433
  "@assistant-ui/ui": "workspace:*",
434
434
  "class-variance-authority": "^0.7.1",
435
435
  "clsx": "^2.1.1",
436
- "lucide-react": "^1.17.0",
437
- "next": "^16.2.6",
438
- "react": "^19.2.6",
439
- "react-dom": "^19.2.6",
436
+ "lucide-react": "^1.18.0",
437
+ "next": "^16.2.9",
438
+ "react": "^19.2.7",
439
+ "react-dom": "^19.2.7",
440
440
  "tailwind-merge": "^3.6.0",
441
441
  "zod": "^4.4.3"
442
442
  },
443
443
  "devDependencies": {
444
444
  "@assistant-ui/next": "workspace:*",
445
445
  "@assistant-ui/x-buildutils": "workspace:*",
446
- "@tailwindcss/postcss": "^4.3.0",
447
- "@types/node": "^25.9.1",
448
- "@types/react": "^19.2.15",
446
+ "@tailwindcss/postcss": "^4.3.1",
447
+ "@types/node": "^25.9.3",
448
+ "@types/react": "^19.2.17",
449
449
  "@types/react-dom": "^19.2.3",
450
450
  "postcss": "^8.5.15",
451
- "tailwindcss": "^4.3.0",
451
+ "tailwindcss": "^4.3.1",
452
452
  "tw-animate-css": "^1.4.0",
453
453
  "typescript": "^6.0.3"
454
454
  }
@@ -229,20 +229,20 @@ export function MyThread() {
229
229
  "@assistant-ui/ui": "workspace:*",
230
230
  "class-variance-authority": "^0.7.1",
231
231
  "clsx": "^2.1.1",
232
- "lucide-react": "^1.17.0",
233
- "react": "^19.2.6",
234
- "react-dom": "^19.2.6",
232
+ "lucide-react": "^1.18.0",
233
+ "react": "^19.2.7",
234
+ "react-dom": "^19.2.7",
235
235
  "tailwind-merge": "^3.6.0"
236
236
  },
237
237
  "devDependencies": {
238
- "@tailwindcss/postcss": "^4.3.0",
239
- "@types/chrome": "^0.1.42",
240
- "@types/node": "^25.9.1",
241
- "@types/react": "^19.2.15",
238
+ "@tailwindcss/postcss": "^4.3.1",
239
+ "@types/chrome": "^0.1.43",
240
+ "@types/node": "^25.9.3",
241
+ "@types/react": "^19.2.17",
242
242
  "@types/react-dom": "^19.2.3",
243
- "esbuild": "^0.28.0",
243
+ "esbuild": "^0.28.1",
244
244
  "postcss": "^8.5.15",
245
- "tailwindcss": "^4.3.0",
245
+ "tailwindcss": "^4.3.1",
246
246
  "tsx": "^4.22.4",
247
247
  "tw-animate-css": "^1.4.0",
248
248
  "typescript": "5.9.3"
@@ -14,11 +14,14 @@ import {
14
14
  JsonToSseTransformStream,
15
15
  } from "ai";
16
16
  import type { UIMessage, UIMessageStreamWriter } from "ai";
17
- import { frontendTools } from "@assistant-ui/react-ai-sdk";
17
+ import { AISDKToolkit } from "@assistant-ui/react-ai-sdk";
18
18
  import { z } from "zod";
19
+ import toolkit from "../../toolkit";
19
20
 
20
21
  export const maxDuration = 30;
21
22
 
23
+ const aiToolkit = new AISDKToolkit({ toolkit });
24
+
22
25
  type SearchResult = { id: string; url: string; title: string };
23
26
 
24
27
  const searchSources = (query: string): SearchResult[] => {
@@ -112,13 +115,15 @@ async function streamModel(
112
115
  }),
113
116
  });
114
117
 
118
+ const toolkitTools = await aiToolkit.tools({ frontend: frontendToolDefs });
119
+
115
120
  const result = streamText({
116
121
  // Reasoning model so the chain-of-thought group has real content.
117
122
  model: openai("gpt-5.4-mini"),
118
123
  messages: await convertToModelMessages(messages),
119
124
  stopWhen: stepCountIs(10),
120
125
  tools: {
121
- ...frontendTools(frontendToolDefs),
126
+ ...toolkitTools,
122
127
  get_current_weather: tool({
123
128
  description: "Get the current weather for a city",
124
129
  inputSchema: zodSchema(z.object({ city: z.string() })),
@@ -635,7 +640,7 @@ const Composer: FC = () => {
635
640
  const isRunning = useThread((state) => state.isRunning);
636
641
 
637
642
  return (
638
- <ComposerPrimitive.Root className="border-input bg-background has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-ring/20 flex w-full flex-col rounded-2xl border px-1 pt-2 transition-shadow outline-none has-[textarea:focus-visible]:ring-2">
643
+ <ComposerPrimitive.Root className="border-input bg-background has-[textarea:focus-visible]:border-foreground/60 flex w-full flex-col rounded-2xl border px-1 pt-2 transition-colors outline-none">
639
644
  <ComposerPrimitive.Input
640
645
  placeholder="Send a message..."
641
646
  className="placeholder:text-muted-foreground mb-1 max-h-32 min-h-14 w-full resize-none bg-transparent px-4 pt-2 pb-3 text-sm outline-none"
@@ -682,51 +687,14 @@ const Composer: FC = () => {
682
687
  import {
683
688
  AssistantRuntimeProvider,
684
689
  Tools,
685
- type Toolkit,
686
690
  useAui,
687
691
  AuiProvider,
688
692
  Suggestions,
689
693
  } from "@assistant-ui/react";
690
694
  import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
691
- import { z } from "zod";
692
695
  import { MyThread } from "./MyThread";
693
696
  import { lastAssistantMessageIsCompleteWithApprovalResponses } from "ai";
694
-
695
- const toolkit = {
696
- execute_js: {
697
- type: "frontend",
698
- description: "Execute JavaScript code and return the result",
699
- parameters: z.object({
700
- code: z.string().describe("The JavaScript code to execute"),
701
- }),
702
- execute: async ({ code }) => {
703
- try {
704
- const result = eval(code);
705
- return { success: true, result: String(result) };
706
- } catch (e) {
707
- return { success: false, error: String(e) };
708
- }
709
- },
710
- render: ({ args, result, status }) => (
711
- <div className="bg-muted/30 my-2 rounded-lg border p-4 text-sm">
712
- <p className="mb-1 font-semibold">execute_js</p>
713
- <pre className="bg-background rounded p-2 font-mono text-xs whitespace-pre-wrap">
714
- {args.code}
715
- </pre>
716
- {status.type !== "running" && result && (
717
- <div className="mt-2 border-t pt-2">
718
- <p className="text-muted-foreground font-semibold">
719
- {result.success ? "Result:" : "Error:"}
720
- </p>
721
- <pre className="font-mono text-xs whitespace-pre-wrap">
722
- {result.success ? result.result : result.error}
723
- </pre>
724
- </div>
725
- )}
726
- </div>
727
- ),
728
- },
729
- } satisfies Toolkit;
697
+ import toolkit from "./toolkit";
730
698
 
731
699
  function MyThreadWithSuggestions() {
732
700
  const aui = useAui({
@@ -771,6 +739,59 @@ export default function Home() {
771
739
 
772
740
  ```
773
741
 
742
+ ## app/toolkit.tsx
743
+
744
+ ```tsx
745
+ "use generative";
746
+
747
+ import { defineToolkit } from "@assistant-ui/react";
748
+ import { z } from "zod";
749
+
750
+ type ExecuteJsResult =
751
+ | { success: true; result: string }
752
+ | { success: false; error: string };
753
+
754
+ export default defineToolkit({
755
+ execute_js: {
756
+ description: "Execute JavaScript code and return the result",
757
+ parameters: z.object({
758
+ code: z.string().describe("The JavaScript code to execute"),
759
+ }),
760
+ execute: async ({ code }) => {
761
+ "use client";
762
+ try {
763
+ const result = eval(code);
764
+ return { success: true, result: String(result) };
765
+ } catch (e) {
766
+ return { success: false, error: String(e) };
767
+ }
768
+ },
769
+ render: ({ args, result, status }) => {
770
+ const output = result as ExecuteJsResult | undefined;
771
+ return (
772
+ <div className="bg-muted/30 my-2 rounded-lg border p-4 text-sm">
773
+ <p className="mb-1 font-semibold">execute_js</p>
774
+ <pre className="bg-background rounded p-2 font-mono text-xs whitespace-pre-wrap">
775
+ {args.code}
776
+ </pre>
777
+ {status.type !== "running" && output && (
778
+ <div className="mt-2 border-t pt-2">
779
+ <p className="text-muted-foreground font-semibold">
780
+ {output.success ? "Result:" : "Error:"}
781
+ </p>
782
+ <pre className="font-mono text-xs whitespace-pre-wrap">
783
+ {output.success ? output.result : output.error}
784
+ </pre>
785
+ </div>
786
+ )}
787
+ </div>
788
+ );
789
+ },
790
+ },
791
+ });
792
+
793
+ ```
794
+
774
795
  ## components.json
775
796
 
776
797
  ```json
@@ -828,30 +849,30 @@ export default withAui(nextConfig);
828
849
  "start": "next start"
829
850
  },
830
851
  "dependencies": {
831
- "@ai-sdk/openai": "^3.0.67",
852
+ "@ai-sdk/openai": "^3.0.71",
832
853
  "@assistant-ui/react": "workspace:*",
833
854
  "@assistant-ui/react-ai-sdk": "workspace:*",
834
855
  "@assistant-ui/react-markdown": "workspace:*",
835
856
  "@assistant-ui/ui": "workspace:*",
836
- "ai": "^6.0.193",
857
+ "ai": "^6.0.204",
837
858
  "class-variance-authority": "^0.7.1",
838
859
  "clsx": "^2.1.1",
839
- "lucide-react": "^1.17.0",
840
- "next": "^16.2.6",
841
- "react": "^19.2.6",
842
- "react-dom": "^19.2.6",
860
+ "lucide-react": "^1.18.0",
861
+ "next": "^16.2.9",
862
+ "react": "^19.2.7",
863
+ "react-dom": "^19.2.7",
843
864
  "tailwind-merge": "^3.6.0",
844
865
  "zod": "^4.4.3"
845
866
  },
846
867
  "devDependencies": {
847
868
  "@assistant-ui/next": "workspace:*",
848
869
  "@assistant-ui/x-buildutils": "workspace:*",
849
- "@tailwindcss/postcss": "^4.3.0",
850
- "@types/node": "^25.9.1",
851
- "@types/react": "^19.2.15",
870
+ "@tailwindcss/postcss": "^4.3.1",
871
+ "@types/node": "^25.9.3",
872
+ "@types/react": "^19.2.17",
852
873
  "@types/react-dom": "^19.2.3",
853
874
  "postcss": "^8.5.15",
854
- "tailwindcss": "^4.3.0",
875
+ "tailwindcss": "^4.3.1",
855
876
  "tw-animate-css": "^1.4.0",
856
877
  "typescript": "^6.0.3"
857
878
  }
@@ -568,26 +568,26 @@ export default withAui(nextConfig);
568
568
  "start": "next start"
569
569
  },
570
570
  "dependencies": {
571
- "@ai-sdk/openai": "^3.0.67",
571
+ "@ai-sdk/openai": "^3.0.71",
572
572
  "@assistant-ui/cloud-ai-sdk": "workspace:*",
573
- "ai": "^6.0.193",
573
+ "ai": "^6.0.204",
574
574
  "class-variance-authority": "^0.7.1",
575
575
  "clsx": "^2.1.1",
576
- "lucide-react": "^1.17.0",
577
- "next": "^16.2.6",
578
- "react": "^19.2.6",
579
- "react-dom": "^19.2.6",
576
+ "lucide-react": "^1.18.0",
577
+ "next": "^16.2.9",
578
+ "react": "^19.2.7",
579
+ "react-dom": "^19.2.7",
580
580
  "tailwind-merge": "^3.6.0"
581
581
  },
582
582
  "devDependencies": {
583
583
  "@assistant-ui/next": "workspace:*",
584
584
  "@assistant-ui/x-buildutils": "workspace:*",
585
- "@tailwindcss/postcss": "^4.3.0",
586
- "@types/node": "^25.9.1",
587
- "@types/react": "^19.2.15",
585
+ "@tailwindcss/postcss": "^4.3.1",
586
+ "@types/node": "^25.9.3",
587
+ "@types/react": "^19.2.17",
588
588
  "@types/react-dom": "^19.2.3",
589
589
  "postcss": "^8.5.15",
590
- "tailwindcss": "^4.3.0",
590
+ "tailwindcss": "^4.3.1",
591
591
  "tw-animate-css": "^1.4.0",
592
592
  "typescript": "^6.0.3"
593
593
  }
@@ -328,29 +328,29 @@ export default withAui(nextConfig);
328
328
  "start": "next start"
329
329
  },
330
330
  "dependencies": {
331
- "@ai-sdk/openai": "^3.0.67",
331
+ "@ai-sdk/openai": "^3.0.71",
332
332
  "@assistant-ui/react": "workspace:*",
333
333
  "@assistant-ui/react-ai-sdk": "workspace:*",
334
334
  "@assistant-ui/react-markdown": "workspace:*",
335
335
  "@assistant-ui/ui": "workspace:*",
336
- "ai": "^6.0.193",
336
+ "ai": "^6.0.204",
337
337
  "class-variance-authority": "^0.7.1",
338
338
  "clsx": "^2.1.1",
339
- "lucide-react": "^1.17.0",
340
- "next": "^16.2.6",
341
- "react": "^19.2.6",
342
- "react-dom": "^19.2.6",
339
+ "lucide-react": "^1.18.0",
340
+ "next": "^16.2.9",
341
+ "react": "^19.2.7",
342
+ "react-dom": "^19.2.7",
343
343
  "tailwind-merge": "^3.6.0"
344
344
  },
345
345
  "devDependencies": {
346
346
  "@assistant-ui/next": "workspace:*",
347
347
  "@assistant-ui/x-buildutils": "workspace:*",
348
- "@tailwindcss/postcss": "^4.3.0",
349
- "@types/node": "^25.9.1",
350
- "@types/react": "^19.2.15",
348
+ "@tailwindcss/postcss": "^4.3.1",
349
+ "@types/node": "^25.9.3",
350
+ "@types/react": "^19.2.17",
351
351
  "@types/react-dom": "^19.2.3",
352
352
  "postcss": "^8.5.15",
353
- "tailwindcss": "^4.3.0",
353
+ "tailwindcss": "^4.3.1",
354
354
  "tw-animate-css": "^1.4.0",
355
355
  "typescript": "^6.0.3"
356
356
  }