@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.
- package/.docs/organized/code-examples/waterfall.md +5 -5
- package/.docs/organized/code-examples/with-a2a.md +5 -5
- package/.docs/organized/code-examples/with-ag-ui.md +9 -9
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
- package/.docs/organized/code-examples/with-artifacts.md +37 -31
- package/.docs/organized/code-examples/with-assistant-transport.md +8 -8
- package/.docs/organized/code-examples/with-browser-extension.md +5 -5
- package/.docs/organized/code-examples/with-chain-of-thought.md +68 -47
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +7 -7
- package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +8 -8
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
- package/.docs/organized/code-examples/with-expo.md +33 -24
- package/.docs/organized/code-examples/with-external-store.md +5 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +10 -10
- package/.docs/organized/code-examples/with-generative-ui.md +70 -64
- package/.docs/organized/code-examples/with-google-adk.md +6 -6
- package/.docs/organized/code-examples/with-heat-graph.md +5 -5
- package/.docs/organized/code-examples/with-image-generation.md +7 -7
- package/.docs/organized/code-examples/with-interactables.md +7 -7
- package/.docs/organized/code-examples/with-langchain.md +7 -7
- package/.docs/organized/code-examples/with-langgraph.md +30 -26
- package/.docs/organized/code-examples/with-livekit.md +8 -8
- package/.docs/organized/code-examples/with-mcp.md +8 -8
- package/.docs/organized/code-examples/with-opencode.md +6 -6
- package/.docs/organized/code-examples/with-react-hook-form.md +7 -7
- package/.docs/organized/code-examples/with-react-ink.md +295 -100
- package/.docs/organized/code-examples/with-react-router.md +11 -11
- package/.docs/organized/code-examples/with-resumable-stream.md +8 -8
- package/.docs/organized/code-examples/with-store.md +64 -64
- package/.docs/organized/code-examples/with-tanstack.md +8 -8
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -5
- package/.docs/raw/docs/(docs)/architecture.mdx +52 -41
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +3 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +14 -3
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +94 -3
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +5 -69
- package/.docs/raw/docs/ink/adapters.mdx +23 -1
- package/.docs/raw/docs/ink/hooks.mdx +20 -17
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +14 -8
- package/.docs/raw/docs/react-native/hooks.mdx +25 -17
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +41 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +46 -4
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +54 -12
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +62 -4
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +12 -0
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +9 -9
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +13 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +5 -5
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +3 -3
- package/.docs/raw/docs/tools/backend.mdx +19 -11
- package/.docs/raw/docs/tools/defining-tools.mdx +177 -52
- package/.docs/raw/docs/tools/index.mdx +7 -12
- package/.docs/raw/docs/tools/mcp.mdx +83 -15
- package/.docs/raw/docs/tools/multi-agent.mdx +5 -5
- package/.docs/raw/docs/tools/tool-ui.mdx +27 -27
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +4 -4
- package/.docs/raw/docs/ui/mermaid.mdx +16 -9
- package/.docs/raw/docs/ui/part-grouping.mdx +2 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +16 -0
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/package.json +4 -4
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/assistant-frame.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/make-assistant-visible.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/model-context.mdx +0 -0
- /package/.docs/raw/docs/{(docs)/copilots → copilots}/motivation.mdx +0 -0
- /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
|
|
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
|
-
|
|
348
|
+
useClientList,
|
|
349
349
|
Derived,
|
|
350
|
-
|
|
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
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
363
|
+
const [state, setState] = useState<FooData>(getInitialData);
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
365
|
+
const updateBar = (newBar: string) => {
|
|
366
|
+
setState({ ...state, bar: newBar });
|
|
367
|
+
emit("foo.updated", { id: state.id, newValue: newBar });
|
|
368
|
+
};
|
|
370
369
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
const handleRemove = () => {
|
|
371
|
+
emit("foo.removed", { id: state.id });
|
|
372
|
+
remove();
|
|
373
|
+
};
|
|
375
374
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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
|
-
|
|
408
|
+
const state = useMemo(() => ({ foos: foos.state }), [foos.state]);
|
|
408
409
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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.
|
|
496
|
-
"react": "^19.2.
|
|
497
|
-
"react-dom": "^19.2.
|
|
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.
|
|
504
|
-
"@types/react": "^19.2.
|
|
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
|
-
- **
|
|
526
|
-
- **
|
|
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 =
|
|
590
|
+
function FooListResource({ initialValues }): ClientOutput<"fooList"> {
|
|
591
|
+
const emit = useAssistantEmit();
|
|
592
592
|
|
|
593
|
-
const foos =
|
|
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.
|
|
69
|
-
"@tanstack/react-start": "^1.168.
|
|
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.
|
|
75
|
-
"react": "^19.2.
|
|
76
|
-
"react-dom": "^19.2.
|
|
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.
|
|
85
|
-
"@types/react": "^19.2.
|
|
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.
|
|
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.
|
|
607
|
-
"react": "^19.2.
|
|
608
|
-
"react-dom": "^19.2.
|
|
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.
|
|
616
|
-
"@types/react": "^19.2.
|
|
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
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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?:
|
|
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.
|
|
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:
|
|
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
|
-
}
|
|
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
|
|
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
|
-
###
|
|
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
|
|
28
|
+
const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController;
|
|
59
29
|
```
|
|
60
30
|
|
|
61
|
-
###
|
|
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
|
-
|
|
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
|