@assistant-ui/mcp-docs-server 0.1.31 → 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.
- package/.docs/organized/code-examples/waterfall.md +23 -25
- package/.docs/organized/code-examples/with-a2a.md +28 -28
- package/.docs/organized/code-examples/with-ag-ui.md +35 -30
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +16 -14
- package/.docs/organized/code-examples/with-artifacts.md +44 -38
- package/.docs/organized/code-examples/with-assistant-transport.md +68 -56
- package/.docs/organized/code-examples/with-browser-extension.md +357 -0
- package/.docs/organized/code-examples/with-chain-of-thought.md +425 -90
- package/.docs/organized/code-examples/with-cloud-standalone.md +30 -29
- package/.docs/organized/code-examples/with-cloud.md +16 -14
- package/.docs/organized/code-examples/with-custom-thread-list.md +19 -17
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +29 -26
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +20 -18
- package/.docs/organized/code-examples/with-expo.md +37 -31
- package/.docs/organized/code-examples/with-external-store.md +13 -11
- package/.docs/organized/code-examples/with-ffmpeg.md +327 -290
- package/.docs/organized/code-examples/with-generative-ui.md +1195 -194
- package/.docs/organized/code-examples/with-google-adk.md +13 -11
- package/.docs/organized/code-examples/with-heat-graph.md +16 -14
- package/.docs/organized/code-examples/with-image-generation.md +456 -0
- package/.docs/organized/code-examples/with-interactables.md +322 -244
- package/.docs/organized/code-examples/with-langchain.md +18 -16
- package/.docs/organized/code-examples/with-langgraph.md +95 -88
- package/.docs/organized/code-examples/with-livekit.md +30 -27
- package/.docs/organized/code-examples/with-mcp.md +754 -0
- package/.docs/organized/code-examples/with-opencode.md +70 -70
- package/.docs/organized/code-examples/with-react-hook-form.md +24 -22
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +20 -18
- package/.docs/organized/code-examples/with-resumable-stream.md +661 -0
- package/.docs/organized/code-examples/with-store.md +22 -20
- package/.docs/organized/code-examples/with-tanstack.md +18 -19
- package/.docs/organized/code-examples/with-tap-runtime.md +31 -28
- package/.docs/raw/docs/(docs)/architecture.mdx +43 -2
- package/.docs/raw/docs/(docs)/cli.mdx +2 -2
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +34 -26
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +32 -26
- package/.docs/raw/docs/(docs)/index.mdx +2 -2
- package/.docs/raw/docs/(docs)/installation.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +26 -24
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +20 -12
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +41 -16
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +12 -23
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +11 -9
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +46 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +18 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +45 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +31 -52
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +15 -28
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +64 -18
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +434 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +11 -12
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +109 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +58 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +109 -132
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +39 -20
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +29 -24
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +202 -588
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +77 -96
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -349
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -47
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +85 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +127 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +91 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +143 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
- package/.docs/raw/docs/cloud/ai-sdk.mdx +1 -3
- package/.docs/raw/docs/cloud/index.mdx +2 -2
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chain-of-thought.mdx +12 -14
- package/.docs/raw/docs/guides/context-api.mdx +6 -5
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/editing.mdx +1 -1
- package/.docs/raw/docs/guides/image-generation.mdx +74 -0
- package/.docs/raw/docs/guides/index.mdx +5 -14
- package/.docs/raw/docs/guides/latex.mdx +2 -2
- package/.docs/raw/docs/guides/mentions.mdx +6 -6
- package/.docs/raw/docs/guides/message-timing.mdx +38 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
- package/.docs/raw/docs/guides/slash-commands.mdx +2 -2
- package/.docs/raw/docs/guides/speech.mdx +2 -2
- package/.docs/raw/docs/guides/suggestions.mdx +89 -5
- package/.docs/raw/docs/guides/voice.mdx +2 -2
- package/.docs/raw/docs/ink/adapters.mdx +37 -1
- package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
- package/.docs/raw/docs/ink/hooks.mdx +98 -85
- package/.docs/raw/docs/ink/index.mdx +10 -11
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +350 -9
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/clerk.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/gateways/index.mdx +9 -4
- package/.docs/raw/docs/integrations/index.mdx +17 -5
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +8 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +8 -4
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +17 -2
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +226 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +10 -16
- package/.docs/raw/docs/primitives/composer.mdx +53 -0
- package/.docs/raw/docs/primitives/index.mdx +2 -2
- package/.docs/raw/docs/primitives/message.mdx +9 -10
- package/.docs/raw/docs/primitives/suggestion.mdx +9 -0
- package/.docs/raw/docs/react-native/hooks.mdx +57 -82
- package/.docs/raw/docs/react-native/index.mdx +4 -4
- package/.docs/raw/docs/react-native/migration.mdx +1 -1
- package/.docs/raw/docs/react-native/primitives.mdx +2 -2
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +7 -4
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +32 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +7 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +129 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +7 -1
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +27 -2
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -1
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +18 -7
- package/.docs/raw/docs/runtimes/custom/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +108 -38
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +64 -50
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +98 -86
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +12 -5
- package/.docs/raw/docs/tools/backend.mdx +136 -0
- package/.docs/raw/docs/tools/defining-tools.mdx +413 -0
- package/.docs/raw/docs/tools/dynamic-tools.mdx +110 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +214 -0
- package/.docs/raw/docs/tools/index.mdx +76 -0
- package/.docs/raw/docs/{guides → tools}/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +231 -0
- package/.docs/raw/docs/{integrations/tools → tools}/mcp.mdx +77 -50
- package/.docs/raw/docs/{guides → tools}/multi-agent.mdx +19 -21
- package/.docs/raw/docs/tools/tool-ui.mdx +967 -0
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +337 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +11 -1
- package/.docs/raw/docs/ui/directive-text.mdx +3 -3
- package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +84 -50
- package/.docs/raw/docs/ui/reasoning.mdx +4 -5
- package/.docs/raw/docs/ui/sources.mdx +17 -0
- package/.docs/raw/docs/ui/streamdown.mdx +34 -2
- package/.docs/raw/docs/ui/thread-list.mdx +2 -2
- package/.docs/raw/docs/ui/thread.mdx +2 -2
- package/.docs/raw/docs/ui/tool-group.mdx +5 -6
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -1
- package/README.md +14 -72
- package/dist/constants.d.ts +12 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -9
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts +4 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js +109 -121
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts +4 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.js +45 -42
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -2
- package/dist/prepare-docs/prepare.js +17 -17
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -3
- package/dist/stdio.js +6 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.d.ts +20 -15
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +140 -161
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +20 -15
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +74 -86
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.d.ts +5 -2
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +21 -28
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +17 -17
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-format.d.ts +8 -5
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +9 -9
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts +8 -6
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/mdx.js +22 -22
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +66 -76
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/security.d.ts +4 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +19 -40
- package/dist/utils/security.js.map +1 -1
- package/package.json +5 -5
- package/.docs/organized/code-examples/with-parent-id-grouping.md +0 -596
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -151
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -230
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +0 -41
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
- package/.docs/raw/docs/guides/tool-ui.mdx +0 -858
- package/.docs/raw/docs/guides/tools.mdx +0 -675
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
- /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-14.mdx +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: makeAssistantToolUI
|
|
3
|
-
description: Register custom UI components to render tool executions and their status.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<Callout type="info">
|
|
8
|
-
Prefer pre-registering tool UIs via the [`Tools()` API](/docs/guides/tools)
|
|
9
|
-
(set `render` on the tool definition) or by mounting `makeAssistantToolUI`
|
|
10
|
-
near the root of your tree. A tool UI that is only registered while a
|
|
11
|
-
specific component is mounted will not appear when chat history is replayed
|
|
12
|
-
or during server-side rendering, since the registering component may not be
|
|
13
|
-
mounted at that point. Tool execution can still be registered dynamically
|
|
14
|
-
via [`makeAssistantTool`](/docs/copilots/make-assistant-tool); this caveat
|
|
15
|
-
applies specifically to the UI render function.
|
|
16
|
-
</Callout>
|
|
17
|
-
|
|
18
|
-
The `makeAssistantToolUI` utility is used to register a tool UI component with the Assistant.
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { makeAssistantToolUI } from "@assistant-ui/react";
|
|
24
|
-
|
|
25
|
-
const MyToolUI = makeAssistantToolUI({
|
|
26
|
-
toolName: "myTool",
|
|
27
|
-
render: ({ args, result, status }) => {
|
|
28
|
-
// render your tool UI here
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## API
|
|
34
|
-
|
|
35
|
-
### Parameters
|
|
36
|
-
|
|
37
|
-
<ParametersTable
|
|
38
|
-
type="AssistantToolUIProps<TArgs, TResult>"
|
|
39
|
-
parameters={[
|
|
40
|
-
{
|
|
41
|
-
name: "toolName",
|
|
42
|
-
type: "string",
|
|
43
|
-
description:
|
|
44
|
-
"The name of the tool. This must match the name of the tool defined in the assistant.",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "render",
|
|
48
|
-
type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
|
|
49
|
-
description:
|
|
50
|
-
"A React component that renders the tool UI. Receives the following props:",
|
|
51
|
-
required: true,
|
|
52
|
-
children: [
|
|
53
|
-
{
|
|
54
|
-
type: "ToolCallMessagePartProps<TArgs, TResult>",
|
|
55
|
-
parameters: [
|
|
56
|
-
{
|
|
57
|
-
name: "type",
|
|
58
|
-
type: '"tool-call"',
|
|
59
|
-
description: "The message part type",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "toolCallId",
|
|
63
|
-
type: "string",
|
|
64
|
-
description: "Unique identifier for this tool call",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: "toolName",
|
|
68
|
-
type: "string",
|
|
69
|
-
description: "The name of the tool being called",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "args",
|
|
73
|
-
type: "TArgs",
|
|
74
|
-
description: "The arguments passed to the tool",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "argsText",
|
|
78
|
-
type: "string",
|
|
79
|
-
description: "String representation of the arguments",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "result",
|
|
83
|
-
type: "TResult | undefined",
|
|
84
|
-
description: "The result of the tool execution (if complete)",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "isError",
|
|
88
|
-
type: "boolean | undefined",
|
|
89
|
-
description: "Whether the result is an error",
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: "status",
|
|
93
|
-
type: "ToolCallMessagePartStatus",
|
|
94
|
-
description:
|
|
95
|
-
'The execution status object with a type property: "running", "complete", "incomplete", or "requires-action"',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "addResult",
|
|
99
|
-
type: "(result: TResult | ToolResponse<TResult>) => void",
|
|
100
|
-
description:
|
|
101
|
-
"Function to add a result (useful for human-in-the-loop tools)",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "artifact",
|
|
105
|
-
type: "unknown",
|
|
106
|
-
description:
|
|
107
|
-
"Optional artifact data associated with the tool call",
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
]}
|
|
114
|
-
/>
|
|
115
|
-
|
|
116
|
-
### Returns
|
|
117
|
-
|
|
118
|
-
A React functional component that should be included in your component tree. This component doesn't render anything itself, but it registers the tool UI with the Assistant.
|
|
119
|
-
|
|
120
|
-
## Example
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
import { makeAssistantToolUI } from "@assistant-ui/react";
|
|
124
|
-
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
125
|
-
|
|
126
|
-
const GetWeatherUI = makeAssistantToolUI({
|
|
127
|
-
toolName: "get_weather",
|
|
128
|
-
render: ({ args, result, status }) => {
|
|
129
|
-
if (status.type === "requires-action")
|
|
130
|
-
return <p>Getting weather for {args.location}...</p>;
|
|
131
|
-
if (status.type === "running") return <p>Loading...</p>;
|
|
132
|
-
if (status.type === "incomplete" && status.reason === "error")
|
|
133
|
-
return <p>Error getting weather.</p>;
|
|
134
|
-
if (status.type === "complete")
|
|
135
|
-
return <p>The weather is {result.weather}.</p>;
|
|
136
|
-
return null;
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
function App() {
|
|
141
|
-
const runtime = /* your runtime setup */;
|
|
142
|
-
return (
|
|
143
|
-
<AssistantRuntimeProvider runtime={runtime}>
|
|
144
|
-
{/* ...your other components */}
|
|
145
|
-
<GetWeatherUI />
|
|
146
|
-
</AssistantRuntimeProvider>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
This example shows how to create a simple UI for a `get_weather` tool. The UI will display different messages depending on the status of the tool execution.
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: makeAssistantTool
|
|
3
|
-
description: Create React components that provide reusable tools to the assistant.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<Callout type="info">
|
|
8
|
-
For most apps, the [`Tools()` API](/docs/guides/tools) is an easier starting
|
|
9
|
-
point: tool definitions live in a toolkit object rather than the component
|
|
10
|
-
tree. `makeAssistantTool` is fully supported and remains a good fit when a
|
|
11
|
-
tool's availability is tied to a component being mounted, for example a
|
|
12
|
-
product-specific tool that should only be exposed while that product's UI is
|
|
13
|
-
on screen (the [intelligent components](/docs/copilots/motivation) pattern).
|
|
14
|
-
</Callout>
|
|
15
|
-
|
|
16
|
-
`makeAssistantTool` creates a React component that provides a tool to the assistant. This is useful for defining reusable tools that can be composed into your application.
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import { makeAssistantTool, tool } from "@assistant-ui/react";
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
|
|
24
|
-
// Define the tool using the tool() helper
|
|
25
|
-
const submitForm = tool({
|
|
26
|
-
parameters: z.object({
|
|
27
|
-
email: z.string().email(),
|
|
28
|
-
name: z.string(),
|
|
29
|
-
}),
|
|
30
|
-
execute: async ({ email, name }) => {
|
|
31
|
-
// Implementation
|
|
32
|
-
return { success: true };
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Create a tool component
|
|
37
|
-
const SubmitFormTool = makeAssistantTool({
|
|
38
|
-
...submitForm,
|
|
39
|
-
toolName: "submitForm",
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Use in your component
|
|
43
|
-
function Form() {
|
|
44
|
-
return (
|
|
45
|
-
<div>
|
|
46
|
-
<form>{/* form fields */}</form>
|
|
47
|
-
<SubmitFormTool />
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## API Reference
|
|
54
|
-
|
|
55
|
-
### Parameters
|
|
56
|
-
|
|
57
|
-
<ParametersTable
|
|
58
|
-
type="AssistantToolProps<TArgs, TResult>"
|
|
59
|
-
parameters={[
|
|
60
|
-
{
|
|
61
|
-
name: "toolName",
|
|
62
|
-
type: "string",
|
|
63
|
-
description: "The unique identifier for the tool",
|
|
64
|
-
required: true,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: "parameters",
|
|
68
|
-
type: "StandardSchemaV1<TArgs> | JSONSchema7",
|
|
69
|
-
description:
|
|
70
|
-
"Schema defining the tool's parameters (typically a Zod schema)",
|
|
71
|
-
required: true,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "execute",
|
|
75
|
-
type: "(args: TArgs, context: ToolExecutionContext) => TResult | Promise<TResult>",
|
|
76
|
-
description:
|
|
77
|
-
"Function that implements the tool's behavior (required for frontend tools)",
|
|
78
|
-
required: true,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "description",
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "Optional description of the tool's purpose",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "render",
|
|
87
|
-
type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
|
|
88
|
-
description:
|
|
89
|
-
"Optional custom UI component for rendering the tool execution. Receives the following props:",
|
|
90
|
-
children: [
|
|
91
|
-
{
|
|
92
|
-
type: "ToolCallMessagePartProps<TArgs, TResult>",
|
|
93
|
-
parameters: [
|
|
94
|
-
{
|
|
95
|
-
name: "type",
|
|
96
|
-
type: '"tool-call"',
|
|
97
|
-
description: "The message part type",
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "toolCallId",
|
|
101
|
-
type: "string",
|
|
102
|
-
description: "Unique identifier for this tool call",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "toolName",
|
|
106
|
-
type: "string",
|
|
107
|
-
description: "The name of the tool being called",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "args",
|
|
111
|
-
type: "TArgs",
|
|
112
|
-
description: "The arguments passed to the tool",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "argsText",
|
|
116
|
-
type: "string",
|
|
117
|
-
description: "String representation of the arguments",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "result",
|
|
121
|
-
type: "TResult | undefined",
|
|
122
|
-
description: "The result of the tool execution (if complete)",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "isError",
|
|
126
|
-
type: "boolean | undefined",
|
|
127
|
-
description: "Whether the result is an error",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: "status",
|
|
131
|
-
type: "ToolCallMessagePartStatus",
|
|
132
|
-
description:
|
|
133
|
-
'The execution status object with a type property: "running", "complete", "incomplete", or "requires-action"',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "addResult",
|
|
137
|
-
type: "(result: TResult | ToolResponse<TResult>) => void",
|
|
138
|
-
description:
|
|
139
|
-
"Function to add a result (useful for human-in-the-loop tools)",
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "artifact",
|
|
143
|
-
type: "unknown",
|
|
144
|
-
description:
|
|
145
|
-
"Optional artifact data associated with the tool call",
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
]}
|
|
152
|
-
/>
|
|
153
|
-
|
|
154
|
-
### Returns
|
|
155
|
-
|
|
156
|
-
Returns a React component that:
|
|
157
|
-
|
|
158
|
-
- Provides the tool to the assistant when mounted
|
|
159
|
-
- Automatically removes the tool when unmounted
|
|
160
|
-
- Renders nothing in the DOM (returns null)
|
|
161
|
-
|
|
162
|
-
## Example with Multiple Tools
|
|
163
|
-
|
|
164
|
-
```tsx
|
|
165
|
-
import { makeAssistantTool, tool } from "@assistant-ui/react";
|
|
166
|
-
import { z } from "zod";
|
|
167
|
-
|
|
168
|
-
// Define tools
|
|
169
|
-
const validateEmail = tool({
|
|
170
|
-
parameters: z.object({
|
|
171
|
-
email: z.string(),
|
|
172
|
-
}),
|
|
173
|
-
execute: ({ email }) => {
|
|
174
|
-
const isValid = email.includes("@");
|
|
175
|
-
return { isValid, reason: isValid ? "Valid email" : "Missing @" };
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const sendEmail = tool({
|
|
180
|
-
parameters: z.object({
|
|
181
|
-
to: z.string().email(),
|
|
182
|
-
subject: z.string(),
|
|
183
|
-
body: z.string(),
|
|
184
|
-
}),
|
|
185
|
-
execute: async (params) => {
|
|
186
|
-
// Tool logic
|
|
187
|
-
return { sent: true };
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
// Create tool components
|
|
192
|
-
const EmailValidator = makeAssistantTool({
|
|
193
|
-
...validateEmail,
|
|
194
|
-
toolName: "validateEmail",
|
|
195
|
-
});
|
|
196
|
-
const EmailSender = makeAssistantTool({
|
|
197
|
-
...sendEmail,
|
|
198
|
-
toolName: "sendEmail",
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// Use together
|
|
202
|
-
function EmailForm() {
|
|
203
|
-
return (
|
|
204
|
-
<div>
|
|
205
|
-
<form>{/* form fields */}</form>
|
|
206
|
-
<EmailValidator />
|
|
207
|
-
<EmailSender />
|
|
208
|
-
</div>
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Best Practices
|
|
214
|
-
|
|
215
|
-
1. **Parameter Validation**
|
|
216
|
-
|
|
217
|
-
- Always use Zod schemas to define parameters
|
|
218
|
-
- Be specific about parameter types and constraints
|
|
219
|
-
- Add helpful error messages to schema validations
|
|
220
|
-
|
|
221
|
-
2. **Error Handling**
|
|
222
|
-
|
|
223
|
-
- Return meaningful error messages
|
|
224
|
-
- Consider returning partial results when possible
|
|
225
|
-
- Handle async errors appropriately
|
|
226
|
-
|
|
227
|
-
3. **Composition**
|
|
228
|
-
- Break complex tools into smaller, focused ones
|
|
229
|
-
- Consider tool dependencies and interactions
|
|
230
|
-
- Use multiple tools together for complex functionality
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Feedback and Speech Adapters
|
|
3
|
-
description: Capture message feedback and connect speech or dictation.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Feedback
|
|
7
|
-
|
|
8
|
-
`FeedbackAdapter` receives message feedback submitted through action primitives or runtime actions.
|
|
9
|
-
|
|
10
|
-
```tsx
|
|
11
|
-
const runtime = useLocalRuntime(chatModelAdapter, {
|
|
12
|
-
adapters: {
|
|
13
|
-
feedback: {
|
|
14
|
-
submit: async ({ message, type }) => {
|
|
15
|
-
await fetch("/api/feedback", {
|
|
16
|
-
method: "POST",
|
|
17
|
-
body: JSON.stringify({ messageId: message.id, type }),
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Speech
|
|
26
|
-
|
|
27
|
-
`SpeechSynthesisAdapter` controls text-to-speech playback. `WebSpeechSynthesisAdapter` provides a browser implementation.
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { WebSpeechSynthesisAdapter } from "@assistant-ui/react";
|
|
31
|
-
|
|
32
|
-
const runtime = useLocalRuntime(chatModelAdapter, {
|
|
33
|
-
adapters: {
|
|
34
|
-
speech: new WebSpeechSynthesisAdapter(),
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Dictation and Suggestions
|
|
40
|
-
|
|
41
|
-
Runtime adapters can also provide dictation and suggestion behavior. Dictation powers composer voice input; suggestions power prompt suggestions rendered by thread and suggestion primitives.
|
package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: <TextMessagePartProvider />
|
|
3
|
-
description: Context provider for reusing text components outside of message content.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The `TextMessagePartProvider` provides data and APIs for `TextMessagePart` components.
|
|
7
|
-
|
|
8
|
-
This is useful if you want to reuse the same `Text` component outside of a message text, e.g. with the `@assistant-ui/react-markdown` package.
|
|
9
|
-
|
|
10
|
-
```tsx
|
|
11
|
-
import { TextMessagePartProvider } from "@assistant-ui/react";
|
|
12
|
-
|
|
13
|
-
const MyApp = () => {
|
|
14
|
-
return (
|
|
15
|
-
<TextMessagePartProvider text={"Hello!"}>
|
|
16
|
-
<MyMarkdownText />
|
|
17
|
-
</TextMessagePartProvider>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
#### Properties
|
|
23
|
-
|
|
24
|
-
<ParametersTable
|
|
25
|
-
type="TextMessagePartProviderProps"
|
|
26
|
-
parameters={[
|
|
27
|
-
{
|
|
28
|
-
name: "text",
|
|
29
|
-
type: "string",
|
|
30
|
-
required: true,
|
|
31
|
-
description: "The text content to provide to child components.",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "isRunning",
|
|
35
|
-
type: "boolean",
|
|
36
|
-
required: false,
|
|
37
|
-
description: "Whether the text is still being streamed. Defaults to false.",
|
|
38
|
-
},
|
|
39
|
-
]}
|
|
40
|
-
/>
|