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

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 (81) hide show
  1. package/.docs/organized/code-examples/waterfall.md +5 -5
  2. package/.docs/organized/code-examples/with-a2a.md +5 -5
  3. package/.docs/organized/code-examples/with-ag-ui.md +9 -9
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
  5. package/.docs/organized/code-examples/with-artifacts.md +37 -31
  6. package/.docs/organized/code-examples/with-assistant-transport.md +8 -8
  7. package/.docs/organized/code-examples/with-browser-extension.md +5 -5
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +68 -47
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
  10. package/.docs/organized/code-examples/with-cloud.md +7 -7
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +8 -8
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
  14. package/.docs/organized/code-examples/with-expo.md +33 -24
  15. package/.docs/organized/code-examples/with-external-store.md +5 -5
  16. package/.docs/organized/code-examples/with-ffmpeg.md +10 -10
  17. package/.docs/organized/code-examples/with-generative-ui.md +70 -64
  18. package/.docs/organized/code-examples/with-google-adk.md +6 -6
  19. package/.docs/organized/code-examples/with-heat-graph.md +5 -5
  20. package/.docs/organized/code-examples/with-image-generation.md +7 -7
  21. package/.docs/organized/code-examples/with-interactables.md +7 -7
  22. package/.docs/organized/code-examples/with-langchain.md +7 -7
  23. package/.docs/organized/code-examples/with-langgraph.md +30 -26
  24. package/.docs/organized/code-examples/with-livekit.md +8 -8
  25. package/.docs/organized/code-examples/with-mcp.md +8 -8
  26. package/.docs/organized/code-examples/with-opencode.md +6 -6
  27. package/.docs/organized/code-examples/with-react-hook-form.md +7 -7
  28. package/.docs/organized/code-examples/with-react-ink.md +295 -100
  29. package/.docs/organized/code-examples/with-react-router.md +11 -11
  30. package/.docs/organized/code-examples/with-resumable-stream.md +8 -8
  31. package/.docs/organized/code-examples/with-store.md +64 -64
  32. package/.docs/organized/code-examples/with-tanstack.md +8 -8
  33. package/.docs/organized/code-examples/with-tap-runtime.md +5 -5
  34. package/.docs/raw/docs/(docs)/architecture.mdx +52 -41
  35. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +1 -1
  36. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +3 -0
  37. package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +14 -3
  38. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +94 -3
  39. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +5 -69
  40. package/.docs/raw/docs/ink/adapters.mdx +23 -1
  41. package/.docs/raw/docs/ink/hooks.mdx +20 -17
  42. package/.docs/raw/docs/migrations/toolkit-tools.mdx +14 -8
  43. package/.docs/raw/docs/react-native/hooks.mdx +25 -17
  44. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +41 -0
  45. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +3 -3
  46. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +46 -4
  47. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +54 -12
  48. package/.docs/raw/docs/runtimes/custom/external-store.mdx +62 -4
  49. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +12 -0
  50. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -9
  51. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +13 -0
  52. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +5 -5
  53. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +3 -3
  54. package/.docs/raw/docs/tools/backend.mdx +19 -11
  55. package/.docs/raw/docs/tools/defining-tools.mdx +177 -52
  56. package/.docs/raw/docs/tools/index.mdx +7 -12
  57. package/.docs/raw/docs/tools/mcp.mdx +83 -15
  58. package/.docs/raw/docs/tools/multi-agent.mdx +5 -5
  59. package/.docs/raw/docs/tools/tool-ui.mdx +27 -27
  60. package/.docs/raw/docs/tools/user-managed-mcp.mdx +4 -4
  61. package/.docs/raw/docs/ui/mermaid.mdx +16 -9
  62. package/.docs/raw/docs/ui/part-grouping.mdx +2 -2
  63. package/.docs/raw/docs/ui/tool-fallback.mdx +16 -0
  64. package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
  65. package/dist/constants.js.map +1 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/prepare-docs/code-examples.js.map +1 -1
  68. package/dist/prepare-docs/copy-raw.js.map +1 -1
  69. package/dist/prepare-docs/prepare.js.map +1 -1
  70. package/dist/stdio.js.map +1 -1
  71. package/dist/tools/docs.js.map +1 -1
  72. package/dist/tools/examples.js.map +1 -1
  73. package/dist/tools/tests/test-setup.js.map +1 -1
  74. package/dist/utils/mdx.js.map +1 -1
  75. package/dist/utils/paths.js.map +1 -1
  76. package/package.json +4 -4
  77. /package/.docs/raw/docs/{(docs)/copilots → copilots}/assistant-frame.mdx +0 -0
  78. /package/.docs/raw/docs/{(docs)/copilots → copilots}/make-assistant-visible.mdx +0 -0
  79. /package/.docs/raw/docs/{(docs)/copilots → copilots}/model-context.mdx +0 -0
  80. /package/.docs/raw/docs/{(docs)/copilots → copilots}/motivation.mdx +0 -0
  81. /package/.docs/raw/docs/{(docs)/copilots → copilots}/use-assistant-instructions.mdx +0 -0
@@ -339,80 +339,80 @@ declare module "@assistant-ui/store" {
339
339
 
340
340
  import "./foo-scope";
341
341
 
342
- import { type ReactNode, useMemo } from "react";
343
- import { resource, tapMemo, tapState } from "@assistant-ui/tap";
342
+ import { type ReactNode, useMemo, useState } from "react";
343
+ import { resource } from "@assistant-ui/tap";
344
344
  import {
345
345
  useAui,
346
346
  useAuiState,
347
347
  AuiProvider,
348
- tapClientList,
348
+ useClientList,
349
349
  Derived,
350
- tapAssistantEmit,
350
+ useAssistantEmit,
351
351
  RenderChildrenWithAccessor,
352
352
  type ClientOutput,
353
353
  } from "@assistant-ui/store";
354
354
 
355
355
  type FooData = { id: string; bar: string };
356
356
 
357
- export const FooItemResource = resource(
358
- ({
359
- getInitialData,
360
- remove,
361
- }: tapClientList.ResourceProps<FooData>): ClientOutput<"foo"> => {
362
- const emit = tapAssistantEmit();
357
+ export const FooItemResource = resource(function FooItemResource({
358
+ getInitialData,
359
+ remove,
360
+ }: useClientList.ResourceProps<FooData>): ClientOutput<"foo"> {
361
+ const emit = useAssistantEmit();
363
362
 
364
- const [state, setState] = tapState<FooData>(getInitialData);
363
+ const [state, setState] = useState<FooData>(getInitialData);
365
364
 
366
- const updateBar = (newBar: string) => {
367
- setState({ ...state, bar: newBar });
368
- emit("foo.updated", { id: state.id, newValue: newBar });
369
- };
365
+ const updateBar = (newBar: string) => {
366
+ setState({ ...state, bar: newBar });
367
+ emit("foo.updated", { id: state.id, newValue: newBar });
368
+ };
370
369
 
371
- const handleRemove = () => {
372
- emit("foo.removed", { id: state.id });
373
- remove();
374
- };
370
+ const handleRemove = () => {
371
+ emit("foo.removed", { id: state.id });
372
+ remove();
373
+ };
375
374
 
376
- return {
377
- getState: () => state,
378
- updateBar,
379
- remove: handleRemove,
380
- };
381
- },
382
- );
375
+ return {
376
+ getState: () => state,
377
+ updateBar,
378
+ remove: handleRemove,
379
+ };
380
+ });
383
381
 
384
382
  let counter = 3;
385
- export const FooListResource = resource(
386
- ({ initialValues }: { initialValues: boolean }): ClientOutput<"fooList"> => {
387
- const emit = tapAssistantEmit();
388
-
389
- const foos = tapClientList({
390
- initialValues: initialValues
391
- ? [
392
- { id: "foo-1", bar: "First Foo" },
393
- { id: "foo-2", bar: "Second Foo" },
394
- { id: "foo-3", bar: "Third Foo" },
395
- ]
396
- : [],
397
- getKey: (foo) => foo.id,
398
- resource: FooItemResource,
399
- });
383
+ export const FooListResource = resource(function FooListResource({
384
+ initialValues,
385
+ }: {
386
+ initialValues: boolean;
387
+ }): ClientOutput<"fooList"> {
388
+ const emit = useAssistantEmit();
389
+
390
+ const foos = useClientList({
391
+ initialValues: initialValues
392
+ ? [
393
+ { id: "foo-1", bar: "First Foo" },
394
+ { id: "foo-2", bar: "Second Foo" },
395
+ { id: "foo-3", bar: "Third Foo" },
396
+ ]
397
+ : [],
398
+ getKey: (foo) => foo.id,
399
+ resource: FooItemResource,
400
+ });
400
401
 
401
- const addFoo = () => {
402
- const id = `foo-${++counter}`;
403
- foos.add({ id: id, bar: `New Foo` });
404
- emit("fooList.added", { id: id });
405
- };
402
+ const addFoo = () => {
403
+ const id = `foo-${++counter}`;
404
+ foos.add({ id: id, bar: `New Foo` });
405
+ emit("fooList.added", { id: id });
406
+ };
406
407
 
407
- const state = tapMemo(() => ({ foos: foos.state }), [foos.state]);
408
+ const state = useMemo(() => ({ foos: foos.state }), [foos.state]);
408
409
 
409
- return {
410
- getState: () => state,
411
- foo: foos.get,
412
- addFoo,
413
- };
414
- },
415
- );
410
+ return {
411
+ getState: () => state,
412
+ foo: foos.get,
413
+ addFoo,
414
+ };
415
+ });
416
416
 
417
417
  const FooProvider = ({
418
418
  index,
@@ -492,16 +492,16 @@ export default withAui(nextConfig);
492
492
  "dependencies": {
493
493
  "@assistant-ui/store": "workspace:*",
494
494
  "@assistant-ui/tap": "workspace:*",
495
- "next": "^16.2.6",
496
- "react": "^19.2.6",
497
- "react-dom": "^19.2.6"
495
+ "next": "^16.2.7",
496
+ "react": "^19.2.7",
497
+ "react-dom": "^19.2.7"
498
498
  },
499
499
  "devDependencies": {
500
500
  "@assistant-ui/next": "workspace:*",
501
501
  "@assistant-ui/x-buildutils": "workspace:*",
502
502
  "@tailwindcss/postcss": "^4.3.0",
503
- "@types/node": "^25.9.1",
504
- "@types/react": "^19.2.15",
503
+ "@types/node": "^25.9.2",
504
+ "@types/react": "^19.2.17",
505
505
  "@types/react-dom": "^19.2.3",
506
506
  "postcss": "^8.5.15",
507
507
  "tailwindcss": "^4.3.0",
@@ -522,8 +522,8 @@ This is a Next.js application demonstrating the `@assistant-ui/store` package.
522
522
  ## Features Demonstrated
523
523
 
524
524
  - **Client Registry**: Module augmentation for type-safe client definitions
525
- - **tapClientList**: Managing lists with index and key lookup
526
- - **tapAssistantEmit**: Emitting and subscribing to scoped events
525
+ - **useClientList**: Managing lists with index and key lookup
526
+ - **useAssistantEmit**: Emitting and subscribing to scoped events
527
527
  - **Derived**: Creating derived client scopes from parent resources
528
528
  - **Provider Pattern**: Scoped access to list items via FooProvider
529
529
  - **Component Composition**: Render props pattern with components prop
@@ -587,10 +587,10 @@ declare module "@assistant-ui/store" {
587
587
 
588
588
  ```typescript
589
589
  const FooListResource = resource(
590
- ({ initialValues }): ClientOutput<"fooList"> => {
591
- const emit = tapAssistantEmit();
590
+ function FooListResource({ initialValues }): ClientOutput<"fooList"> {
591
+ const emit = useAssistantEmit();
592
592
 
593
- const foos = tapClientList({
593
+ const foos = useClientList({
594
594
  initialValues: initialValues ? [/* ... */] : [],
595
595
  getKey: (foo) => foo.id,
596
596
  resource: FooItemResource,
@@ -65,15 +65,15 @@
65
65
  "@assistant-ui/react": "workspace:*",
66
66
  "@assistant-ui/react-markdown": "workspace:*",
67
67
  "@tailwindcss/vite": "^4.3.0",
68
- "@tanstack/react-router": "^1.170.10",
69
- "@tanstack/react-start": "^1.168.18",
68
+ "@tanstack/react-router": "^1.170.15",
69
+ "@tanstack/react-start": "^1.168.25",
70
70
  "class-variance-authority": "^0.7.1",
71
71
  "clsx": "^2.1.1",
72
72
  "lucide-react": "^1.17.0",
73
73
  "nitro": "^3.0.260311-beta",
74
- "openai": "^6.39.1",
75
- "react": "^19.2.6",
76
- "react-dom": "^19.2.6",
74
+ "openai": "^6.42.0",
75
+ "react": "^19.2.7",
76
+ "react-dom": "^19.2.7",
77
77
  "remark-gfm": "^4.0.1",
78
78
  "tailwind-merge": "^3.6.0",
79
79
  "tailwindcss": "^4.3.0",
@@ -81,12 +81,12 @@
81
81
  },
82
82
  "devDependencies": {
83
83
  "@assistant-ui/x-buildutils": "workspace:*",
84
- "@types/node": "^25.9.1",
85
- "@types/react": "^19.2.15",
84
+ "@types/node": "^25.9.2",
85
+ "@types/react": "^19.2.17",
86
86
  "@types/react-dom": "^19.2.3",
87
87
  "@vitejs/plugin-react": "^6.0.2",
88
88
  "typescript": "^6.0.3",
89
- "vite": "^8.0.14"
89
+ "vite": "^8.0.16"
90
90
  }
91
91
  }
92
92
 
@@ -603,17 +603,17 @@ export default withAui(nextConfig);
603
603
  "class-variance-authority": "^0.7.1",
604
604
  "clsx": "^2.1.1",
605
605
  "lucide-react": "^1.17.0",
606
- "next": "^16.2.6",
607
- "react": "^19.2.6",
608
- "react-dom": "^19.2.6",
606
+ "next": "^16.2.7",
607
+ "react": "^19.2.7",
608
+ "react-dom": "^19.2.7",
609
609
  "tailwind-merge": "^3.6.0"
610
610
  },
611
611
  "devDependencies": {
612
612
  "@assistant-ui/next": "workspace:*",
613
613
  "@assistant-ui/x-buildutils": "workspace:*",
614
614
  "@tailwindcss/postcss": "^4.3.0",
615
- "@types/node": "^25.9.1",
616
- "@types/react": "^19.2.15",
615
+ "@types/node": "^25.9.2",
616
+ "@types/react": "^19.2.17",
617
617
  "@types/react-dom": "^19.2.3",
618
618
  "postcss": "^8.5.15",
619
619
  "tailwindcss": "^4.3.0",
@@ -56,60 +56,71 @@ Thread and message history can be stored by Assistant Cloud or by your own datab
56
56
 
57
57
  #### **1. Direct Integration with External Providers**
58
58
 
59
- ```mermaid
60
- graph TD
59
+ <Flow.Root
60
+ llm={`graph TD
61
61
  A[Frontend Components] --> B[Runtime]
62
- B --> D[External Providers or LLM APIs]
63
-
64
-
65
- classDef default color:#f8fafc,text-align:center
66
-
67
- style A fill:#e879f9,stroke:#2e1065,stroke-width:2px,color:#2e1065,font-weight:bold
68
- style B fill:#93c5fd,stroke:#1e3a8a,stroke-width:2px,color:#1e3a8a,font-weight:bold
69
- style D fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
70
-
71
- class A,B,C,D,E default
72
- ```
62
+ B --> D[External Providers or LLM APIs]`}
63
+ >
64
+ <Flow.Column>
65
+ <Flow.Node tone="pink">Frontend Components</Flow.Node>
66
+ <Flow.Arrow direction="down" length={36} />
67
+ <Flow.Node tone="blue">Runtime</Flow.Node>
68
+ <Flow.Arrow direction="down" length={36} />
69
+ <Flow.Node tone="red">External Providers or LLM APIs</Flow.Node>
70
+ </Flow.Column>
71
+ </Flow.Root>
73
72
 
74
73
  #### **2. Using your own API endpoint**
75
74
 
76
- ```mermaid
77
- graph TD
75
+ <Flow.Root
76
+ llm={`graph TD
78
77
  A[Frontend Components] --> B[Runtime]
79
78
  B --> E[Your API Backend]
80
- E --> D[External Providers or LLM APIs]
81
-
82
-
83
- classDef default color:#f8fafc,text-align:center
84
-
85
- style A fill:#e879f9,stroke:#2e1065,stroke-width:2px,color:#2e1065,font-weight:bold
86
- style B fill:#93c5fd,stroke:#1e3a8a,stroke-width:2px,color:#1e3a8a,font-weight:bold
87
- style D fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
88
- style E fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
89
-
90
- class A,B,C,D,E default
91
- ```
79
+ E --> D[External Providers or LLM APIs]`}
80
+ >
81
+ <Flow.Column>
82
+ <Flow.Node tone="pink">Frontend Components</Flow.Node>
83
+ <Flow.Arrow direction="down" length={36} />
84
+ <Flow.Node tone="blue">Runtime</Flow.Node>
85
+ <Flow.Arrow direction="down" length={36} />
86
+ <Flow.Node tone="red">Your API Backend</Flow.Node>
87
+ <Flow.Arrow direction="down" length={36} />
88
+ <Flow.Node tone="red">External Providers or LLM APIs</Flow.Node>
89
+ </Flow.Column>
90
+ </Flow.Root>
92
91
 
93
92
  #### **3. With Assistant Cloud**
94
93
 
95
- ```mermaid
96
- graph TD
94
+ <Flow.Root
95
+ llm={`graph TD
97
96
  A[Frontend Components] --> B[Runtime]
98
97
  B --> C[Cloud]
99
98
  E --> C
100
99
  C --> D[External Providers or LLM APIs]
101
- B --> E[Your API Backend]
102
-
103
- classDef default color:#f8fafc,text-align:center
104
-
105
- style A fill:#e879f9,stroke:#2e1065,stroke-width:2px,color:#2e1065,font-weight:bold
106
- style B fill:#93c5fd,stroke:#1e3a8a,stroke-width:2px,color:#1e3a8a,font-weight:bold
107
- style C fill:#86efac,stroke:#064e3b,stroke-width:2px,color:#064e3b,font-weight:bold
108
- style D fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
109
- style E fill:#fca5a5,stroke:#7f1d1d,stroke-width:2px,color:#7f1d1d,font-weight:bold
110
-
111
- class A,B,C,D,E default
112
- ```
100
+ B --> E[Your API Backend]`}
101
+ >
102
+ <Flow.Canvas
103
+ edges={[
104
+ { from: "runtime", to: "backend", route: "down", fromOffset: -20 },
105
+ { from: "runtime", to: "cloud", route: "down", fromOffset: 20 },
106
+ { from: "cloud", to: "providers", route: "down" },
107
+ ]}
108
+ >
109
+ <Flow.Column>
110
+ <Flow.Node tone="pink">Frontend Components</Flow.Node>
111
+ <Flow.Arrow direction="down" length={36} />
112
+ <Flow.Node flowId="runtime" tone="blue">Runtime</Flow.Node>
113
+ <div className="h-10" aria-hidden />
114
+ <Flow.Row>
115
+ <Flow.Node flowId="backend" tone="red">Your API Backend</Flow.Node>
116
+ <Flow.Arrow length={48} />
117
+ <Flow.Node flowId="cloud" tone="green">Cloud</Flow.Node>
118
+ </Flow.Row>
119
+ <div className="h-10" aria-hidden />
120
+ <Flow.Node flowId="providers" tone="red">External Providers or LLM APIs</Flow.Node>
121
+ </Flow.Column>
122
+ </Flow.Canvas>
123
+ </Flow.Root>
113
124
 
114
125
  ## Going deeper
115
126
 
@@ -47,6 +47,6 @@ const unstable_convertExternalMessages: <T extends WeakKey>(messages: T[], callb
47
47
  ### unstable_createMessageConverter
48
48
 
49
49
  ```ts
50
- const unstable_createMessageConverter: <T extends object>(callback: useExternalMessageConverter.Callback<T>) => { useThreadMessages: ({ messages, isRunning, joinStrategy, metadata, }: { messages: T[]; isRunning: boolean; joinStrategy?: "concat-content" | "none" | undefined; metadata?: useExternalMessageConverter.Metadata; }) => ThreadMessage[]; toThreadMessages: (messages: T[], isRunning?: boolean, metadata?: useExternalMessageConverter.Metadata) => ThreadMessage[]; toOriginalMessages: (input: ThreadState | ThreadMessage | ThreadMessage["content"][number]) => unknown[]; toOriginalMessage: (input: ThreadState | ThreadMessage | ThreadMessage["content"][number]) => {}; useOriginalMessage: () => {}; useOriginalMessages: () => unknown[]; };
50
+ const unstable_createMessageConverter: <T extends object>(callback: useExternalMessageConverter.Callback<T>) => { useThreadMessages: ({ messages, isRunning, joinStrategy, metadata, }: { messages: T[]; isRunning: boolean; joinStrategy?: JoinStrategy | undefined; metadata?: useExternalMessageConverter.Metadata; }) => ThreadMessage[]; toThreadMessages: (messages: T[], isRunning?: boolean, metadata?: useExternalMessageConverter.Metadata) => ThreadMessage[]; toOriginalMessages: (input: ThreadState | ThreadMessage | ThreadMessage["content"][number]) => unknown[]; toOriginalMessage: (input: ThreadState | ThreadMessage | ThreadMessage["content"][number]) => {}; useOriginalMessage: () => {}; useOriginalMessages: () => unknown[]; };
51
51
  ```
52
52
  {/* api-reference:end */}
@@ -28,6 +28,9 @@ import { ExternalStoreAdapter, ExternalThread, ExternalThreadProps, ExternalThre
28
28
 
29
29
  ### ExternalThreadQueueAdapter
30
30
 
31
+ The queue surface a runtime exposes so the composer can stay usable during a
32
+ run and render the pending messages.
33
+
31
34
  <ParametersTable {...ExternalThreadQueueAdapter} />
32
35
 
33
36
  ### pickExternalStoreSharedOptions
@@ -36,6 +36,14 @@ const frontendTools: (tools: Record<string, ToolJSONSchema>) => ToolSet;
36
36
 
37
37
  ### generativeTools
38
38
 
39
+ <Callout type="warn">
40
+ <strong>Deprecated.</strong> Use [AISDKToolkit](/docs/api-reference/integrations/react-ai-sdk#aisdktoolkit) instead:
41
+ `new AISDKToolkit({ toolkit }).tools({ frontend })`. It is a strict superset
42
+ (it also opens MCP server connections), so it replaces `generativeTools`
43
+ everywhere. The `frontendTools` option is named `frontend` on `.tools()`, and
44
+ `.tools()` is async. `generativeTools` will be removed in a future version.
45
+ </Callout>
46
+
39
47
  Builds an AI SDK `ToolSet` for server-side use with `streamText` /
40
48
  `generateText` from a generative `toolkit` and the frontend-uploaded tools.
41
49
 
@@ -44,15 +52,18 @@ Each toolkit tool's `execute` runs on the server. Pair this with the
44
52
  resolves to the server build — schema + `execute`, with `render` stripped) and
45
53
  pass it here. Tools without an `execute` are still exposed to the model but
46
54
  left for the client to fulfill. `frontendTools` lets the client contribute
47
- tools that aren't in the static toolkit. Use [AISDKToolkit](/docs/api-reference/integrations/react-ai-sdk#aisdktoolkit) when the
48
- toolkit contains MCP entries.
55
+ tools that aren't in the static toolkit.
49
56
 
50
57
  ```ts
58
+ // Define once at module scope so any MCP connections pool across requests.
59
+ const aiToolkit = new AISDKToolkit({ toolkit: docsToolkit });
60
+
61
+ // In your route handler:
51
62
  const { tools } = await req.json();
52
63
  streamText({
53
64
  model,
54
65
  messages,
55
- tools: generativeTools({ toolkit: docsToolkit, frontendTools: tools }),
66
+ tools: await aiToolkit.tools({ frontend: tools }),
56
67
  });
57
68
  ```
58
69
 
@@ -3,7 +3,7 @@ title: Toolkits
3
3
  description: Define model-facing tools and compose them into named toolkits registered with an assistant-ui runtime scope.
4
4
  ---
5
5
 
6
- import { ToolDefinition, Tools, tool } from "@/generated/typeDocs";
6
+ import { ToolDefinition, Tools, defineMcpToolkit, defineToolkit, providerTool, tool } from "@/generated/typeDocs";
7
7
 
8
8
  {/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
9
9
  {/* Do not edit manually. */}
@@ -63,7 +63,7 @@ Named collection of tools exposed to the assistant model.
63
63
  Keys are the tool names the model receives and uses in tool calls.
64
64
 
65
65
  ```tsx
66
- const toolkit = {
66
+ const toolkit = defineToolkit({
67
67
  get_weather: {
68
68
  type: "frontend",
69
69
  description: "Get the weather for a city.",
@@ -71,7 +71,7 @@ const toolkit = {
71
71
  execute: async ({ city }: { city: string }) => fetchWeather(city),
72
72
  render: WeatherToolUI,
73
73
  },
74
- } satisfies Toolkit;
74
+ });
75
75
  ```
76
76
 
77
77
  ```ts
@@ -88,4 +88,95 @@ context, while each tool renderer is registered with the tools scope for
88
88
  message rendering.
89
89
 
90
90
  <ParametersTable {...Tools} />
91
+
92
+ ### defineMcpToolkit
93
+
94
+ Defines MCP server tools as a spreadable toolkit fragment.
95
+
96
+ <ParametersTable {...defineMcpToolkit} />
97
+
98
+ ### defineToolkit
99
+
100
+ Toolkit authoring helper. Accepts the permissive ToolkitDefinition
101
+ (a generative `backend` tool may carry its server `execute`) and types the
102
+ result as the canonical [Toolkit](/docs/api-reference/tools/toolkits#toolkit).
103
+
104
+ In a `"use generative"` file, the compiler strips the wrapper per build so it
105
+ can split schemas, renderers, and executors across the client/server boundary.
106
+ Outside generative compilation, it returns the toolkit unchanged and can be
107
+ used for plain frontend/backend/human toolkit objects.
108
+
109
+ <ParametersTable {...defineToolkit} />
110
+
111
+ ### externalTool
112
+
113
+ Marks a generative toolkit entry as an externally executed backend tool.
114
+
115
+ Use this when another system (for example a backend route or LangGraph node)
116
+ already defines and executes the tool, but assistant-ui should render its
117
+ tool calls. The use-generative compiler omits `execute: externalTool()`
118
+ entries from the server build and keeps a `type: "backend"` renderer on the
119
+ client build.
120
+
121
+ ```ts
122
+ function externalTool(): never;
123
+ ```
124
+
125
+ ### hitl
126
+
127
+ <Callout type="warn">
128
+ <strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
129
+ </Callout>
130
+
131
+ ```ts
132
+ const hitl: typeof humanTool;
133
+ ```
134
+
135
+ ### hitlTool
136
+
137
+ <Callout type="warn">
138
+ <strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
139
+ </Callout>
140
+
141
+ ```ts
142
+ const hitlTool: typeof humanTool;
143
+ ```
144
+
145
+ ### humanTool
146
+
147
+ Marks a tool as **human-in-the-loop**: the agent pauses and the UI (`render`)
148
+ supplies the result instead of code. Use it as the tool's `execute`:
149
+
150
+ ```tsx
151
+ confirm: { execute: humanTool(), render: (props) => <Confirm {...props} /> }
152
+ ```
153
+
154
+ Unlike [defineToolkit](/docs/api-reference/tools/toolkits#definetoolkit), it has **no runtime implementation**: a
155
+ `"use generative"` compiler (e.g. `@assistant-ui/next` or `@assistant-ui/vite`)
156
+ detects `execute: humanTool()`, drops it, and stamps the tool `type: "human"`.
157
+ Reaching it at runtime means the module wasn't compiled (used outside a
158
+ `"use generative"` file), so it throws.
159
+
160
+ ```ts
161
+ function humanTool(): never;
162
+ ```
163
+
164
+ ### providerTool
165
+
166
+ Marks a tool as provider-executed. The use-generative compiler converts
167
+ `execute: providerTool(...)` into a `type: "provider"` tool entry.
168
+
169
+ <ParametersTable {...providerTool} />
170
+
171
+ ### stubTool
172
+
173
+ Marks a generative toolkit entry as a frontend tool whose executor will be
174
+ supplied by `useAuiToolOverrides(...)`.
175
+
176
+ `stubTool()` has no runtime implementation. It must be used inside a
177
+ `"use generative"` toolkit file so the compiler can strip it.
178
+
179
+ ```ts
180
+ function stubTool(): never;
181
+ ```
91
182
  {/* api-reference:end */}
@@ -3,7 +3,7 @@ title: Utilities
3
3
  description: Miscellaneous @assistant-ui/react utilities for custom rendering, composition, and advanced assistant UI behavior.
4
4
  ---
5
5
 
6
- import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList, defineMcpToolkit, defineToolkit, providerTool } from "@/generated/typeDocs";
6
+ import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList } from "@/generated/typeDocs";
7
7
 
8
8
  {/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
9
9
  {/* Do not edit manually. */}
@@ -22,60 +22,15 @@ import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList
22
22
 
23
23
  <ParametersTable {...ChainOfThoughtClient} />
24
24
 
25
- ### defineMcpToolkit
26
-
27
- Defines MCP server tools as a spreadable toolkit fragment.
28
-
29
- <ParametersTable {...defineMcpToolkit} />
30
-
31
- ### defineToolkit
32
-
33
- Authoring helper for a `"use generative"` toolkit. Accepts the permissive
34
- ToolkitDefinition (a `backend` tool may carry its server `execute`)
35
- and types the result as the canonical [Toolkit](/docs/api-reference/tools/toolkits#toolkit).
36
-
37
- It has **no runtime implementation**. A `"use generative"` compiler (e.g.
38
- `@assistant-ui/next` or `@assistant-ui/vite`) strips the `defineToolkit(...)`
39
- wrapper (and its import) per build, so a correctly compiled
40
- `export default defineToolkit({...})` never calls this. If it *does* run, the
41
- module was not compiled by a use-generative loader — e.g. `defineToolkit` used
42
- outside a `"use generative"` file — which would ship a backend `execute` to the
43
- client. So it throws instead of silently leaking.
44
-
45
- <ParametersTable {...defineToolkit} />
46
-
47
- ### DevToolsHooks
48
-
49
- <ParametersTable {...DevToolsHooks} />
50
-
51
- ### hitl
52
-
53
- <Callout type="warn">
54
- <strong>Deprecated.</strong> Use [hitlTool](/docs/api-reference/utilities/miscellaneous#hitltool).
55
- </Callout>
25
+ ### createMessageQueue
56
26
 
57
27
  ```ts
58
- const hitl: typeof hitlTool;
28
+ const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController;
59
29
  ```
60
30
 
61
- ### hitlTool
62
-
63
- Marks a tool as **human-in-the-loop**: the agent pauses and the UI (`render`)
64
- supplies the result instead of code. Use it as the tool's `execute`:
65
-
66
- ```tsx
67
- confirm: { execute: hitlTool(), render: (props) => <Confirm {...props} /> }
68
- ```
69
-
70
- Like [defineToolkit](/docs/api-reference/utilities/miscellaneous#definetoolkit), it has **no runtime implementation**: a
71
- `"use generative"` compiler (e.g. `@assistant-ui/next` or `@assistant-ui/vite`)
72
- detects `execute: hitlTool()`, drops it, and stamps the tool `type: "human"`.
73
- Reaching it at runtime means the module wasn't compiled (used outside a
74
- `"use generative"` file), so it throws.
31
+ ### DevToolsHooks
75
32
 
76
- ```ts
77
- function hitlTool(): never;
78
- ```
33
+ <ParametersTable {...DevToolsHooks} />
79
34
 
80
35
  ### InMemoryThreadList
81
36
 
@@ -87,13 +42,6 @@ function hitlTool(): never;
87
42
  const Interactables: () => ResourceElement<ClientOutput<"interactables">, undefined>;
88
43
  ```
89
44
 
90
- ### providerTool
91
-
92
- Marks a tool as provider-executed. The use-generative compiler converts
93
- `execute: providerTool(...)` into a `type: "provider"` tool entry.
94
-
95
- <ParametersTable {...providerTool} />
96
-
97
45
  ### SingleThreadList
98
46
 
99
47
  A minimal threads scope that wraps a single thread.
@@ -102,18 +50,6 @@ Mounts the provided thread resource element.
102
50
 
103
51
  <ParametersTable {...SingleThreadList} />
104
52
 
105
- ### stubTool
106
-
107
- Marks a generative toolkit entry as a frontend tool whose executor will be
108
- supplied by `useAuiToolOverrides(...)`.
109
-
110
- `stubTool()` has no runtime implementation. It must be used inside a
111
- `"use generative"` toolkit file so the compiler can strip it.
112
-
113
- ```ts
114
- function stubTool(): never;
115
- ```
116
-
117
53
  ### Suggestions
118
54
 
119
55
  ```ts