@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
|
@@ -562,23 +562,23 @@ export default withAui(nextConfig);
|
|
|
562
562
|
"version": "0.0.0",
|
|
563
563
|
"type": "module",
|
|
564
564
|
"dependencies": {
|
|
565
|
-
"@ai-sdk/openai": "^3.0.
|
|
566
|
-
"@ai-sdk/react": "^3.0.
|
|
565
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
566
|
+
"@ai-sdk/react": "^3.0.199",
|
|
567
567
|
"@assistant-ui/react": "workspace:^",
|
|
568
568
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
569
569
|
"@assistant-ui/react-markdown": "workspace:^",
|
|
570
570
|
"@assistant-ui/ui": "workspace:*",
|
|
571
571
|
"@elevenlabs/client": "^1.9.0",
|
|
572
572
|
"@tailwindcss/postcss": "^4.3.0",
|
|
573
|
-
"ai": "^6.0.
|
|
573
|
+
"ai": "^6.0.197",
|
|
574
574
|
"class-variance-authority": "^0.7.1",
|
|
575
575
|
"clsx": "^2.1.1",
|
|
576
576
|
"lucide-react": "^1.17.0",
|
|
577
577
|
"motion": "^12.40.0",
|
|
578
|
-
"next": "^16.2.
|
|
578
|
+
"next": "^16.2.7",
|
|
579
579
|
"postcss": "^8.5.15",
|
|
580
|
-
"react": "^19.2.
|
|
581
|
-
"react-dom": "^19.2.
|
|
580
|
+
"react": "^19.2.7",
|
|
581
|
+
"react-dom": "^19.2.7",
|
|
582
582
|
"tailwind-merge": "^3.6.0",
|
|
583
583
|
"tailwindcss": "^4.3.0",
|
|
584
584
|
"zod": "^4.4.3"
|
|
@@ -586,8 +586,8 @@ export default withAui(nextConfig);
|
|
|
586
586
|
"devDependencies": {
|
|
587
587
|
"@assistant-ui/next": "workspace:*",
|
|
588
588
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
589
|
-
"@types/node": "^25.9.
|
|
590
|
-
"@types/react": "^19.2.
|
|
589
|
+
"@types/node": "^25.9.2",
|
|
590
|
+
"@types/react": "^19.2.17",
|
|
591
591
|
"@types/react-dom": "^19.2.3",
|
|
592
592
|
"tw-animate-css": "^1.4.0",
|
|
593
593
|
"typescript": "^6.0.3"
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
} from "@assistant-ui/react-native";
|
|
99
99
|
import { useAppRuntime } from "@/hooks/use-app-runtime";
|
|
100
100
|
import { ThreadListDrawer } from "@/components/thread-list/ThreadListDrawer";
|
|
101
|
-
import
|
|
101
|
+
import toolkit from "@/components/assistant-ui/tools";
|
|
102
102
|
|
|
103
103
|
function NewChatButton() {
|
|
104
104
|
const aui = useAui();
|
|
@@ -146,7 +146,7 @@ export default function RootLayout() {
|
|
|
146
146
|
const [fontsLoaded] = useFonts(Ionicons.font);
|
|
147
147
|
const runtime = useAppRuntime();
|
|
148
148
|
const aui = useAui({
|
|
149
|
-
tools: Tools({ toolkit
|
|
149
|
+
tools: Tools({ toolkit }),
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
if (!fontsLoaded) return null;
|
|
@@ -923,10 +923,12 @@ const styles = StyleSheet.create({
|
|
|
923
923
|
## components/assistant-ui/tools.tsx
|
|
924
924
|
|
|
925
925
|
```tsx
|
|
926
|
+
"use generative";
|
|
927
|
+
|
|
926
928
|
import { View, Text, StyleSheet, useColorScheme } from "react-native";
|
|
927
|
-
import
|
|
928
|
-
|
|
929
|
-
ToolCallMessagePartProps,
|
|
929
|
+
import {
|
|
930
|
+
defineToolkit,
|
|
931
|
+
type ToolCallMessagePartProps,
|
|
930
932
|
} from "@assistant-ui/react-native";
|
|
931
933
|
import { z } from "zod";
|
|
932
934
|
|
|
@@ -1257,14 +1259,16 @@ function WeatherToolUI(
|
|
|
1257
1259
|
|
|
1258
1260
|
// Toolkit definition
|
|
1259
1261
|
|
|
1260
|
-
export
|
|
1262
|
+
export default defineToolkit({
|
|
1261
1263
|
geocode_location: {
|
|
1262
1264
|
description: "Geocode a location using Open-Meteo's geocoding API",
|
|
1263
1265
|
parameters: z.object({
|
|
1264
1266
|
query: z.string(),
|
|
1265
1267
|
}),
|
|
1266
|
-
execute: async (args: { query: string }) =>
|
|
1267
|
-
|
|
1268
|
+
execute: async (args: { query: string }) => {
|
|
1269
|
+
"use client";
|
|
1270
|
+
return geocodeLocationWithOpenMeteo(args.query);
|
|
1271
|
+
},
|
|
1268
1272
|
render: GeocodeToolUI,
|
|
1269
1273
|
},
|
|
1270
1274
|
weather_search: {
|
|
@@ -1279,10 +1283,13 @@ export const expoToolkit: Toolkit = {
|
|
|
1279
1283
|
query: string;
|
|
1280
1284
|
longitude: number;
|
|
1281
1285
|
latitude: number;
|
|
1282
|
-
}) =>
|
|
1286
|
+
}) => {
|
|
1287
|
+
"use client";
|
|
1288
|
+
return fetchWeatherFromOpenMeteo(args);
|
|
1289
|
+
},
|
|
1283
1290
|
render: WeatherToolUI,
|
|
1284
1291
|
},
|
|
1285
|
-
};
|
|
1292
|
+
});
|
|
1286
1293
|
|
|
1287
1294
|
const styles = StyleSheet.create({
|
|
1288
1295
|
card: {
|
|
@@ -1888,6 +1895,7 @@ export function useThemeColor(
|
|
|
1888
1895
|
|
|
1889
1896
|
```javascript
|
|
1890
1897
|
const { getDefaultConfig } = require("expo/metro-config");
|
|
1898
|
+
const { withAui } = require("@assistant-ui/metro");
|
|
1891
1899
|
const path = require("node:path");
|
|
1892
1900
|
|
|
1893
1901
|
const projectRoot = __dirname;
|
|
@@ -1928,7 +1936,7 @@ config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
|
1928
1936
|
return context.resolveRequest(context, moduleName, platform);
|
|
1929
1937
|
};
|
|
1930
1938
|
|
|
1931
|
-
module.exports = config;
|
|
1939
|
+
module.exports = withAui(config);
|
|
1932
1940
|
|
|
1933
1941
|
```
|
|
1934
1942
|
|
|
@@ -1947,38 +1955,39 @@ module.exports = config;
|
|
|
1947
1955
|
"export:web": "expo export --platform web && node scripts/flatten-assets.mjs"
|
|
1948
1956
|
},
|
|
1949
1957
|
"dependencies": {
|
|
1950
|
-
"@ai-sdk/openai": "^3.0.
|
|
1951
|
-
"@ai-sdk/react": "^3.0.
|
|
1958
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
1959
|
+
"@ai-sdk/react": "^3.0.199",
|
|
1952
1960
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1953
1961
|
"@assistant-ui/react-native": "workspace:*",
|
|
1954
1962
|
"@expo/vector-icons": "^15.1.1",
|
|
1955
1963
|
"@react-navigation/drawer": "7.9.4",
|
|
1956
1964
|
"@react-navigation/native": "7.1.33",
|
|
1957
|
-
"ai": "^6.0.
|
|
1958
|
-
"expo": "~56.0.
|
|
1959
|
-
"expo-constants": "~56.0.
|
|
1965
|
+
"ai": "^6.0.197",
|
|
1966
|
+
"expo": "~56.0.9",
|
|
1967
|
+
"expo-constants": "~56.0.17",
|
|
1960
1968
|
"expo-font": "~56.0.5",
|
|
1961
|
-
"expo-image-picker": "~56.0.
|
|
1969
|
+
"expo-image-picker": "~56.0.16",
|
|
1962
1970
|
"expo-linking": "~56.0.13",
|
|
1963
|
-
"expo-router": "~56.2.
|
|
1964
|
-
"expo-server": "~56.0.
|
|
1971
|
+
"expo-router": "~56.2.9",
|
|
1972
|
+
"expo-server": "~56.0.5",
|
|
1965
1973
|
"expo-splash-screen": "~56.0.10",
|
|
1966
1974
|
"expo-status-bar": "~56.0.4",
|
|
1967
|
-
"expo-symbols": "^56.0.
|
|
1975
|
+
"expo-symbols": "^56.0.6",
|
|
1968
1976
|
"expo-system-ui": "~56.0.5",
|
|
1969
1977
|
"react": "19.2.3",
|
|
1970
1978
|
"react-dom": "19.2.3",
|
|
1971
1979
|
"react-native": "0.85.3",
|
|
1972
|
-
"react-native-gesture-handler": "~
|
|
1980
|
+
"react-native-gesture-handler": "~2.31.2",
|
|
1973
1981
|
"react-native-reanimated": "4.3.1",
|
|
1974
|
-
"react-native-safe-area-context": "~5.
|
|
1982
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
1975
1983
|
"react-native-screens": "4.25.2",
|
|
1976
1984
|
"react-native-web": "~0.21.2",
|
|
1977
1985
|
"react-native-worklets": "0.8.3",
|
|
1978
1986
|
"zod": "^4.4.3"
|
|
1979
1987
|
},
|
|
1980
1988
|
"devDependencies": {
|
|
1981
|
-
"@
|
|
1989
|
+
"@assistant-ui/metro": "workspace:*",
|
|
1990
|
+
"@types/react": "~19.2.17",
|
|
1982
1991
|
"typescript": "~6.0.3"
|
|
1983
1992
|
},
|
|
1984
1993
|
"private": true
|
|
@@ -2064,7 +2073,7 @@ Join our community of developers creating universal apps.
|
|
|
2064
2073
|
{
|
|
2065
2074
|
"$schema": "https://openapi.vercel.sh/vercel.json",
|
|
2066
2075
|
"ignoreCommand": "bash ../../scripts/vercel-ignore-changeset-release.sh",
|
|
2067
|
-
"buildCommand": "cd ../.. && pnpm turbo build --filter=@assistant-ui/react-native --filter=@assistant-ui/react-ai-sdk && cd examples/with-expo && pnpm run export:web",
|
|
2076
|
+
"buildCommand": "cd ../.. && pnpm turbo build --filter=@assistant-ui/react-native --filter=@assistant-ui/react-ai-sdk --filter=@assistant-ui/metro && cd examples/with-expo && pnpm run export:web",
|
|
2068
2077
|
"outputDirectory": "dist",
|
|
2069
2078
|
"framework": null
|
|
2070
2079
|
}
|
|
@@ -321,17 +321,17 @@ export default withAui(nextConfig);
|
|
|
321
321
|
"class-variance-authority": "^0.7.1",
|
|
322
322
|
"clsx": "^2.1.1",
|
|
323
323
|
"lucide-react": "^1.17.0",
|
|
324
|
-
"next": "^16.2.
|
|
325
|
-
"react": "^19.2.
|
|
326
|
-
"react-dom": "^19.2.
|
|
324
|
+
"next": "^16.2.7",
|
|
325
|
+
"react": "^19.2.7",
|
|
326
|
+
"react-dom": "^19.2.7",
|
|
327
327
|
"tailwind-merge": "^3.6.0"
|
|
328
328
|
},
|
|
329
329
|
"devDependencies": {
|
|
330
330
|
"@assistant-ui/next": "workspace:*",
|
|
331
331
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
332
332
|
"@tailwindcss/postcss": "^4.3.0",
|
|
333
|
-
"@types/node": "^25.9.
|
|
334
|
-
"@types/react": "^19.2.
|
|
333
|
+
"@types/node": "^25.9.2",
|
|
334
|
+
"@types/react": "^19.2.17",
|
|
335
335
|
"@types/react-dom": "^19.2.3",
|
|
336
336
|
"postcss": "^8.5.15",
|
|
337
337
|
"tailwindcss": "^4.3.0",
|
|
@@ -374,7 +374,7 @@ export default function Home() {
|
|
|
374
374
|
|
|
375
375
|
import type { MutableRefObject } from "react";
|
|
376
376
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
377
|
-
import
|
|
377
|
+
import { defineToolkit } from "@assistant-ui/react";
|
|
378
378
|
import type { FFmpeg } from "@ffmpeg/ffmpeg";
|
|
379
379
|
import {
|
|
380
380
|
CircleCheckIcon,
|
|
@@ -391,7 +391,7 @@ export function useFfmpegToolkit(
|
|
|
391
391
|
) {
|
|
392
392
|
return useMemo(
|
|
393
393
|
() =>
|
|
394
|
-
({
|
|
394
|
+
defineToolkit({
|
|
395
395
|
run_ffmpeg: {
|
|
396
396
|
type: "frontend",
|
|
397
397
|
parameters: z.object({
|
|
@@ -653,7 +653,7 @@ export function useFfmpegToolkit(
|
|
|
653
653
|
);
|
|
654
654
|
},
|
|
655
655
|
},
|
|
656
|
-
})
|
|
656
|
+
}),
|
|
657
657
|
[ffmpegRef, file],
|
|
658
658
|
);
|
|
659
659
|
}
|
|
@@ -718,20 +718,20 @@ export default withAui(nextConfig);
|
|
|
718
718
|
"start": "next start"
|
|
719
719
|
},
|
|
720
720
|
"dependencies": {
|
|
721
|
-
"@ai-sdk/openai": "^3.0.
|
|
721
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
722
722
|
"@assistant-ui/react": "workspace:*",
|
|
723
723
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
724
724
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
725
725
|
"@assistant-ui/ui": "workspace:*",
|
|
726
726
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
|
727
727
|
"@ffmpeg/util": "^0.12.2",
|
|
728
|
-
"ai": "^6.0.
|
|
728
|
+
"ai": "^6.0.197",
|
|
729
729
|
"class-variance-authority": "^0.7.1",
|
|
730
730
|
"clsx": "^2.1.1",
|
|
731
731
|
"lucide-react": "^1.17.0",
|
|
732
|
-
"next": "^16.2.
|
|
733
|
-
"react": "^19.2.
|
|
734
|
-
"react-dom": "^19.2.
|
|
732
|
+
"next": "^16.2.7",
|
|
733
|
+
"react": "^19.2.7",
|
|
734
|
+
"react-dom": "^19.2.7",
|
|
735
735
|
"tailwind-merge": "^3.6.0",
|
|
736
736
|
"zod": "^4.4.3"
|
|
737
737
|
},
|
|
@@ -739,8 +739,8 @@ export default withAui(nextConfig);
|
|
|
739
739
|
"@assistant-ui/next": "workspace:*",
|
|
740
740
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
741
741
|
"@tailwindcss/postcss": "^4.3.0",
|
|
742
|
-
"@types/node": "^25.9.
|
|
743
|
-
"@types/react": "^19.2.
|
|
742
|
+
"@types/node": "^25.9.2",
|
|
743
|
+
"@types/react": "^19.2.17",
|
|
744
744
|
"@types/react-dom": "^19.2.3",
|
|
745
745
|
"postcss": "^8.5.15",
|
|
746
746
|
"tailwindcss": "^4.3.0",
|
|
@@ -8,20 +8,26 @@ import {
|
|
|
8
8
|
streamText,
|
|
9
9
|
convertToModelMessages,
|
|
10
10
|
stepCountIs,
|
|
11
|
-
jsonSchema,
|
|
12
11
|
tool,
|
|
13
12
|
zodSchema,
|
|
14
13
|
} from "ai";
|
|
15
14
|
import type { UIMessage } from "ai";
|
|
16
15
|
import { z } from "zod";
|
|
16
|
+
import {
|
|
17
|
+
AISDKToolkit,
|
|
18
|
+
type AISDKToolkitToolsOptions,
|
|
19
|
+
} from "@assistant-ui/react-ai-sdk";
|
|
17
20
|
import {
|
|
18
21
|
renderGuiToolDescription,
|
|
19
22
|
renderGuiToolInputSchema,
|
|
20
23
|
} from "../../../lib/render-gui-tool";
|
|
24
|
+
import toolkit from "../../toolkit";
|
|
21
25
|
|
|
22
26
|
export const maxDuration = 30;
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
const aiToolkit = new AISDKToolkit({ toolkit });
|
|
29
|
+
|
|
30
|
+
type FrontendToolDefs = NonNullable<AISDKToolkitToolsOptions["frontend"]>;
|
|
25
31
|
|
|
26
32
|
export async function POST(req: Request) {
|
|
27
33
|
const {
|
|
@@ -31,21 +37,12 @@ export async function POST(req: Request) {
|
|
|
31
37
|
}: {
|
|
32
38
|
messages: UIMessage[];
|
|
33
39
|
system?: string;
|
|
34
|
-
tools?:
|
|
40
|
+
tools?: FrontendToolDefs;
|
|
35
41
|
} = await req.json();
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Object.entries(clientTools).map(([name, def]) => [
|
|
41
|
-
name,
|
|
42
|
-
{
|
|
43
|
-
description: def.description ?? "",
|
|
44
|
-
inputSchema: jsonSchema(def.parameters),
|
|
45
|
-
},
|
|
46
|
-
]),
|
|
47
|
-
)
|
|
48
|
-
: {};
|
|
43
|
+
const toolkitTools = await aiToolkit.tools({
|
|
44
|
+
...(clientTools && { frontend: clientTools }),
|
|
45
|
+
});
|
|
49
46
|
|
|
50
47
|
const result = streamText({
|
|
51
48
|
model: openai("gpt-5.4-nano"),
|
|
@@ -53,7 +50,7 @@ export async function POST(req: Request) {
|
|
|
53
50
|
stopWhen: stepCountIs(10),
|
|
54
51
|
...(system ? { system } : {}),
|
|
55
52
|
tools: {
|
|
56
|
-
...
|
|
53
|
+
...toolkitTools,
|
|
57
54
|
|
|
58
55
|
render_gui: tool({
|
|
59
56
|
description: renderGuiToolDescription,
|
|
@@ -338,51 +335,12 @@ import {
|
|
|
338
335
|
AssistantRuntimeProvider,
|
|
339
336
|
Suggestions,
|
|
340
337
|
Tools,
|
|
341
|
-
type Toolkit,
|
|
342
338
|
useAui,
|
|
343
339
|
} from "@assistant-ui/react";
|
|
344
340
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
345
341
|
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
|
|
346
|
-
import { z } from "zod";
|
|
347
|
-
import { ChartToolUI } from "@/components/chart-tool-ui";
|
|
348
|
-
import { DatePickerToolUI } from "@/components/date-picker-tool-ui";
|
|
349
|
-
import { ContactFormToolUI } from "@/components/contact-form-tool-ui";
|
|
350
|
-
import { LocationToolUI } from "@/components/location-tool-ui";
|
|
351
342
|
import { ExampleNav } from "@/components/example-nav";
|
|
352
|
-
|
|
353
|
-
const toolkit = {
|
|
354
|
-
select_date: {
|
|
355
|
-
type: "human",
|
|
356
|
-
description:
|
|
357
|
-
"Ask the user to select a date. Use this when you need to collect a date (e.g. for scheduling, booking, deadlines).",
|
|
358
|
-
parameters: z.object({
|
|
359
|
-
prompt: z.string().describe("Message to display to the user"),
|
|
360
|
-
minDate: z.string().optional().describe("Minimum date (ISO string)"),
|
|
361
|
-
maxDate: z.string().optional().describe("Maximum date (ISO string)"),
|
|
362
|
-
}),
|
|
363
|
-
render: DatePickerToolUI,
|
|
364
|
-
},
|
|
365
|
-
collect_contact: {
|
|
366
|
-
type: "human",
|
|
367
|
-
description:
|
|
368
|
-
"Collect contact information from the user. Use this when you need the user's name, email, or phone number.",
|
|
369
|
-
parameters: z.object({
|
|
370
|
-
prompt: z.string().describe("Message to display to the user"),
|
|
371
|
-
fields: z
|
|
372
|
-
.array(z.enum(["name", "email", "phone"]))
|
|
373
|
-
.describe("Which fields to collect"),
|
|
374
|
-
}),
|
|
375
|
-
render: ContactFormToolUI,
|
|
376
|
-
},
|
|
377
|
-
generate_chart: {
|
|
378
|
-
type: "backend",
|
|
379
|
-
render: ChartToolUI,
|
|
380
|
-
},
|
|
381
|
-
show_location: {
|
|
382
|
-
type: "backend",
|
|
383
|
-
render: LocationToolUI,
|
|
384
|
-
},
|
|
385
|
-
} satisfies Toolkit;
|
|
343
|
+
import toolkit from "./toolkit";
|
|
386
344
|
|
|
387
345
|
export default function Home() {
|
|
388
346
|
const runtime = useChatRuntime({
|
|
@@ -532,6 +490,54 @@ export default function GenerativeUIPrimitivePage() {
|
|
|
532
490
|
|
|
533
491
|
```
|
|
534
492
|
|
|
493
|
+
## app/toolkit.tsx
|
|
494
|
+
|
|
495
|
+
```tsx
|
|
496
|
+
"use generative";
|
|
497
|
+
|
|
498
|
+
import { defineToolkit, externalTool, humanTool } from "@assistant-ui/react";
|
|
499
|
+
import { ChartToolUI } from "@/components/chart-tool-ui";
|
|
500
|
+
import { DatePickerToolUI } from "@/components/date-picker-tool-ui";
|
|
501
|
+
import { ContactFormToolUI } from "@/components/contact-form-tool-ui";
|
|
502
|
+
import { LocationToolUI } from "@/components/location-tool-ui";
|
|
503
|
+
import { z } from "zod";
|
|
504
|
+
|
|
505
|
+
export default defineToolkit({
|
|
506
|
+
select_date: {
|
|
507
|
+
description:
|
|
508
|
+
"Ask the user to select a date. Use this when you need to collect a date (e.g. for scheduling, booking, deadlines).",
|
|
509
|
+
parameters: z.object({
|
|
510
|
+
prompt: z.string().describe("Message to display to the user"),
|
|
511
|
+
minDate: z.string().optional().describe("Minimum date (ISO string)"),
|
|
512
|
+
maxDate: z.string().optional().describe("Maximum date (ISO string)"),
|
|
513
|
+
}),
|
|
514
|
+
execute: humanTool(),
|
|
515
|
+
render: DatePickerToolUI,
|
|
516
|
+
},
|
|
517
|
+
collect_contact: {
|
|
518
|
+
description:
|
|
519
|
+
"Collect contact information from the user. Use this when you need the user's name, email, or phone number.",
|
|
520
|
+
parameters: z.object({
|
|
521
|
+
prompt: z.string().describe("Message to display to the user"),
|
|
522
|
+
fields: z
|
|
523
|
+
.array(z.enum(["name", "email", "phone"]))
|
|
524
|
+
.describe("Which fields to collect"),
|
|
525
|
+
}),
|
|
526
|
+
execute: humanTool(),
|
|
527
|
+
render: ContactFormToolUI,
|
|
528
|
+
},
|
|
529
|
+
generate_chart: {
|
|
530
|
+
execute: externalTool(),
|
|
531
|
+
render: ChartToolUI,
|
|
532
|
+
},
|
|
533
|
+
show_location: {
|
|
534
|
+
execute: externalTool(),
|
|
535
|
+
render: LocationToolUI,
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
```
|
|
540
|
+
|
|
535
541
|
## components.json
|
|
536
542
|
|
|
537
543
|
```json
|
|
@@ -1772,17 +1778,17 @@ export default withAui(nextConfig);
|
|
|
1772
1778
|
"test": "vitest run"
|
|
1773
1779
|
},
|
|
1774
1780
|
"dependencies": {
|
|
1775
|
-
"@ai-sdk/openai": "^3.0.
|
|
1781
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
1776
1782
|
"@assistant-ui/react": "workspace:*",
|
|
1777
1783
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1778
1784
|
"@assistant-ui/ui": "workspace:*",
|
|
1779
|
-
"ai": "^6.0.
|
|
1785
|
+
"ai": "^6.0.197",
|
|
1780
1786
|
"class-variance-authority": "^0.7.1",
|
|
1781
1787
|
"clsx": "^2.1.1",
|
|
1782
1788
|
"lucide-react": "^1.17.0",
|
|
1783
|
-
"next": "^16.2.
|
|
1784
|
-
"react": "^19.2.
|
|
1785
|
-
"react-dom": "^19.2.
|
|
1789
|
+
"next": "^16.2.7",
|
|
1790
|
+
"react": "^19.2.7",
|
|
1791
|
+
"react-dom": "^19.2.7",
|
|
1786
1792
|
"recharts": "^3.8.1",
|
|
1787
1793
|
"tailwind-merge": "^3.6.0",
|
|
1788
1794
|
"zod": "^4.4.3"
|
|
@@ -1791,14 +1797,14 @@ export default withAui(nextConfig);
|
|
|
1791
1797
|
"@assistant-ui/next": "workspace:*",
|
|
1792
1798
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1793
1799
|
"@tailwindcss/postcss": "^4.3.0",
|
|
1794
|
-
"@types/node": "^25.9.
|
|
1795
|
-
"@types/react": "^19.2.
|
|
1800
|
+
"@types/node": "^25.9.2",
|
|
1801
|
+
"@types/react": "^19.2.17",
|
|
1796
1802
|
"@types/react-dom": "^19.2.3",
|
|
1797
1803
|
"postcss": "^8.5.15",
|
|
1798
1804
|
"tailwindcss": "^4.3.0",
|
|
1799
1805
|
"tw-animate-css": "^1.4.0",
|
|
1800
1806
|
"typescript": "^6.0.3",
|
|
1801
|
-
"vitest": "^4.1.
|
|
1807
|
+
"vitest": "^4.1.8"
|
|
1802
1808
|
}
|
|
1803
1809
|
}
|
|
1804
1810
|
|
|
@@ -305,13 +305,13 @@ export default withAui(nextConfig);
|
|
|
305
305
|
"@assistant-ui/react-google-adk": "workspace:*",
|
|
306
306
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
307
307
|
"@assistant-ui/ui": "workspace:*",
|
|
308
|
-
"@google/adk": "^1.
|
|
308
|
+
"@google/adk": "^1.2.0",
|
|
309
309
|
"class-variance-authority": "^0.7.1",
|
|
310
310
|
"clsx": "^2.1.1",
|
|
311
311
|
"lucide-react": "^1.17.0",
|
|
312
|
-
"next": "^16.2.
|
|
313
|
-
"react": "^19.2.
|
|
314
|
-
"react-dom": "^19.2.
|
|
312
|
+
"next": "^16.2.7",
|
|
313
|
+
"react": "^19.2.7",
|
|
314
|
+
"react-dom": "^19.2.7",
|
|
315
315
|
"tailwind-merge": "^3.6.0",
|
|
316
316
|
"zod": "^4.4.3"
|
|
317
317
|
},
|
|
@@ -319,8 +319,8 @@ export default withAui(nextConfig);
|
|
|
319
319
|
"@assistant-ui/next": "workspace:*",
|
|
320
320
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
321
321
|
"@tailwindcss/postcss": "^4.3.0",
|
|
322
|
-
"@types/node": "^25.9.
|
|
323
|
-
"@types/react": "^19.2.
|
|
322
|
+
"@types/node": "^25.9.2",
|
|
323
|
+
"@types/react": "^19.2.17",
|
|
324
324
|
"@types/react-dom": "^19.2.3",
|
|
325
325
|
"postcss": "^8.5.15",
|
|
326
326
|
"tailwindcss": "^4.3.0",
|
|
@@ -271,16 +271,16 @@ export default withAui(nextConfig);
|
|
|
271
271
|
},
|
|
272
272
|
"dependencies": {
|
|
273
273
|
"heat-graph": "workspace:*",
|
|
274
|
-
"next": "^16.2.
|
|
275
|
-
"react": "^19.2.
|
|
276
|
-
"react-dom": "^19.2.
|
|
274
|
+
"next": "^16.2.7",
|
|
275
|
+
"react": "^19.2.7",
|
|
276
|
+
"react-dom": "^19.2.7"
|
|
277
277
|
},
|
|
278
278
|
"devDependencies": {
|
|
279
279
|
"@assistant-ui/next": "workspace:*",
|
|
280
280
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
281
281
|
"@tailwindcss/postcss": "^4.3.0",
|
|
282
|
-
"@types/node": "^25.9.
|
|
283
|
-
"@types/react": "^19.2.
|
|
282
|
+
"@types/node": "^25.9.2",
|
|
283
|
+
"@types/react": "^19.2.17",
|
|
284
284
|
"@types/react-dom": "^19.2.3",
|
|
285
285
|
"postcss": "^8.5.15",
|
|
286
286
|
"tailwindcss": "^4.3.0",
|
|
@@ -380,24 +380,24 @@ export default withAui(nextConfig);
|
|
|
380
380
|
"start": "next start"
|
|
381
381
|
},
|
|
382
382
|
"dependencies": {
|
|
383
|
-
"@ai-sdk/openai": "^3.0.
|
|
383
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
384
384
|
"@assistant-ui/react": "workspace:*",
|
|
385
385
|
"@assistant-ui/ui": "workspace:*",
|
|
386
|
-
"ai": "^6.0.
|
|
386
|
+
"ai": "^6.0.197",
|
|
387
387
|
"class-variance-authority": "^0.7.1",
|
|
388
388
|
"clsx": "^2.1.1",
|
|
389
389
|
"lucide-react": "^1.17.0",
|
|
390
|
-
"next": "^16.2.
|
|
391
|
-
"react": "^19.2.
|
|
392
|
-
"react-dom": "^19.2.
|
|
390
|
+
"next": "^16.2.7",
|
|
391
|
+
"react": "^19.2.7",
|
|
392
|
+
"react-dom": "^19.2.7",
|
|
393
393
|
"tailwind-merge": "^3.6.0"
|
|
394
394
|
},
|
|
395
395
|
"devDependencies": {
|
|
396
396
|
"@assistant-ui/next": "workspace:*",
|
|
397
397
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
398
398
|
"@tailwindcss/postcss": "^4.3.0",
|
|
399
|
-
"@types/node": "^25.9.
|
|
400
|
-
"@types/react": "^19.2.
|
|
399
|
+
"@types/node": "^25.9.2",
|
|
400
|
+
"@types/react": "^19.2.17",
|
|
401
401
|
"@types/react-dom": "^19.2.3",
|
|
402
402
|
"postcss": "^8.5.15",
|
|
403
403
|
"tailwindcss": "^4.3.0",
|
|
@@ -797,17 +797,17 @@ export default withAui(nextConfig);
|
|
|
797
797
|
"start": "next start"
|
|
798
798
|
},
|
|
799
799
|
"dependencies": {
|
|
800
|
-
"@ai-sdk/openai": "^3.0.
|
|
800
|
+
"@ai-sdk/openai": "^3.0.68",
|
|
801
801
|
"@assistant-ui/react": "workspace:*",
|
|
802
802
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
803
803
|
"@assistant-ui/ui": "workspace:*",
|
|
804
|
-
"ai": "^6.0.
|
|
804
|
+
"ai": "^6.0.197",
|
|
805
805
|
"class-variance-authority": "^0.7.1",
|
|
806
806
|
"clsx": "^2.1.1",
|
|
807
807
|
"lucide-react": "^1.17.0",
|
|
808
|
-
"next": "^16.2.
|
|
809
|
-
"react": "^19.2.
|
|
810
|
-
"react-dom": "^19.2.
|
|
808
|
+
"next": "^16.2.7",
|
|
809
|
+
"react": "^19.2.7",
|
|
810
|
+
"react-dom": "^19.2.7",
|
|
811
811
|
"tailwind-merge": "^3.6.0",
|
|
812
812
|
"zod": "^4.4.3"
|
|
813
813
|
},
|
|
@@ -815,8 +815,8 @@ export default withAui(nextConfig);
|
|
|
815
815
|
"@assistant-ui/next": "workspace:*",
|
|
816
816
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
817
817
|
"@tailwindcss/postcss": "^4.3.0",
|
|
818
|
-
"@types/node": "^25.9.
|
|
819
|
-
"@types/react": "^19.2.
|
|
818
|
+
"@types/node": "^25.9.2",
|
|
819
|
+
"@types/react": "^19.2.17",
|
|
820
820
|
"@types/react-dom": "^19.2.3",
|
|
821
821
|
"postcss": "^8.5.15",
|
|
822
822
|
"tailwindcss": "^4.3.0",
|
|
@@ -336,22 +336,22 @@ export default withAui(nextConfig);
|
|
|
336
336
|
"@assistant-ui/react-langchain": "workspace:*",
|
|
337
337
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
338
338
|
"@assistant-ui/ui": "workspace:*",
|
|
339
|
-
"@langchain/langgraph-sdk": "^1.9.
|
|
340
|
-
"@langchain/react": "^1.0.
|
|
339
|
+
"@langchain/langgraph-sdk": "^1.9.18",
|
|
340
|
+
"@langchain/react": "^1.0.18",
|
|
341
341
|
"class-variance-authority": "^0.7.1",
|
|
342
342
|
"clsx": "^2.1.1",
|
|
343
343
|
"lucide-react": "^1.17.0",
|
|
344
|
-
"next": "^16.2.
|
|
345
|
-
"react": "^19.2.
|
|
346
|
-
"react-dom": "^19.2.
|
|
344
|
+
"next": "^16.2.7",
|
|
345
|
+
"react": "^19.2.7",
|
|
346
|
+
"react-dom": "^19.2.7",
|
|
347
347
|
"tailwind-merge": "^3.6.0"
|
|
348
348
|
},
|
|
349
349
|
"devDependencies": {
|
|
350
350
|
"@assistant-ui/next": "workspace:*",
|
|
351
351
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
352
352
|
"@tailwindcss/postcss": "^4.3.0",
|
|
353
|
-
"@types/node": "^25.9.
|
|
354
|
-
"@types/react": "^19.2.
|
|
353
|
+
"@types/node": "^25.9.2",
|
|
354
|
+
"@types/react": "^19.2.17",
|
|
355
355
|
"@types/react-dom": "^19.2.3",
|
|
356
356
|
"postcss": "^8.5.15",
|
|
357
357
|
"tailwindcss": "^4.3.0",
|