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

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 (112) hide show
  1. package/.docs/organized/code-examples/waterfall.md +15 -17
  2. package/.docs/organized/code-examples/with-a2a.md +19 -19
  3. package/.docs/organized/code-examples/with-ag-ui.md +25 -20
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +6 -4
  5. package/.docs/organized/code-examples/with-artifacts.md +34 -28
  6. package/.docs/organized/code-examples/with-assistant-transport.md +59 -47
  7. package/.docs/organized/code-examples/with-browser-extension.md +17 -5
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +376 -78
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +20 -19
  10. package/.docs/organized/code-examples/with-cloud.md +6 -4
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +9 -7
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -16
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +9 -8
  14. package/.docs/organized/code-examples/with-expo.md +23 -17
  15. package/.docs/organized/code-examples/with-external-store.md +4 -2
  16. package/.docs/organized/code-examples/with-ffmpeg.md +317 -280
  17. package/.docs/organized/code-examples/with-generative-ui.md +1018 -214
  18. package/.docs/organized/code-examples/with-google-adk.md +4 -2
  19. package/.docs/organized/code-examples/with-heat-graph.md +8 -6
  20. package/.docs/organized/code-examples/with-image-generation.md +19 -17
  21. package/.docs/organized/code-examples/with-interactables.md +312 -234
  22. package/.docs/organized/code-examples/with-langchain.md +9 -7
  23. package/.docs/organized/code-examples/with-langgraph.md +82 -78
  24. package/.docs/organized/code-examples/with-livekit.md +19 -17
  25. package/.docs/organized/code-examples/with-mcp.md +13 -7
  26. package/.docs/organized/code-examples/with-opencode.md +61 -61
  27. package/.docs/organized/code-examples/with-react-hook-form.md +14 -12
  28. package/.docs/organized/code-examples/with-react-ink.md +2 -2
  29. package/.docs/organized/code-examples/with-react-router.md +11 -9
  30. package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
  31. package/.docs/organized/code-examples/with-store.md +14 -12
  32. package/.docs/organized/code-examples/with-tanstack.md +8 -9
  33. package/.docs/organized/code-examples/with-tap-runtime.md +21 -19
  34. package/.docs/raw/docs/(docs)/architecture.mdx +43 -2
  35. package/.docs/raw/docs/(docs)/cli.mdx +1 -2
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +34 -26
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +32 -26
  38. package/.docs/raw/docs/(docs)/installation.mdx +1 -1
  39. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +5 -1
  40. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +14 -14
  41. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +11 -1
  42. package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +18 -0
  43. package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +33 -0
  44. package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +45 -0
  45. package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +41 -41
  46. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +19 -1
  47. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +122 -122
  48. package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +32 -2
  49. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +6 -0
  50. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +4 -6
  51. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +30 -0
  52. package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +20 -3
  53. package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +8 -8
  54. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +52 -4
  55. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +6 -7
  56. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +58 -46
  57. package/.docs/raw/docs/cloud/ai-sdk.mdx +0 -2
  58. package/.docs/raw/docs/guides/chain-of-thought.mdx +7 -9
  59. package/.docs/raw/docs/guides/context-api.mdx +2 -1
  60. package/.docs/raw/docs/guides/index.mdx +3 -12
  61. package/.docs/raw/docs/guides/mentions.mdx +4 -4
  62. package/.docs/raw/docs/guides/slash-commands.mdx +1 -1
  63. package/.docs/raw/docs/guides/suggestions.mdx +1 -1
  64. package/.docs/raw/docs/ink/hooks.mdx +98 -85
  65. package/.docs/raw/docs/ink/migration.mdx +1 -1
  66. package/.docs/raw/docs/ink/primitives.mdx +2 -2
  67. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +1 -1
  68. package/.docs/raw/docs/integrations/index.mdx +2 -2
  69. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +17 -2
  70. package/.docs/raw/docs/migrations/toolkit-tools.mdx +226 -0
  71. package/.docs/raw/docs/primitives/chain-of-thought.mdx +10 -16
  72. package/.docs/raw/docs/primitives/message.mdx +9 -10
  73. package/.docs/raw/docs/react-native/hooks.mdx +57 -82
  74. package/.docs/raw/docs/react-native/migration.mdx +1 -1
  75. package/.docs/raw/docs/react-native/primitives.mdx +2 -2
  76. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +3 -0
  77. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +122 -1
  78. package/.docs/raw/docs/runtimes/concepts/threads.mdx +7 -1
  79. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +18 -7
  80. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +108 -38
  81. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +2 -2
  82. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
  83. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +64 -50
  84. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +98 -86
  85. package/.docs/raw/docs/tools/backend.mdx +136 -0
  86. package/.docs/raw/docs/tools/defining-tools.mdx +413 -0
  87. package/.docs/raw/docs/tools/dynamic-tools.mdx +110 -0
  88. package/.docs/raw/docs/tools/generative-ui.mdx +214 -0
  89. package/.docs/raw/docs/tools/index.mdx +76 -0
  90. package/.docs/raw/docs/{guides → tools}/interactables.mdx +1 -1
  91. package/.docs/raw/docs/{integrations/tools → tools}/mcp.mdx +77 -50
  92. package/.docs/raw/docs/{guides → tools}/multi-agent.mdx +17 -19
  93. package/.docs/raw/docs/tools/tool-ui.mdx +967 -0
  94. package/.docs/raw/docs/{integrations/tools/react-mcp.mdx → tools/user-managed-mcp.mdx} +3 -3
  95. package/.docs/raw/docs/ui/directive-text.mdx +3 -3
  96. package/.docs/raw/docs/ui/mcp-config.mdx +4 -4
  97. package/.docs/raw/docs/ui/part-grouping.mdx +84 -50
  98. package/.docs/raw/docs/ui/reasoning.mdx +4 -5
  99. package/.docs/raw/docs/ui/tool-group.mdx +5 -6
  100. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -1
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/prepare-docs/code-examples.d.ts.map +1 -1
  103. package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
  104. package/dist/utils/paths.d.ts.map +1 -1
  105. package/package.json +3 -3
  106. package/.docs/organized/code-examples/with-parent-id-grouping.md +0 -596
  107. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -151
  108. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -230
  109. package/.docs/raw/docs/guides/generative-ui.mdx +0 -142
  110. package/.docs/raw/docs/guides/tool-ui.mdx +0 -858
  111. package/.docs/raw/docs/guides/tools.mdx +0 -736
  112. /package/.docs/raw/docs/{guides → tools}/mcp-apps.mdx +0 -0
@@ -3,7 +3,7 @@ title: Tool Rendering
3
3
  description: Register React renderers for assistant-ui tool calls, tool results, and model data parts.
4
4
  ---
5
5
 
6
- import { useAssistantDataUI, useAssistantToolUI } from "@/generated/typeDocs";
6
+ import { McpAppRenderer, McpAppsRemoteHost, getMcpAppFromToolPart, useAssistantDataUI, useAssistantToolUI } from "@/generated/typeDocs";
7
7
 
8
8
  {/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
9
9
  {/* Do not edit manually. */}
@@ -26,6 +26,16 @@ directly for a renderer scope, or prefer [useAssistantDataUI](/docs/api-referenc
26
26
  const DataRenderers: () => ResourceElement<ClientOutput<"dataRenderers">, undefined>;
27
27
  ```
28
28
 
29
+ ### getMcpAppFromToolPart
30
+
31
+ Returns MCP app metadata for a tool-call part that points at a `ui://`
32
+ resource.
33
+
34
+ Returns `undefined` when the part has no MCP app metadata or the metadata
35
+ does not reference an assistant-ui MCP app resource.
36
+
37
+ <ParametersTable {...getMcpAppFromToolPart} />
38
+
29
39
  ### makeAssistantDataUI
30
40
 
31
41
  Creates a React component that registers a named data-part renderer when
@@ -44,6 +54,12 @@ const makeAssistantDataUI: <T = any>(dataUI: AssistantDataUIProps<T>) => Assista
44
54
 
45
55
  ### makeAssistantToolUI
46
56
 
57
+ <Callout type="warn">
58
+ <strong>Deprecated.</strong> Put `render`/`renderText` on the matching toolkit entry, or use
59
+ `MessagePrimitive.Parts` inline tool render overrides for per-message UI.
60
+ See https://assistant-ui.com/docs/migrations/toolkit-tools.
61
+ </Callout>
62
+
47
63
  Creates a React component that registers a tool-call renderer when rendered.
48
64
 
49
65
  Use this to package reusable display components for tools whose definitions
@@ -55,11 +71,38 @@ type AssistantToolUIProps = {
55
71
  toolName: string;
56
72
  /** Component rendered for matching tool-call message parts. */
57
73
  render: ToolCallMessagePartComponent<TArgs, TResult>;
74
+ /**
75
+ * How the UI is presented relative to the chain-of-thought trace. Set
76
+ * `"standalone"` to surface it on its own (e.g. human-in-the-loop or
77
+ * generative UI for a backend/MCP tool). Defaults to `"inline"`.
78
+ */
79
+ display?: "standalone" | "inline";
58
80
  };
59
81
 
60
82
  const makeAssistantToolUI: <TArgs, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => AssistantToolUI;
61
83
  ```
62
84
 
85
+ ### McpAppRenderer
86
+
87
+ Creates a tool-call renderer for MCP Apps embedded in assistant messages.
88
+
89
+ Compose this into the `Tools` resource through its `mcpApp` option. When a
90
+ tool-call part carries `mcp.app` metadata for a `ui://` resource, the
91
+ renderer loads that resource from the configured host and displays it in a
92
+ sandboxed frame.
93
+
94
+ <ParametersTable {...McpAppRenderer} />
95
+
96
+ ### McpAppsRemoteHost
97
+
98
+ Creates the default HTTP host for MCP App widgets.
99
+
100
+ The host POSTs widget requests to the configured route as `{ method,
101
+ params }`, using the method names expected by the assistant-ui MCP Apps
102
+ guide.
103
+
104
+ <ParametersTable {...McpAppsRemoteHost} />
105
+
63
106
  ### useAssistantDataUI
64
107
 
65
108
  Registers a renderer for named `data` message parts while the component is
@@ -69,11 +112,16 @@ mounted.
69
112
 
70
113
  ### useAssistantToolUI
71
114
 
115
+ <Callout type="warn">
116
+ <strong>Deprecated.</strong> Put `render`/`renderText` on the matching toolkit entry, or use
117
+ `MessagePrimitive.Parts` inline tool render overrides for per-message UI.
118
+ See https://assistant-ui.com/docs/migrations/toolkit-tools.
119
+ </Callout>
120
+
72
121
  Registers a tool-call renderer while the component is mounted.
73
122
 
74
- This only affects rendering. Pair it with [useAssistantTool](/docs/api-reference/tools/component-tools#useassistanttool),
75
- [Tools](/docs/api-reference/tools/toolkits#tools), or a backend tool registry to expose the actual tool
76
- definition to the model.
123
+ This only affects rendering. Pair it with [Tools](/docs/api-reference/tools/toolkits#tools) or a backend tool
124
+ registry to expose the actual tool definition to the model.
77
125
 
78
126
  <ParametersTable {...useAssistantToolUI} />
79
127
  {/* api-reference:end */}
@@ -11,7 +11,7 @@ import { ToolDefinition, Tools, tool } from "@/generated/typeDocs";
11
11
  {/* api-manual:start */}
12
12
  A `Toolkit` is a named map of model-facing tool definitions. The `Tools` resource installs a toolkit into an assistant subtree, registering each tool with the model context and each `render` component with the tool-call renderer scope.
13
13
 
14
- Use these APIs when you want a tool's availability to follow your runtime or provider tree rather than the mount state of a specific React component. For tools whose lifetime should follow a specific UI surface, see [Component Tools](/docs/api-reference/tools/component-tools).
14
+ Use these APIs when you want a tool's availability to follow your runtime or provider tree. The older component-scoped registration APIs are deprecated; see [Migrating Tools to Toolkits](/docs/migrations/toolkit-tools).
15
15
  {/* api-manual:end */}
16
16
 
17
17
  {/* api-reference:start */}
@@ -26,7 +26,7 @@ Defines a model tool with its argument schema, execution behavior, and
26
26
  optional model-output conversion.
27
27
 
28
28
  This helper keeps reusable tool definitions type-checked and convenient to
29
- export for a [Toolkit](/docs/api-reference/tools/toolkits#toolkit), [Tools](/docs/api-reference/tools/toolkits#tools), or [useAssistantTool](/docs/api-reference/tools/component-tools#useassistanttool).
29
+ export for a [Toolkit](/docs/api-reference/tools/toolkits#toolkit) registered with [Tools](/docs/api-reference/tools/toolkits#tools).
30
30
  Inference from parameter schemas is currently limited, so provide generic
31
31
  arguments when you need precise args or result types.
32
32
 
@@ -49,11 +49,10 @@ const getWeather = tool<{ city: string }, string>({
49
49
 
50
50
  Tool definition accepted by the React tool registry.
51
51
 
52
- Extends the core tool contract with a render component. Human tools rely on
53
- the renderer to collect input from the user. Frontend tools execute in the
54
- browser and require a UI surface for their progress and result. Backend
55
- tools execute server-side and may omit a renderer. The `render` component is
56
- required for frontend and human tools and optional for backend tools.
52
+ Extends the core tool contract with tool-call display options. Human tools
53
+ rely on `render` to collect input from the user. Frontend tools execute in
54
+ the browser and require either `render` or `renderText` for their progress
55
+ and result. Backend tools execute server-side and may omit a renderer.
57
56
 
58
57
  <ParametersTable {...ToolDefinition} />
59
58
 
@@ -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, ExportedMessageRepository, GenerativeUIRender, GenerativeUIRenderError, InMemoryThreadList, McpAppRenderer, McpAppsRemoteHost, SingleThreadList, getMcpAppFromToolPart } from "@/generated/typeDocs";
6
+ import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList, defineMcpToolkit, defineToolkit, providerTool } from "@/generated/typeDocs";
7
7
 
8
8
  {/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
9
9
  {/* Do not edit manually. */}
@@ -22,77 +22,77 @@ import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, ExportedMessageRep
22
22
 
23
23
  <ParametersTable {...ChainOfThoughtClient} />
24
24
 
25
- ### DevToolsHooks
26
-
27
- <ParametersTable {...DevToolsHooks} />
28
-
29
- ### ExportedMessageRepository
25
+ ### defineMcpToolkit
30
26
 
31
- <ParametersTable {...ExportedMessageRepository} />
27
+ Defines MCP server tools as a spreadable toolkit fragment.
32
28
 
33
- ### GenerativeUIRender
29
+ <ParametersTable {...defineMcpToolkit} />
34
30
 
35
- Internal renderer. Resolves a GenerativeUISpec against the consumer
36
- allowlist. Used by `MessagePrimitive.GenerativeUI` and by
37
- `MessagePrimitive.Parts` when handling a `generative-ui` part.
31
+ ### defineToolkit
38
32
 
39
- <ParametersTable {...GenerativeUIRender} />
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).
40
36
 
41
- ### GenerativeUIRenderError
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.
42
44
 
43
- Thrown when a generative-ui spec references a component name that is not
44
- present in the consumer-provided allowlist. The allowlist is the security
45
- boundary in the same-realm rendering path — there is no fallback by
46
- default. Pass `Fallback` to opt into a soft-fail UX.
45
+ <ParametersTable {...defineToolkit} />
47
46
 
48
- <ParametersTable {...GenerativeUIRenderError} />
49
-
50
- ### getMcpAppFromToolPart
47
+ ### DevToolsHooks
51
48
 
52
- Returns MCP app metadata for a tool-call part that points at a `ui://`
53
- resource.
49
+ <ParametersTable {...DevToolsHooks} />
54
50
 
55
- Returns `undefined` when the part has no MCP app metadata or the metadata
56
- does not reference an assistant-ui MCP app resource.
51
+ ### hitl
57
52
 
58
- <ParametersTable {...getMcpAppFromToolPart} />
53
+ <Callout type="warn">
54
+ <strong>Deprecated.</strong> Use [hitlTool](/docs/api-reference/utilities/miscellaneous#hitltool).
55
+ </Callout>
59
56
 
60
- ### InMemoryThreadList
57
+ ```ts
58
+ const hitl: typeof hitlTool;
59
+ ```
61
60
 
62
- <ParametersTable {...InMemoryThreadList} />
61
+ ### hitlTool
63
62
 
64
- ### Interactables
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
65
 
66
- ```ts
67
- const Interactables: () => ResourceElement<ClientOutput<"interactables">, undefined>;
66
+ ```tsx
67
+ confirm: { execute: hitlTool(), render: (props) => <Confirm {...props} /> }
68
68
  ```
69
69
 
70
- ### makeAssistantVisible
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.
71
75
 
72
76
  ```ts
73
- const makeAssistantVisible: <T extends ComponentType<any>>(Component: T, config?: { clickable?: boolean | undefined; editable?: boolean | undefined; }) => T;
77
+ function hitlTool(): never;
74
78
  ```
75
79
 
76
- ### McpAppRenderer
77
-
78
- Creates a tool-call renderer for MCP Apps embedded in assistant messages.
80
+ ### InMemoryThreadList
79
81
 
80
- Compose this into the `Tools` resource through its `mcpApp` option. When a
81
- tool-call part carries `mcp.app` metadata for a `ui://` resource, the
82
- renderer loads that resource from the configured host and displays it in a
83
- sandboxed frame.
82
+ <ParametersTable {...InMemoryThreadList} />
84
83
 
85
- <ParametersTable {...McpAppRenderer} />
84
+ ### Interactables
86
85
 
87
- ### McpAppsRemoteHost
86
+ ```ts
87
+ const Interactables: () => ResourceElement<ClientOutput<"interactables">, undefined>;
88
+ ```
88
89
 
89
- Creates the default HTTP host for MCP App widgets.
90
+ ### providerTool
90
91
 
91
- The host POSTs widget requests to the configured route as `{ method,
92
- params }`, using the method names expected by the assistant-ui MCP Apps
93
- guide.
92
+ Marks a tool as provider-executed. The use-generative compiler converts
93
+ `execute: providerTool(...)` into a `type: "provider"` tool entry.
94
94
 
95
- <ParametersTable {...McpAppsRemoteHost} />
95
+ <ParametersTable {...providerTool} />
96
96
 
97
97
  ### SingleThreadList
98
98
 
@@ -102,6 +102,18 @@ Mounts the provided thread resource element.
102
102
 
103
103
  <ParametersTable {...SingleThreadList} />
104
104
 
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
+
105
117
  ### Suggestions
106
118
 
107
119
  ```ts
@@ -3,8 +3,6 @@ title: AI SDK
3
3
  description: Add cloud persistence to your existing AI SDK app with a single hook.
4
4
  ---
5
5
 
6
- import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
7
-
8
6
  ## Overview
9
7
 
10
8
  The `@assistant-ui/cloud-ai-sdk` package provides a single hook that adds full message and thread persistence to any [AI SDK](https://sdk.vercel.ai/) application:
@@ -26,6 +26,7 @@ Return the same top-level group for reasoning and tool calls, with nested groups
26
26
  ```tsx
27
27
  import {
28
28
  MessagePrimitive,
29
+ groupPartByType,
29
30
  } from "@assistant-ui/react";
30
31
  import { MarkdownText } from "@/components/assistant-ui/markdown-text";
31
32
  import {
@@ -47,13 +48,10 @@ const AssistantMessage: FC = () => {
47
48
  return (
48
49
  <MessagePrimitive.Root>
49
50
  <MessagePrimitive.GroupedParts
50
- groupBy={(part) => {
51
- if (part.type === "reasoning")
52
- return ["group-chainOfThought", "group-reasoning"];
53
- if (part.type === "tool-call")
54
- return ["group-chainOfThought", "group-tool"];
55
- return null;
56
- }}
51
+ groupBy={groupPartByType({
52
+ reasoning: ["group-chainOfThought", "group-reasoning"],
53
+ "tool-call": ["group-chainOfThought", "group-tool"],
54
+ })}
57
55
  >
58
56
  {({ part, children }) => {
59
57
  switch (part.type) {
@@ -162,5 +160,5 @@ See the complete [with-chain-of-thought example](https://github.com/assistant-ui
162
160
  ## Related Guides
163
161
 
164
162
  - [Reasoning](/docs/ui/reasoning) — reasoning UI primitives for grouped parts
165
- - [Generative UI](/docs/guides/tool-ui) — custom UI for tool calls
166
- - [Tools](/docs/guides/tools) — defining and using tools
163
+ - [Generative UI](/docs/tools/tool-ui) — custom UI for tool calls
164
+ - [Tools](/docs/tools/defining-tools) — defining and using tools
@@ -219,6 +219,7 @@ aui.threads().getState();
219
219
  // ThreadListItem actions
220
220
  aui.threadListItem().switchTo();
221
221
  aui.threadListItem().rename(title);
222
+ aui.threadListItem().updateCustom(custom);
222
223
  aui.threadListItem().archive();
223
224
  aui.threadListItem().unarchive();
224
225
  aui.threadListItem().delete();
@@ -517,7 +518,7 @@ The table below covers the most commonly used actions. For the full catalog, see
517
518
  | Scope | Actions | Use Cases |
518
519
  | -------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
519
520
  | ThreadList | `switchToNewThread()`, `switchToThread(id)`, `reload()`, `getLoadThreadsPromise()`, `item(selector)`, `thread("main")`, `getState()` | Thread navigation, creation, and sync |
520
- | ThreadListItem | `switchTo()`, `rename(title)`, `archive()`, `unarchive()`, `delete()`, `getState()` | Thread management operations |
521
+ | ThreadListItem | `switchTo()`, `rename(title)`, `updateCustom(custom)`, `archive()`, `unarchive()`, `delete()`, `getState()` | Thread management operations |
521
522
  | Thread | `append(message)`, `startRun(config)`, `resumeRun(config)`, `cancelRun()`, `reset()`, `export()`, `import(repository)`, `message(selector)`, `composer()`, `getState()` | Message handling and conversation control |
522
523
  | Message | `reload()`, `speak()`, `stopSpeaking()`, `submitFeedback(feedback)`, `switchToBranch(options)`, `getCopyText()`, `part(selector)`, `attachment(selector)`, `composer()`, `setIsCopied(value)`, `setIsHovering(value)`, `getState()` | Message interactions and regeneration |
523
524
  | Part | `addToolResult(result)`, `resumeToolCall(result)`, `getState()` | Tool call result handling |
@@ -49,20 +49,11 @@ Customize how messages render, are edited, branched, and suggested.
49
49
 
50
50
  ## Tools & Generative UI
51
51
 
52
- Connect tools to the LLM and render their outputs as interactive UI.
52
+ Tool calling and generative UI have their own [Tools](/docs/tools) section — defining toolkits, rendering tool calls, interactables, MCP, and multi-agent UIs.
53
53
 
54
54
  <Cards>
55
- <Card title="Tools" href="/docs/guides/tools">
56
- Define tools with the Toolkit API, stream args, handle cancellation, and integrate with AI SDK / LangGraph / LangChain.
57
- </Card>
58
- <Card title="Tool UI" href="/docs/guides/tool-ui">
59
- Render tool calls and `DataMessagePart` into custom components, with fallback handling.
60
- </Card>
61
- <Card title="Interactables" href="/docs/guides/interactables">
62
- Persisted, schema-validated interactive UI driven by AI state.
63
- </Card>
64
- <Card title="Multi-Agent" href="/docs/guides/multi-agent">
65
- Sub-agent message attribution via `ToolCallMessagePart.messages` and LangGraph subgraph events.
55
+ <Card title="Tools" href="/docs/tools">
56
+ Define toolkits, render tool calls, connect MCP servers, and build generative UI.
66
57
  </Card>
67
58
  </Cards>
68
59
 
@@ -144,7 +144,7 @@ Pass the adapter to `TriggerPopover` and declare a `Directive` sub-primitive to
144
144
 
145
145
  ```tsx
146
146
  import { ComposerPrimitive } from "@assistant-ui/react";
147
- import { unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
147
+ import { unstable_defaultDirectiveFormatter } from "@assistant-ui/react";
148
148
 
149
149
  <ComposerPrimitive.Unstable_TriggerPopoverRoot>
150
150
  <ComposerPrimitive.Root>
@@ -198,7 +198,7 @@ import { unstable_useMentionAdapter } from "@assistant-ui/react";
198
198
 
199
199
  const mention = unstable_useMentionAdapter();
200
200
  // → { adapter, directive } — spread into <ComposerTriggerPopover {...mention} />
201
- // Default: single "Tools" category reading from useAssistantTool registrations
201
+ // Default: single "Tools" category reading from toolkit registrations
202
202
  ```
203
203
 
204
204
  **Custom items only (no tools):**
@@ -302,7 +302,7 @@ When `id` equals `label`, the `{name=…}` attribute is omitted for brevity:
302
302
  Implement `Unstable_DirectiveFormatter` to use a different format:
303
303
 
304
304
  ```ts
305
- import type { Unstable_DirectiveFormatter } from "@assistant-ui/core";
305
+ import type { Unstable_DirectiveFormatter } from "@assistant-ui/react";
306
306
 
307
307
  const slashFormatter: Unstable_DirectiveFormatter = {
308
308
  serialize(item) {
@@ -516,5 +516,5 @@ Mentions and slash commands coexist on the same composer. See [Combining Slash C
516
516
  - [ComposerTriggerPopover UI Component](/docs/ui/composer-trigger-popover) — pre-built shadcn component
517
517
  - [DirectiveText UI Component](/docs/ui/directive-text) — renders mention chips in user messages
518
518
  - [Slash Commands Guide](/docs/guides/slash-commands) — `/` command system built on the same architecture
519
- - [Tools Guide](/docs/guides/tools) — register tools that appear in the mention picker
519
+ - [Tools Guide](/docs/tools/defining-tools) — register tools that appear in the mention picker
520
520
  - [Composer Primitives](/docs/primitives/composer) — underlying composer primitives
@@ -24,7 +24,7 @@ By default `Action` leaves a directive chip in the composer — giving the user
24
24
 
25
25
  ### 1. Define Commands with `unstable_useSlashCommandAdapter`
26
26
 
27
- Declare commands (data + `execute` bundled together, like `useAssistantTool`). The hook returns `{ adapter, action }` — wire both into a single `<TriggerPopover>`:
27
+ Declare commands (data + `execute` bundled together, like a toolkit entry). The hook returns `{ adapter, action }` — wire both into a single `<TriggerPopover>`:
28
28
 
29
29
  ```tsx
30
30
  import {
@@ -308,5 +308,5 @@ The new API provides:
308
308
  ## Related
309
309
 
310
310
  - [Thread Component](/docs/ui/thread) - Main chat interface
311
- - [Tools Guide](/docs/guides/tools) - Configure assistant actions
311
+ - [Tools Guide](/docs/tools/defining-tools) - Configure assistant actions
312
312
  - [Context API](/docs/guides/context-api) - Access assistant state
@@ -60,6 +60,51 @@ useAuiEvent("thread.runStart", (payload) => {
60
60
  });
61
61
  ```
62
62
 
63
+ ### useNotification
64
+
65
+ Ring the terminal bell and emit an OSC desktop notification when the assistant finishes a run, stops with an error, or pauses for human approval.
66
+
67
+ ```tsx
68
+ import { useNotification } from "@assistant-ui/react-ink";
69
+
70
+ useNotification();
71
+ ```
72
+
73
+ Defaults:
74
+
75
+ - `task-complete`: bell + OSC 9
76
+ - `task-incomplete`: bell
77
+ - `needs-input` (assistant message in `requires-action` with `reason: "interrupt"`): bell
78
+
79
+ Pass `false` to suppress one trigger, or a `NotificationHandler` to override it:
80
+
81
+ ```tsx
82
+ useNotification({
83
+ onTaskComplete: { osc: "osc99" },
84
+ onTaskIncomplete: false,
85
+ onNeedsInput: {
86
+ custom: (event) => myLogger.log(event),
87
+ },
88
+ });
89
+ ```
90
+
91
+ | Option | Type | Description |
92
+ |--------|------|-------------|
93
+ | `enabled` | `boolean` | Master switch. Defaults to `true`. |
94
+ | `onTaskComplete` | `NotificationHandler<"task-complete"> \| false` | Fired when the latest assistant message status flips to `complete` after a run was observed. |
95
+ | `onTaskIncomplete` | `NotificationHandler<"task-incomplete"> \| false` | Fired when the latest assistant message status flips to `incomplete` after a run was observed. |
96
+ | `onNeedsInput` | `NotificationHandler<"needs-input"> \| false` | Fired when the latest assistant message enters `requires-action` with `reason: "interrupt"`. Tool-call pauses are skipped. |
97
+
98
+ `NotificationHandler<T>` fields (all optional, any combination):
99
+
100
+ | Field | Type | Description |
101
+ |-------|------|-------------|
102
+ | `bell` | `boolean` | Ring the terminal bell (`\x07`). |
103
+ | `osc` | `boolean \| "osc9" \| "osc99" \| "osc777"` | Send an OSC notification. `true` is equivalent to `"osc9"`. |
104
+ | `custom` | `(event: Extract<NotificationEvent, { type: T }>) => void` | User callback invoked with the event payload narrowed to this handler's type. |
105
+
106
+ Notifications are deduplicated per `thread:message:status:reason` tuple, so passing an inline config object does not produce duplicate fires. `ringBell` and `sendOSCNotification(title, body?, variant?)` are also exported for imperative use. OSC support depends on the terminal emulator.
107
+
63
108
  ## Runtime Hooks
64
109
 
65
110
  ### useLocalRuntime
@@ -108,52 +153,44 @@ const runtime = useRemoteThreadListRuntime({
108
153
 
109
154
  ## Model Context Hooks
110
155
 
111
- ### useAssistantTool
156
+ ### Tools
112
157
 
113
- Register a tool with an optional UI renderer. The tool definition is forwarded to the model, and when the model calls it, the `execute` function runs and the `render` component displays the result.
158
+ Register tools with a toolkit. The tool definition is forwarded to the model, and when the model calls it, the `execute` function runs and the `render` component displays the result.
114
159
 
115
- ```tsx
116
- import { useAssistantTool } from "@assistant-ui/react-ink";
160
+ ```tsx title="weather-toolkit.tsx"
161
+ import type { Toolkit } from "@assistant-ui/react-ink";
117
162
  import { Text } from "ink";
118
163
 
119
- useAssistantTool({
120
- toolName: "get_weather",
121
- description: "Get the current weather for a city",
122
- parameters: {
123
- type: "object",
124
- properties: {
125
- city: { type: "string" },
164
+ export const toolkit = {
165
+ get_weather: {
166
+ type: "frontend",
167
+ description: "Get the current weather for a city",
168
+ parameters: {
169
+ type: "object",
170
+ properties: {
171
+ city: { type: "string" },
172
+ },
173
+ required: ["city"],
126
174
  },
127
- required: ["city"],
128
- },
129
- execute: async ({ city }) => {
130
- const res = await fetch(`https://api.weather.example/${city}`);
131
- return res.json();
175
+ execute: async ({ city }) => {
176
+ const res = await fetch(`https://api.weather.example/${city}`);
177
+ return res.json();
178
+ },
179
+ render: ({ args, result }) => (
180
+ <Text>{args.city}: {result?.temperature}°F</Text>
181
+ ),
132
182
  },
133
- render: ({ args, result }) => (
134
- <Text>{args.city}: {result?.temperature}°F</Text>
135
- ),
136
- });
183
+ } satisfies Toolkit;
137
184
  ```
138
185
 
139
- ### useAssistantToolUI
140
-
141
- Register only a UI renderer for a tool (without tool definition or execute function).
142
-
143
- ```tsx
144
- import { useAssistantToolUI } from "@assistant-ui/react-ink";
145
- import { Text } from "ink";
186
+ ```tsx title="ToolProvider.tsx"
187
+ import { AuiProvider, Tools, useAui } from "@assistant-ui/react-ink";
188
+ import { toolkit } from "./weather-toolkit";
146
189
 
147
- useAssistantToolUI({
148
- toolName: "get_weather",
149
- render: ({ args, result, status }) => (
150
- <Text>
151
- {status?.type === "running"
152
- ? `Loading weather for ${args.city}...`
153
- : `${args.city}: ${result?.temperature}°F`}
154
- </Text>
155
- ),
156
- });
190
+ function ToolProvider({ children }: { children: React.ReactNode }) {
191
+ const aui = useAui({ tools: Tools({ toolkit }) });
192
+ return <AuiProvider value={aui}>{children}</AuiProvider>;
193
+ }
157
194
  ```
158
195
 
159
196
  ### useAssistantInstructions
@@ -181,48 +218,9 @@ useAssistantDataUI({
181
218
  ),
182
219
  });
183
220
  ```
184
- ### makeAssistantTool
185
-
186
- Create a component that registers a tool when mounted.
187
-
188
- ```tsx
189
- import { makeAssistantTool } from "@assistant-ui/react-ink";
190
- import { Text } from "ink";
191
-
192
- const WeatherTool = makeAssistantTool({
193
- toolName: "get_weather",
194
- description: "Get weather",
195
- parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
196
- execute: async ({ city }) => ({ temperature: 72 }),
197
- render: ({ args, result }) => <Text>{args.city}: {result?.temperature}°F</Text>,
198
- });
199
-
200
- // Mount inside AssistantRuntimeProvider to register
201
- <WeatherTool />
202
- ```
203
-
204
- ### makeAssistantToolUI
221
+ ### Dynamic Tool Renderers
205
222
 
206
- Create a component that registers only a tool UI renderer (no tool definition or execute) when mounted.
207
-
208
- ```tsx
209
- import { makeAssistantToolUI } from "@assistant-ui/react-ink";
210
- import { Text } from "ink";
211
-
212
- const WeatherToolUI = makeAssistantToolUI({
213
- toolName: "get_weather",
214
- render: ({ args, result, status }) => (
215
- <Text>
216
- {status?.type === "running"
217
- ? `Loading weather for ${args.city}...`
218
- : `${args.city}: ${result?.temperature}°F`}
219
- </Text>
220
- ),
221
- });
222
-
223
- // Mount inside AssistantRuntimeProvider to register
224
- <WeatherToolUI />
225
- ```
223
+ Use a toolkit with `useInlineRender` when the renderer closes over changing props.
226
224
 
227
225
  ### makeAssistantDataUI
228
226
 
@@ -247,16 +245,31 @@ const WeatherCardUI = makeAssistantDataUI({
247
245
 
248
246
  Wrap a render function component so that it always uses the latest version without re-creating a stable reference. Useful when passing a render prop inline and the function closes over changing state.
249
247
 
250
- ```tsx
251
- import { useInlineRender } from "@assistant-ui/react-ink";
252
-
253
- const render = useInlineRender(({ args, result }) => (
254
- <Text>{args.city}: {result?.temperature}°F</Text>
255
- ));
248
+ ```tsx title="weather-toolkit.tsx"
249
+ import { type Toolkit, useInlineRender } from "@assistant-ui/react-ink";
250
+ import { Text } from "ink";
251
+ import { useMemo } from "react";
256
252
 
257
- useAssistantToolUI({ toolName: "get_weather", render });
253
+ export function useWeatherToolkit() {
254
+ const render = useInlineRender(({ args, result }) => (
255
+ <Text>{args.city}: {result?.temperature}°F</Text>
256
+ ));
257
+
258
+ return useMemo(
259
+ () =>
260
+ ({
261
+ get_weather: {
262
+ type: "backend",
263
+ render,
264
+ },
265
+ }) satisfies Toolkit,
266
+ [render],
267
+ );
268
+ }
258
269
  ```
259
270
 
271
+ Import the toolkit hook, pass its result to `useAui({ tools: Tools({ toolkit }) })`, and provide the returned `aui` with `AuiProvider`, as shown in the [Tools](#tools) section above.
272
+
260
273
  ## Runtime Providers
261
274
 
262
275
  ### AssistantRuntimeProvider
@@ -9,7 +9,7 @@ If you already have an assistant-ui web app, most of your code transfers directl
9
9
 
10
10
  - **Runtime setup** — `useLocalRuntime`, `ChatModelAdapter`, and all runtime options work identically.
11
11
  - **AI SDK integration** — `@assistant-ui/react-ai-sdk` works with React Ink. Your runtime setup transfers directly.
12
- - **Tool definitions** — `useAssistantTool`, `makeAssistantTool`, and tool UI renderers use the same API.
12
+ - **Tool definitions** — `Tools({ toolkit })` and toolkit renderers use the same API.
13
13
  - **State hooks** — `useAuiState`, `useAui`, and selector patterns are the same.
14
14
  - **Backend code** — Your API routes, streaming endpoints, and server-side logic need zero changes.
15
15