@mastra/client-js 0.10.2-alpha.1 → 0.10.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.10.2-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.2-alpha.3 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
3
  > tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,11 +9,11 @@
9
9
  CLI Cleaning output folder
10
10
  ESM Build start
11
11
  CJS Build start
12
- ESM dist/index.js 43.40 KB
13
- ESM ⚡️ Build success in 1819ms
14
- CJS dist/index.cjs 43.69 KB
15
- CJS ⚡️ Build success in 1835ms
12
+ CJS dist/index.cjs 44.77 KB
13
+ CJS ⚡️ Build success in 1691ms
14
+ ESM dist/index.js 44.48 KB
15
+ ESM ⚡️ Build success in 1693ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 14517ms
18
- DTS dist/index.d.ts 31.68 KB
19
- DTS dist/index.d.cts 31.68 KB
17
+ DTS ⚡️ Build success in 13187ms
18
+ DTS dist/index.d.ts 32.02 KB
19
+ DTS dist/index.d.cts 32.02 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 592a2db: Added different icons for agents and workflows in mcp tools list
8
+ - 37643b8: Fix tool access
9
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
10
+ - b72c768: [Bug fix] Serialize parameters in clientTools
11
+ - f0d559f: Fix peerdeps for alpha channel
12
+ - Updated dependencies [ee77e78]
13
+ - Updated dependencies [592a2db]
14
+ - Updated dependencies [e5dc18d]
15
+ - Updated dependencies [ab5adbe]
16
+ - Updated dependencies [1e8bb40]
17
+ - Updated dependencies [1b5fc55]
18
+ - Updated dependencies [195c428]
19
+ - Updated dependencies [f73e11b]
20
+ - Updated dependencies [37643b8]
21
+ - Updated dependencies [99fd6cf]
22
+ - Updated dependencies [c5bf1ce]
23
+ - Updated dependencies [add596e]
24
+ - Updated dependencies [8dc94d8]
25
+ - Updated dependencies [ecebbeb]
26
+ - Updated dependencies [79d5145]
27
+ - Updated dependencies [12b7002]
28
+ - Updated dependencies [2901125]
29
+ - @mastra/core@0.10.2
30
+
31
+ ## 0.10.2-alpha.3
32
+
33
+ ### Patch Changes
34
+
35
+ - 37643b8: Fix tool access
36
+ - b72c768: [Bug fix] Serialize parameters in clientTools
37
+ - Updated dependencies [37643b8]
38
+ - Updated dependencies [79d5145]
39
+ - @mastra/core@0.10.2-alpha.8
40
+
41
+ ## 0.10.2-alpha.2
42
+
43
+ ### Patch Changes
44
+
45
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
46
+ - Updated dependencies [c5bf1ce]
47
+ - Updated dependencies [12b7002]
48
+ - @mastra/core@0.10.2-alpha.4
49
+
3
50
  ## 0.10.2-alpha.1
4
51
 
5
52
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -5,6 +5,7 @@ var rxjs = require('rxjs');
5
5
  var uiUtils = require('@ai-sdk/ui-utils');
6
6
  var zod = require('zod');
7
7
  var originalZodToJsonSchema = require('zod-to-json-schema');
8
+ var tools = require('@mastra/core/tools');
8
9
  var runtimeContext = require('@mastra/core/runtime-context');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -202,6 +203,33 @@ function zodToJsonSchema(zodSchema) {
202
203
  }
203
204
  return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "none" });
204
205
  }
206
+ function processClientTools(clientTools) {
207
+ if (!clientTools) {
208
+ return void 0;
209
+ }
210
+ return Object.fromEntries(
211
+ Object.entries(clientTools).map(([key, value]) => {
212
+ if (tools.isVercelTool(value)) {
213
+ return [
214
+ key,
215
+ {
216
+ ...value,
217
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : void 0
218
+ }
219
+ ];
220
+ } else {
221
+ return [
222
+ key,
223
+ {
224
+ ...value,
225
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : void 0,
226
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : void 0
227
+ }
228
+ ];
229
+ }
230
+ })
231
+ );
232
+ }
205
233
 
206
234
  // src/resources/base.ts
207
235
  var BaseResource = class {
@@ -318,6 +346,13 @@ var AgentVoice = class extends BaseResource {
318
346
  getSpeakers() {
319
347
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
320
348
  }
349
+ /**
350
+ * Get the listener configuration for the agent's voice provider
351
+ * @returns Promise containing a check if the agent has listening capabilities
352
+ */
353
+ getListener() {
354
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
355
+ }
321
356
  };
322
357
  var Agent = class extends BaseResource {
323
358
  constructor(options, agentId) {
@@ -343,7 +378,8 @@ var Agent = class extends BaseResource {
343
378
  ...params,
344
379
  output: params.output ? zodToJsonSchema(params.output) : void 0,
345
380
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
346
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
381
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
382
+ clientTools: processClientTools(params.clientTools)
347
383
  };
348
384
  return this.request(`/api/agents/${this.agentId}/generate`, {
349
385
  method: "POST",
@@ -360,7 +396,8 @@ var Agent = class extends BaseResource {
360
396
  ...params,
361
397
  output: params.output ? zodToJsonSchema(params.output) : void 0,
362
398
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
363
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
399
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
400
+ clientTools: processClientTools(params.clientTools)
364
401
  };
365
402
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
366
403
  method: "POST",
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
8
  import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
@@ -51,13 +51,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
51
51
  output?: T;
52
52
  experimental_output?: T;
53
53
  runtimeContext?: RuntimeContext | Record<string, any>;
54
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
54
+ clientTools?: ToolsInput;
55
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
55
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
57
58
  output?: T;
58
59
  experimental_output?: T;
59
60
  runtimeContext?: RuntimeContext | Record<string, any>;
60
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
61
+ clientTools?: ToolsInput;
62
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
61
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
62
64
  evals: any[];
63
65
  instructions: string;
@@ -145,10 +147,10 @@ interface GetVectorIndexResponse {
145
147
  count: number;
146
148
  }
147
149
  interface SaveMessageToMemoryParams {
148
- messages: MessageType[];
150
+ messages: MastraMessageV1[];
149
151
  agentId: string;
150
152
  }
151
- type SaveMessageToMemoryResponse = MessageType[];
153
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
152
154
  interface CreateMemoryThreadParams {
153
155
  title?: string;
154
156
  metadata?: Record<string, any>;
@@ -307,6 +309,13 @@ declare class AgentVoice extends BaseResource {
307
309
  voiceId: string;
308
310
  [key: string]: any;
309
311
  }>>;
312
+ /**
313
+ * Get the listener configuration for the agent's voice provider
314
+ * @returns Promise containing a check if the agent has listening capabilities
315
+ */
316
+ getListener(): Promise<{
317
+ enabled: boolean;
318
+ }>;
310
319
  }
311
320
  declare class Agent extends BaseResource {
312
321
  private agentId;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
8
  import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
@@ -51,13 +51,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
51
51
  output?: T;
52
52
  experimental_output?: T;
53
53
  runtimeContext?: RuntimeContext | Record<string, any>;
54
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
54
+ clientTools?: ToolsInput;
55
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
55
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
57
58
  output?: T;
58
59
  experimental_output?: T;
59
60
  runtimeContext?: RuntimeContext | Record<string, any>;
60
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
61
+ clientTools?: ToolsInput;
62
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
61
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
62
64
  evals: any[];
63
65
  instructions: string;
@@ -145,10 +147,10 @@ interface GetVectorIndexResponse {
145
147
  count: number;
146
148
  }
147
149
  interface SaveMessageToMemoryParams {
148
- messages: MessageType[];
150
+ messages: MastraMessageV1[];
149
151
  agentId: string;
150
152
  }
151
- type SaveMessageToMemoryResponse = MessageType[];
153
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
152
154
  interface CreateMemoryThreadParams {
153
155
  title?: string;
154
156
  metadata?: Record<string, any>;
@@ -307,6 +309,13 @@ declare class AgentVoice extends BaseResource {
307
309
  voiceId: string;
308
310
  [key: string]: any;
309
311
  }>>;
312
+ /**
313
+ * Get the listener configuration for the agent's voice provider
314
+ * @returns Promise containing a check if the agent has listening capabilities
315
+ */
316
+ getListener(): Promise<{
317
+ enabled: boolean;
318
+ }>;
310
319
  }
311
320
  declare class Agent extends BaseResource {
312
321
  private agentId;
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
4
  import { ZodSchema } from 'zod';
5
5
  import originalZodToJsonSchema from 'zod-to-json-schema';
6
+ import { isVercelTool } from '@mastra/core/tools';
6
7
  import { RuntimeContext } from '@mastra/core/runtime-context';
7
8
 
8
9
  // src/adapters/agui.ts
@@ -196,6 +197,33 @@ function zodToJsonSchema(zodSchema) {
196
197
  }
197
198
  return originalZodToJsonSchema(zodSchema, { $refStrategy: "none" });
198
199
  }
200
+ function processClientTools(clientTools) {
201
+ if (!clientTools) {
202
+ return void 0;
203
+ }
204
+ return Object.fromEntries(
205
+ Object.entries(clientTools).map(([key, value]) => {
206
+ if (isVercelTool(value)) {
207
+ return [
208
+ key,
209
+ {
210
+ ...value,
211
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : void 0
212
+ }
213
+ ];
214
+ } else {
215
+ return [
216
+ key,
217
+ {
218
+ ...value,
219
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : void 0,
220
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : void 0
221
+ }
222
+ ];
223
+ }
224
+ })
225
+ );
226
+ }
199
227
 
200
228
  // src/resources/base.ts
201
229
  var BaseResource = class {
@@ -312,6 +340,13 @@ var AgentVoice = class extends BaseResource {
312
340
  getSpeakers() {
313
341
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
314
342
  }
343
+ /**
344
+ * Get the listener configuration for the agent's voice provider
345
+ * @returns Promise containing a check if the agent has listening capabilities
346
+ */
347
+ getListener() {
348
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
349
+ }
315
350
  };
316
351
  var Agent = class extends BaseResource {
317
352
  constructor(options, agentId) {
@@ -337,7 +372,8 @@ var Agent = class extends BaseResource {
337
372
  ...params,
338
373
  output: params.output ? zodToJsonSchema(params.output) : void 0,
339
374
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
340
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
375
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
376
+ clientTools: processClientTools(params.clientTools)
341
377
  };
342
378
  return this.request(`/api/agents/${this.agentId}/generate`, {
343
379
  method: "POST",
@@ -354,7 +390,8 @@ var Agent = class extends BaseResource {
354
390
  ...params,
355
391
  output: params.output ? zodToJsonSchema(params.output) : void 0,
356
392
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
357
- runtimeContext: parseClientRuntimeContext(params.runtimeContext)
393
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext),
394
+ clientTools: processClientTools(params.clientTools)
358
395
  };
359
396
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
360
397
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.2-alpha.1",
3
+ "version": "0.10.2",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^3.0.0",
34
- "@mastra/core": "^0.10.0-alpha.0"
34
+ "@mastra/core": "^0.10.2-alpha.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@babel/preset-env": "^7.26.9",
@@ -42,8 +42,8 @@
42
42
  "tsup": "^8.4.0",
43
43
  "typescript": "^5.8.2",
44
44
  "vitest": "^3.1.2",
45
- "@internal/lint": "0.0.7",
46
- "@mastra/core": "0.10.2-alpha.2"
45
+ "@internal/lint": "0.0.8",
46
+ "@mastra/core": "0.10.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
@@ -1,8 +1,9 @@
1
1
  import { processDataStream } from '@ai-sdk/ui-utils';
2
- import type { GenerateReturn } from '@mastra/core';
2
+ import { type GenerateReturn } from '@mastra/core';
3
3
  import type { JSONSchema7 } from 'json-schema';
4
4
  import { ZodSchema } from 'zod';
5
5
  import { zodToJsonSchema } from '../utils/zod-to-json-schema';
6
+ import { processClientTools } from '../utils/process-client-tools';
6
7
 
7
8
  import type {
8
9
  GenerateParams,
@@ -70,6 +71,14 @@ export class AgentVoice extends BaseResource {
70
71
  getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: any }>> {
71
72
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
72
73
  }
74
+
75
+ /**
76
+ * Get the listener configuration for the agent's voice provider
77
+ * @returns Promise containing a check if the agent has listening capabilities
78
+ */
79
+ getListener(): Promise<{ enabled: boolean }> {
80
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
81
+ }
73
82
  }
74
83
 
75
84
  export class Agent extends BaseResource {
@@ -104,6 +113,7 @@ export class Agent extends BaseResource {
104
113
  output: params.output ? zodToJsonSchema(params.output) : undefined,
105
114
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : undefined,
106
115
  runtimeContext: parseClientRuntimeContext(params.runtimeContext),
116
+ clientTools: processClientTools(params.clientTools),
107
117
  };
108
118
 
109
119
  return this.request(`/api/agents/${this.agentId}/generate`, {
@@ -129,6 +139,7 @@ export class Agent extends BaseResource {
129
139
  output: params.output ? zodToJsonSchema(params.output) : undefined,
130
140
  experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : undefined,
131
141
  runtimeContext: parseClientRuntimeContext(params.runtimeContext),
142
+ clientTools: processClientTools(params.clientTools),
132
143
  };
133
144
 
134
145
  const response: Response & {
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type {
2
- MessageType,
2
+ MastraMessageV1,
3
3
  AiMessageType,
4
4
  CoreMessage,
5
5
  QueryResult,
@@ -7,7 +7,7 @@ import type {
7
7
  WorkflowRuns,
8
8
  LegacyWorkflowRuns,
9
9
  } from '@mastra/core';
10
- import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
10
+ import type { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
11
11
  import type { BaseLogMessage } from '@mastra/core/logger';
12
12
 
13
13
  import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
@@ -69,14 +69,16 @@ export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undef
69
69
  output?: T;
70
70
  experimental_output?: T;
71
71
  runtimeContext?: RuntimeContext | Record<string, any>;
72
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
72
+ clientTools?: ToolsInput;
73
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
73
74
 
74
75
  export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
75
76
  messages: string | string[] | CoreMessage[] | AiMessageType[];
76
77
  output?: T;
77
78
  experimental_output?: T;
78
79
  runtimeContext?: RuntimeContext | Record<string, any>;
79
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
80
+ clientTools?: ToolsInput;
81
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
80
82
 
81
83
  export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
82
84
  evals: any[];
@@ -172,11 +174,11 @@ export interface GetVectorIndexResponse {
172
174
  }
173
175
 
174
176
  export interface SaveMessageToMemoryParams {
175
- messages: MessageType[];
177
+ messages: MastraMessageV1[];
176
178
  agentId: string;
177
179
  }
178
180
 
179
- export type SaveMessageToMemoryResponse = MessageType[];
181
+ export type SaveMessageToMemoryResponse = MastraMessageV1[];
180
182
 
181
183
  export interface CreateMemoryThreadParams {
182
184
  title?: string;
@@ -0,0 +1,31 @@
1
+ import { isVercelTool } from '@mastra/core/tools';
2
+ import { zodToJsonSchema } from './zod-to-json-schema';
3
+
4
+ export function processClientTools(clientTools: Record<string, any> | undefined): Record<string, any> | undefined {
5
+ if (!clientTools) {
6
+ return undefined;
7
+ }
8
+
9
+ return Object.fromEntries(
10
+ Object.entries(clientTools).map(([key, value]) => {
11
+ if (isVercelTool(value)) {
12
+ return [
13
+ key,
14
+ {
15
+ ...value,
16
+ parameters: value.parameters ? zodToJsonSchema(value.parameters) : undefined,
17
+ },
18
+ ];
19
+ } else {
20
+ return [
21
+ key,
22
+ {
23
+ ...value,
24
+ inputSchema: value.inputSchema ? zodToJsonSchema(value.inputSchema) : undefined,
25
+ outputSchema: value.outputSchema ? zodToJsonSchema(value.outputSchema) : undefined,
26
+ },
27
+ ];
28
+ }
29
+ }),
30
+ ) as Record<string, any>;
31
+ }