@super_studio/ecforce-ai-agent-react 1.2.0-canary.0 → 1.2.0-canary.1
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/README.md
CHANGED
|
@@ -220,6 +220,100 @@ sendAppMessage({
|
|
|
220
220
|
|
|
221
221
|
これにより、AI Agent 側で現在の画面や対象データに応じた応答をしやすくなります。
|
|
222
222
|
|
|
223
|
+
### 3-5. `useClientTool()` でクライアントツールを登録する
|
|
224
|
+
|
|
225
|
+
ブラウザ上で実行したい処理を AI Agent から呼ばせたい場合は、`useClientTool()` を使います。
|
|
226
|
+
|
|
227
|
+
典型的には、以下のような用途で使います。
|
|
228
|
+
|
|
229
|
+
- 現在開いている画面の React state を参照して結果を返す
|
|
230
|
+
- ユーザー確認付きでクライアント側の state を更新する
|
|
231
|
+
- クライアント側の UI 操作をトリガーする
|
|
232
|
+
|
|
233
|
+
`useClientTool()` は `ChatbotProvider` 配下で呼び出してください。引数定義には `zod` を使います。
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
"use client";
|
|
237
|
+
|
|
238
|
+
import { useState } from "react";
|
|
239
|
+
import { z } from "zod";
|
|
240
|
+
import { useClientTool } from "@super_studio/ecforce-ai-agent-react";
|
|
241
|
+
|
|
242
|
+
export function CartToolRegistration() {
|
|
243
|
+
const [selectedSku, setSelectedSku] = useState("sku_001");
|
|
244
|
+
const [isPinned, setIsPinned] = useState(false);
|
|
245
|
+
|
|
246
|
+
useClientTool({
|
|
247
|
+
name: "checkSelectedSku",
|
|
248
|
+
displayName: "選択中SKU確認",
|
|
249
|
+
description: "現在画面で選択中の商品 SKU を返します。",
|
|
250
|
+
summary: "選択中の SKU を返します。",
|
|
251
|
+
parameters: z.object({}),
|
|
252
|
+
execute: () => {
|
|
253
|
+
return {
|
|
254
|
+
selectedSku,
|
|
255
|
+
isPinned,
|
|
256
|
+
};
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
useClientTool({
|
|
261
|
+
name: "togglePinnedState",
|
|
262
|
+
displayName: "ピン留め切り替え",
|
|
263
|
+
description: "現在の商品をピン留めするかどうかを切り替えます。",
|
|
264
|
+
summary: "ピン留め状態を更新します。",
|
|
265
|
+
requireConfirmation: true,
|
|
266
|
+
parameters: z.object({
|
|
267
|
+
pinned: z.boolean().describe("更新後のピン留め状態"),
|
|
268
|
+
}),
|
|
269
|
+
execute: ({ pinned }) => {
|
|
270
|
+
setIsPinned(pinned);
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
selectedSku,
|
|
274
|
+
isPinned: pinned,
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<div>
|
|
281
|
+
<p>selectedSku: {selectedSku}</p>
|
|
282
|
+
<p>isPinned: {String(isPinned)}</p>
|
|
283
|
+
<button onClick={() => setSelectedSku("sku_002")}>SKU を切り替える</button>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### `useClientTool()` の options
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
type UseClientToolOptions<TParameters extends z.ZodTypeAny> = {
|
|
293
|
+
name: string;
|
|
294
|
+
displayName: string;
|
|
295
|
+
description: string;
|
|
296
|
+
summary?: string;
|
|
297
|
+
requireConfirmation?: boolean;
|
|
298
|
+
parameters: TParameters;
|
|
299
|
+
execute: (args: z.output<TParameters>) => Promise<unknown> | unknown;
|
|
300
|
+
};
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- `name`: ツール識別子です。内部では自動で `page_` プレフィックスが付きます
|
|
304
|
+
- `displayName`: UI 上で表示するツール名です
|
|
305
|
+
- `description`: AI Agent が参照する詳細説明です。何をするツールか、どんな引数を受けるかを明確に書いてください
|
|
306
|
+
- `summary`: ユーザー向けの短い要約です
|
|
307
|
+
- `requireConfirmation`: `true` の場合、実行前にユーザー確認を要求します
|
|
308
|
+
- `parameters`: ツール引数を表す `zod` スキーマです
|
|
309
|
+
- `execute`: 検証済み引数を受け取ってクライアント側の処理を実行する関数です
|
|
310
|
+
|
|
311
|
+
#### 補足
|
|
312
|
+
|
|
313
|
+
- `name` に `page_` を自分で付けても動きますが、通常は素の名前で問題ありません
|
|
314
|
+
- `execute` の返り値は AI Agent に渡されるため、JSON 化しやすい値を返すのがおすすめです
|
|
315
|
+
- コンポーネントがアンマウントされるとツール登録は自動で解除されます
|
|
316
|
+
|
|
223
317
|
## 4. `@super_studio/ecforce-ai-agent-server` のセットアップ
|
|
224
318
|
|
|
225
319
|
### 4-1. サーバー側で AI Agent セッションを発行する
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-tools.d.mts","names":[],"sources":["../../src/lib/client-tools.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"client-tools.d.mts","names":[],"sources":["../../src/lib/client-tools.ts"],"sourcesContent":[],"mappings":";;;KAOY,oBAAA,GAAuB;KAGvB,oBAAA;EAHA,IAAA,EAAA,MAAA;EAGA,WAAA,EAAA,MAAA;EASA,WAAA,EAAA,MAAA;EAMA,OAAA,CAAA,EAAA,MAAA;EAKA,mBAAA,CAAA,EAAA,OAAoB;EAAuB,UAAA,EAdzC,oBAcyC;CAYzC;AAEa,KAzBf,wBAAA,GAyBe;EAAP,MAAA,EAAA,MAAA;EAAwB,IAAA,EAAA,MAAA;EAAO,IAAA,EAAA,OAAA;AAiEnD,CAAA;AAAoD,KApFxC,oBAAA,GAoFwC;EAClD,UAAA,EApFY,oBAoFZ;EACA,OAAA,EAAA,CAAA,IAAA,EAAA,OAAA,EAAA,GApF4B,OAoF5B,CAAA,OAAA,CAAA,GAAA,OAAA;CACA;AACA,KAnFU,oBAmFV,CAAA,oBAnFmD,CAAA,CAAE,UAmFrD,CAAA,GAAA;EACA;EACA,IAAA,EAAA,MAAA;EACA;EACsB,WAAA,EAAA,MAAA;EAArB;EAAoB,WAAA,EAAA,MAAA;;;;;;cA3ET;;kBAEI,CAAA,CAAE,OAAO,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiE5B,kCAAkC,CAAA,CAAE;;;;;;;;GAQjD,qBAAqB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useChatbot } from "../components/provider/chatbot-provider.mjs";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
6
|
|
|
6
7
|
//#region src/lib/client-tools.ts
|
|
7
8
|
const CLIENT_TOOL_NAME_PREFIX = "page_";
|
|
@@ -9,6 +10,16 @@ function normalizeClientToolName(name) {
|
|
|
9
10
|
if (name.startsWith(CLIENT_TOOL_NAME_PREFIX)) return name;
|
|
10
11
|
return `${CLIENT_TOOL_NAME_PREFIX}${name}`;
|
|
11
12
|
}
|
|
13
|
+
function isZodV4Schema(parameters) {
|
|
14
|
+
return "_zod" in parameters;
|
|
15
|
+
}
|
|
16
|
+
function parametersToJsonSchema(parameters, zodModule) {
|
|
17
|
+
if (zodModule && isZodV4Schema(parameters)) {
|
|
18
|
+
const nativeToJsonSchema = zodModule.z.toJSONSchema;
|
|
19
|
+
if (typeof nativeToJsonSchema === "function") return nativeToJsonSchema(parameters);
|
|
20
|
+
}
|
|
21
|
+
return zodToJsonSchema(parameters, { $refStrategy: "none" });
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* チャットボットから呼び出せるクライアントツールを登録します。
|
|
14
25
|
*
|
|
@@ -45,7 +56,7 @@ function useClientTool({ name, displayName, description, summary, requireConfirm
|
|
|
45
56
|
React.useEffect(() => {
|
|
46
57
|
let isCancelled = false;
|
|
47
58
|
(async () => {
|
|
48
|
-
const
|
|
59
|
+
const zodModule = isZodV4Schema(parameters) ? await import("zod") : void 0;
|
|
49
60
|
if (isCancelled) return;
|
|
50
61
|
registerClientTool({
|
|
51
62
|
definition: {
|
|
@@ -54,7 +65,7 @@ function useClientTool({ name, displayName, description, summary, requireConfirm
|
|
|
54
65
|
description,
|
|
55
66
|
summary,
|
|
56
67
|
requireConfirmation,
|
|
57
|
-
parameters:
|
|
68
|
+
parameters: parametersToJsonSchema(parameters, zodModule)
|
|
58
69
|
},
|
|
59
70
|
execute: (args) => executeRef.current(args)
|
|
60
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-tools.mjs","names":[],"sources":["../../src/lib/client-tools.ts"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { z } from \"zod\";\nimport { useChatbot } from \"../components/provider/chatbot-provider\";\n\nexport type ClientToolJsonSchema = Record<string, unknown>;\nconst CLIENT_TOOL_NAME_PREFIX = \"page_\";\n\nexport type ClientToolDefinition = {\n name: string;\n displayName: string;\n description: string;\n summary?: string;\n requireConfirmation?: boolean;\n parameters: ClientToolJsonSchema;\n};\n\nexport type ClientToolExecuteRequest = {\n callId: string;\n name: string;\n args: unknown;\n};\n\nexport type RegisteredClientTool = {\n definition: ClientToolDefinition;\n execute: (args: unknown) => Promise<unknown> | unknown;\n};\n\nexport type UseClientToolOptions<TParameters extends z.ZodTypeAny> = {\n /** ツール名です。`page_`のプレフィックスが自動で追加されます。 */\n name: string;\n /** UI上に表示するツール名です。 */\n displayName: string;\n /** LLMが見れるツールの詳細説明です。 */\n description: string;\n /** ユーザーに表示するツールの要約です。 */\n summary?: string;\n /** 実行前にユーザー確認を要求するかを指定します。 */\n requireConfirmation?: boolean;\n /** ツールの引数を定義するZodスキーマです。 */\n parameters: TParameters;\n /** 検証済み引数を受け取り、ツール本体の処理を実行します。 */\n execute: (args: z.output<TParameters>) => Promise<unknown> | unknown;\n};\n\nfunction normalizeClientToolName(name: string) {\n if (name.startsWith(CLIENT_TOOL_NAME_PREFIX)) {\n return name;\n }\n\n return `${CLIENT_TOOL_NAME_PREFIX}${name}`;\n}\n\n/**\n * チャットボットから呼び出せるクライアントツールを登録します。\n *\n * @example\n * ```tsx\n * import { z } from \"zod\";\n * import { useClientTool } from \"@super_studio/ecforce-ai-agent-react\";\n *\n * export function InventoryToolRegistration() {\n * useClientTool({\n * name: \"lookup_inventory\",\n * displayName: \"在庫確認\",\n * description: \"商品コードから在庫数を取得します。\",\n * summary: \"商品在庫を返します。\",\n * parameters: z.object({\n * sku: z.string().describe(\"商品コード\"),\n * }),\n * execute: async ({ sku }) => {\n * return { sku, available: true };\n * },\n * });\n *\n * return null;\n * }\n * ```\n */\nexport function useClientTool<TParameters extends z.ZodTypeAny>({\n name,\n displayName,\n description,\n summary,\n requireConfirmation = false,\n parameters,\n execute,\n}: UseClientToolOptions<TParameters>) {\n const { registerClientTool, unregisterClientTool } = useChatbot();\n const executeRef = React.useRef(execute);\n const normalizedName = React.useMemo(\n () => normalizeClientToolName(name),\n [name],\n );\n\n React.useEffect(() => {\n executeRef.current = execute;\n }, [execute]);\n\n React.useEffect(() => {\n let isCancelled = false;\n\n void (async () => {\n const
|
|
1
|
+
{"version":3,"file":"client-tools.mjs","names":[],"sources":["../../src/lib/client-tools.ts"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport type { z } from \"zod\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { useChatbot } from \"../components/provider/chatbot-provider\";\n\nexport type ClientToolJsonSchema = Record<string, unknown>;\nconst CLIENT_TOOL_NAME_PREFIX = \"page_\";\n\nexport type ClientToolDefinition = {\n name: string;\n displayName: string;\n description: string;\n summary?: string;\n requireConfirmation?: boolean;\n parameters: ClientToolJsonSchema;\n};\n\nexport type ClientToolExecuteRequest = {\n callId: string;\n name: string;\n args: unknown;\n};\n\nexport type RegisteredClientTool = {\n definition: ClientToolDefinition;\n execute: (args: unknown) => Promise<unknown> | unknown;\n};\n\nexport type UseClientToolOptions<TParameters extends z.ZodTypeAny> = {\n /** ツール名です。`page_`のプレフィックスが自動で追加されます。 */\n name: string;\n /** UI上に表示するツール名です。 */\n displayName: string;\n /** LLMが見れるツールの詳細説明です。 */\n description: string;\n /** ユーザーに表示するツールの要約です。 */\n summary?: string;\n /** 実行前にユーザー確認を要求するかを指定します。 */\n requireConfirmation?: boolean;\n /** ツールの引数を定義するZodスキーマです。 */\n parameters: TParameters;\n /** 検証済み引数を受け取り、ツール本体の処理を実行します。 */\n execute: (args: z.output<TParameters>) => Promise<unknown> | unknown;\n};\n\nfunction normalizeClientToolName(name: string) {\n if (name.startsWith(CLIENT_TOOL_NAME_PREFIX)) {\n return name;\n }\n\n return `${CLIENT_TOOL_NAME_PREFIX}${name}`;\n}\n\nfunction isZodV4Schema(parameters: z.ZodTypeAny) {\n return \"_zod\" in (parameters as object);\n}\n\nfunction parametersToJsonSchema(\n parameters: z.ZodTypeAny,\n zodModule?: typeof import(\"zod\"),\n): ClientToolJsonSchema {\n if (zodModule && isZodV4Schema(parameters)) {\n const nativeToJsonSchema = (\n zodModule.z as typeof zodModule.z & {\n toJSONSchema?: (schema: z.ZodTypeAny) => ClientToolJsonSchema;\n }\n ).toJSONSchema;\n\n if (typeof nativeToJsonSchema === \"function\") {\n return nativeToJsonSchema(parameters);\n }\n }\n\n return zodToJsonSchema(\n parameters as unknown as Parameters<typeof zodToJsonSchema>[0],\n {\n $refStrategy: \"none\",\n },\n ) as ClientToolJsonSchema;\n}\n\n/**\n * チャットボットから呼び出せるクライアントツールを登録します。\n *\n * @example\n * ```tsx\n * import { z } from \"zod\";\n * import { useClientTool } from \"@super_studio/ecforce-ai-agent-react\";\n *\n * export function InventoryToolRegistration() {\n * useClientTool({\n * name: \"lookup_inventory\",\n * displayName: \"在庫確認\",\n * description: \"商品コードから在庫数を取得します。\",\n * summary: \"商品在庫を返します。\",\n * parameters: z.object({\n * sku: z.string().describe(\"商品コード\"),\n * }),\n * execute: async ({ sku }) => {\n * return { sku, available: true };\n * },\n * });\n *\n * return null;\n * }\n * ```\n */\nexport function useClientTool<TParameters extends z.ZodTypeAny>({\n name,\n displayName,\n description,\n summary,\n requireConfirmation = false,\n parameters,\n execute,\n}: UseClientToolOptions<TParameters>) {\n const { registerClientTool, unregisterClientTool } = useChatbot();\n const executeRef = React.useRef(execute);\n const normalizedName = React.useMemo(\n () => normalizeClientToolName(name),\n [name],\n );\n\n React.useEffect(() => {\n executeRef.current = execute;\n }, [execute]);\n\n React.useEffect(() => {\n let isCancelled = false;\n\n void (async () => {\n const zodModule = isZodV4Schema(parameters) ? await import(\"zod\") : undefined;\n if (isCancelled) {\n return;\n }\n\n registerClientTool({\n definition: {\n name: normalizedName,\n displayName,\n description,\n summary,\n requireConfirmation,\n parameters: parametersToJsonSchema(parameters, zodModule),\n },\n execute: (args) => executeRef.current(args as z.output<TParameters>),\n });\n })();\n\n return () => {\n isCancelled = true;\n unregisterClientTool(normalizedName);\n };\n }, [\n description,\n displayName,\n normalizedName,\n parameters,\n registerClientTool,\n requireConfirmation,\n summary,\n unregisterClientTool,\n ]);\n}\n"],"mappings":";;;;;;;AAQA,MAAM,0BAA0B;AAuChC,SAAS,wBAAwB,MAAc;AAC7C,KAAI,KAAK,WAAW,wBAAwB,CAC1C,QAAO;AAGT,QAAO,GAAG,0BAA0B;;AAGtC,SAAS,cAAc,YAA0B;AAC/C,QAAO,UAAW;;AAGpB,SAAS,uBACP,YACA,WACsB;AACtB,KAAI,aAAa,cAAc,WAAW,EAAE;EAC1C,MAAM,qBACJ,UAAU,EAGV;AAEF,MAAI,OAAO,uBAAuB,WAChC,QAAO,mBAAmB,WAAW;;AAIzC,QAAO,gBACL,YACA,EACE,cAAc,QACf,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,SAAgB,cAAgD,EAC9D,MACA,aACA,aACA,SACA,sBAAsB,OACtB,YACA,WACoC;CACpC,MAAM,EAAE,oBAAoB,yBAAyB,YAAY;CACjE,MAAM,aAAa,MAAM,OAAO,QAAQ;CACxC,MAAM,iBAAiB,MAAM,cACrB,wBAAwB,KAAK,EACnC,CAAC,KAAK,CACP;AAED,OAAM,gBAAgB;AACpB,aAAW,UAAU;IACpB,CAAC,QAAQ,CAAC;AAEb,OAAM,gBAAgB;EACpB,IAAI,cAAc;AAElB,GAAM,YAAY;GAChB,MAAM,YAAY,cAAc,WAAW,GAAG,MAAM,OAAO,SAAS;AACpE,OAAI,YACF;AAGF,sBAAmB;IACjB,YAAY;KACV,MAAM;KACN;KACA;KACA;KACA;KACA,YAAY,uBAAuB,YAAY,UAAU;KAC1D;IACD,UAAU,SAAS,WAAW,QAAQ,KAA8B;IACrE,CAAC;MACA;AAEJ,eAAa;AACX,iBAAc;AACd,wBAAqB,eAAe;;IAErC;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super_studio/ecforce-ai-agent-react",
|
|
3
|
-
"version": "1.2.0-canary.
|
|
3
|
+
"version": "1.2.0-canary.1",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@radix-ui/react-dialog": "1.1.14",
|
|
23
|
-
"@radix-ui/react-tooltip": "1.2.7"
|
|
23
|
+
"@radix-ui/react-tooltip": "1.2.7",
|
|
24
|
+
"zod-to-json-schema": "3.25.2"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"react": ">=16",
|
|
27
28
|
"react-dom": ">=16",
|
|
28
|
-
"zod": ">=
|
|
29
|
+
"zod": ">=3"
|
|
29
30
|
},
|
|
30
31
|
"peerDependenciesMeta": {
|
|
31
32
|
"zod": {
|
package/src/lib/client-tools.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { z } from "zod";
|
|
5
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
6
|
import { useChatbot } from "../components/provider/chatbot-provider";
|
|
6
7
|
|
|
7
8
|
export type ClientToolJsonSchema = Record<string, unknown>;
|
|
@@ -52,6 +53,34 @@ function normalizeClientToolName(name: string) {
|
|
|
52
53
|
return `${CLIENT_TOOL_NAME_PREFIX}${name}`;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
function isZodV4Schema(parameters: z.ZodTypeAny) {
|
|
57
|
+
return "_zod" in (parameters as object);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parametersToJsonSchema(
|
|
61
|
+
parameters: z.ZodTypeAny,
|
|
62
|
+
zodModule?: typeof import("zod"),
|
|
63
|
+
): ClientToolJsonSchema {
|
|
64
|
+
if (zodModule && isZodV4Schema(parameters)) {
|
|
65
|
+
const nativeToJsonSchema = (
|
|
66
|
+
zodModule.z as typeof zodModule.z & {
|
|
67
|
+
toJSONSchema?: (schema: z.ZodTypeAny) => ClientToolJsonSchema;
|
|
68
|
+
}
|
|
69
|
+
).toJSONSchema;
|
|
70
|
+
|
|
71
|
+
if (typeof nativeToJsonSchema === "function") {
|
|
72
|
+
return nativeToJsonSchema(parameters);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return zodToJsonSchema(
|
|
77
|
+
parameters as unknown as Parameters<typeof zodToJsonSchema>[0],
|
|
78
|
+
{
|
|
79
|
+
$refStrategy: "none",
|
|
80
|
+
},
|
|
81
|
+
) as ClientToolJsonSchema;
|
|
82
|
+
}
|
|
83
|
+
|
|
55
84
|
/**
|
|
56
85
|
* チャットボットから呼び出せるクライアントツールを登録します。
|
|
57
86
|
*
|
|
@@ -102,7 +131,7 @@ export function useClientTool<TParameters extends z.ZodTypeAny>({
|
|
|
102
131
|
let isCancelled = false;
|
|
103
132
|
|
|
104
133
|
void (async () => {
|
|
105
|
-
const
|
|
134
|
+
const zodModule = isZodV4Schema(parameters) ? await import("zod") : undefined;
|
|
106
135
|
if (isCancelled) {
|
|
107
136
|
return;
|
|
108
137
|
}
|
|
@@ -114,7 +143,7 @@ export function useClientTool<TParameters extends z.ZodTypeAny>({
|
|
|
114
143
|
description,
|
|
115
144
|
summary,
|
|
116
145
|
requireConfirmation,
|
|
117
|
-
parameters:
|
|
146
|
+
parameters: parametersToJsonSchema(parameters, zodModule),
|
|
118
147
|
},
|
|
119
148
|
execute: (args) => executeRef.current(args as z.output<TParameters>),
|
|
120
149
|
});
|