@mastra/client-js 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-vector-query-sources-20250516172905

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/CHANGELOG.md CHANGED
@@ -1,9 +1,150 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-trigger-playground-ui-package-20250506151043
3
+ ## 0.0.0-vector-query-sources-20250516172905
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - f53a6ac: Add VNextWorkflowRuns type
8
+ - ccdabdc: Remove trailing / from mastraClient baseUrl
9
+ - a6e3881: Remove non serializable options from agent stream,generate
10
+ - fddae56: Add telemetry to cliend SDK streamParams
11
+ - 23f258c: Add new list and get routes for mcp servers. Changed route make-up for more consistency with existing API routes. Lastly, added in a lot of extra detail that can be optionally passed to the mcp server per the mcp spec.
12
+ - 2672a05: Add MCP servers and tool call execution to playground
13
+ - Updated dependencies [f53a6ac]
14
+ - Updated dependencies [eabdcd9]
15
+ - Updated dependencies [d0ee3c6]
16
+ - Updated dependencies [23f258c]
17
+ - Updated dependencies [2672a05]
18
+ - @mastra/core@0.0.0-vector-query-sources-20250516172905
19
+
20
+ ## 0.1.22
21
+
22
+ ### Patch Changes
23
+
24
+ - c2f9e60: Resolves type issue and listen response string wrapped in text object twice
25
+ - 5c70b8a: [MASTRA-3234] added limit for client-js getMessages
26
+ - b4c6c87: fix: Specify $refStrategy: 'none' when calling zodToJsonSchema.
27
+ - 0c3d117: Add workflows to agent server handlers
28
+ - a5810ce: Add support for experimental_generateMessageId and remove it from client-js types since it's not serializable
29
+ - c2b980b: Fix multiple too-calls in AGUI
30
+ - cb1f698: Set runtimeContext from playground for agents, tools, workflows
31
+ - 0b8b868: Added A2A support + streaming
32
+ - Updated dependencies [396be50]
33
+ - Updated dependencies [ab80e7e]
34
+ - Updated dependencies [c3bd795]
35
+ - Updated dependencies [da082f8]
36
+ - Updated dependencies [a5810ce]
37
+ - Updated dependencies [3e9c131]
38
+ - Updated dependencies [3171b5b]
39
+ - Updated dependencies [973e5ac]
40
+ - Updated dependencies [daf942f]
41
+ - Updated dependencies [0b8b868]
42
+ - Updated dependencies [9e1eff5]
43
+ - Updated dependencies [6fa1ad1]
44
+ - Updated dependencies [c28d7a0]
45
+ - Updated dependencies [edf1e88]
46
+ - @mastra/core@0.9.4
47
+
48
+ ## 0.1.22-alpha.4
49
+
50
+ ### Patch Changes
51
+
52
+ - 5c70b8a: [MASTRA-3234] added limit for client-js getMessages
53
+ - Updated dependencies [3e9c131]
54
+ - @mastra/core@0.9.4-alpha.4
55
+
56
+ ## 0.1.22-alpha.3
57
+
58
+ ### Patch Changes
59
+
60
+ - c2f9e60: Resolves type issue and listen response string wrapped in text object twice
61
+ - 0c3d117: Add workflows to agent server handlers
62
+ - a5810ce: Add support for experimental_generateMessageId and remove it from client-js types since it's not serializable
63
+ - Updated dependencies [396be50]
64
+ - Updated dependencies [c3bd795]
65
+ - Updated dependencies [da082f8]
66
+ - Updated dependencies [a5810ce]
67
+ - @mastra/core@0.9.4-alpha.3
68
+
69
+ ## 0.1.22-alpha.2
70
+
71
+ ### Patch Changes
72
+
73
+ - b4c6c87: fix: Specify $refStrategy: 'none' when calling zodToJsonSchema.
74
+ - c2b980b: Fix multiple too-calls in AGUI
75
+ - Updated dependencies [3171b5b]
76
+ - Updated dependencies [973e5ac]
77
+ - Updated dependencies [9e1eff5]
78
+ - @mastra/core@0.9.4-alpha.2
79
+
80
+ ## 0.1.22-alpha.1
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [ab80e7e]
85
+ - Updated dependencies [6fa1ad1]
86
+ - Updated dependencies [c28d7a0]
87
+ - Updated dependencies [edf1e88]
88
+ - @mastra/core@0.9.4-alpha.1
89
+
90
+ ## 0.1.22-alpha.0
91
+
92
+ ### Patch Changes
93
+
94
+ - cb1f698: Set runtimeContext from playground for agents, tools, workflows
95
+ - 0b8b868: Added A2A support + streaming
96
+ - Updated dependencies [daf942f]
97
+ - Updated dependencies [0b8b868]
98
+ - @mastra/core@0.9.4-alpha.0
99
+
100
+ ## 0.1.21
101
+
102
+ ### Patch Changes
103
+
104
+ - 526c570: expose agent runtimeContext from clientSDK
105
+ - 36eb1aa: Fix AGUI text part
106
+ - 62c9e7d: Fix disappearing tool calls in streaming
107
+ - Updated dependencies [e450778]
108
+ - Updated dependencies [8902157]
109
+ - Updated dependencies [ca0dc88]
110
+ - Updated dependencies [526c570]
111
+ - Updated dependencies [d7a6a33]
112
+ - Updated dependencies [9cd1a46]
113
+ - Updated dependencies [b5d2de0]
114
+ - Updated dependencies [644f8ad]
115
+ - Updated dependencies [70dbf51]
116
+ - @mastra/core@0.9.3
117
+
118
+ ## 0.1.21-alpha.1
119
+
120
+ ### Patch Changes
121
+
122
+ - 36eb1aa: Fix AGUI text part
123
+ - 62c9e7d: Fix disappearing tool calls in streaming
124
+ - Updated dependencies [e450778]
125
+ - Updated dependencies [8902157]
126
+ - Updated dependencies [ca0dc88]
127
+ - Updated dependencies [9cd1a46]
128
+ - Updated dependencies [70dbf51]
129
+ - @mastra/core@0.9.3-alpha.1
130
+
131
+ ## 0.1.21-alpha.0
132
+
133
+ ### Patch Changes
134
+
135
+ - 526c570: expose agent runtimeContext from clientSDK
136
+ - Updated dependencies [526c570]
137
+ - Updated dependencies [b5d2de0]
138
+ - Updated dependencies [644f8ad]
139
+ - @mastra/core@0.9.3-alpha.0
140
+
141
+ ## 0.1.20
142
+
143
+ ### Patch Changes
144
+
145
+ - 2cf3b8f: dependencies updates:
146
+ - Updated dependency [`zod@^3.24.3` ↗︎](https://www.npmjs.com/package/zod/v/3.24.3) (from `^3.24.2`, in `dependencies`)
147
+ - Updated dependency [`zod-to-json-schema@^3.24.5` ↗︎](https://www.npmjs.com/package/zod-to-json-schema/v/3.24.5) (from `^3.24.3`, in `dependencies`)
7
148
  - 4155f47: Add parameters to filter workflow runs
8
149
  Add fromDate and toDate to telemetry parameters
9
150
  - 254f5c3: Audit, cleanup MastraClient
@@ -26,8 +167,21 @@
26
167
  - Updated dependencies [17826a9]
27
168
  - Updated dependencies [7d8b7c7]
28
169
  - Updated dependencies [fba031f]
170
+ - Updated dependencies [3a5f1e1]
29
171
  - Updated dependencies [51e6923]
30
- - @mastra/core@0.0.0-trigger-playground-ui-package-20250506151043
172
+ - Updated dependencies [8398d89]
173
+ - @mastra/core@0.9.2
174
+
175
+ ## 0.1.20-alpha.6
176
+
177
+ ### Patch Changes
178
+
179
+ - 2e4f8e9: Agui client integration
180
+ - Updated dependencies [6052aa6]
181
+ - Updated dependencies [7d8b7c7]
182
+ - Updated dependencies [3a5f1e1]
183
+ - Updated dependencies [8398d89]
184
+ - @mastra/core@0.9.2-alpha.6
31
185
 
32
186
  ## 0.1.20-alpha.5
33
187
 
package/dist/index.cjs CHANGED
@@ -4,7 +4,11 @@ var client = require('@ag-ui/client');
4
4
  var rxjs = require('rxjs');
5
5
  var uiUtils = require('@ai-sdk/ui-utils');
6
6
  var zod = require('zod');
7
- var zodToJsonSchema = require('zod-to-json-schema');
7
+ var originalZodToJsonSchema = require('zod-to-json-schema');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var originalZodToJsonSchema__default = /*#__PURE__*/_interopDefault(originalZodToJsonSchema);
8
12
 
9
13
  // src/adapters/agui.ts
10
14
  var AGUIAdapter = class extends client.AbstractAgent {
@@ -44,6 +48,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
44
48
  )
45
49
  }).then((response) => {
46
50
  let currentMessageId = void 0;
51
+ let isInTextMessage = false;
47
52
  return response.processDataStream({
48
53
  onTextPart: (text) => {
49
54
  if (currentMessageId === void 0) {
@@ -54,6 +59,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
54
59
  role: "assistant"
55
60
  };
56
61
  subscriber.next(message2);
62
+ isInTextMessage = true;
57
63
  }
58
64
  const message = {
59
65
  type: client.EventType.TEXT_MESSAGE_CONTENT,
@@ -62,14 +68,14 @@ var AGUIAdapter = class extends client.AbstractAgent {
62
68
  };
63
69
  subscriber.next(message);
64
70
  },
65
- onFinishMessagePart: (message) => {
66
- console.log("onFinishMessagePart", message);
71
+ onFinishMessagePart: () => {
67
72
  if (currentMessageId !== void 0) {
68
- const message2 = {
73
+ const message = {
69
74
  type: client.EventType.TEXT_MESSAGE_END,
70
75
  messageId: currentMessageId
71
76
  };
72
- subscriber.next(message2);
77
+ subscriber.next(message);
78
+ isInTextMessage = false;
73
79
  }
74
80
  subscriber.next({
75
81
  type: client.EventType.RUN_FINISHED,
@@ -80,6 +86,14 @@ var AGUIAdapter = class extends client.AbstractAgent {
80
86
  },
81
87
  onToolCallPart(streamPart) {
82
88
  const parentMessageId = currentMessageId || generateUUID();
89
+ if (isInTextMessage) {
90
+ const message = {
91
+ type: client.EventType.TEXT_MESSAGE_END,
92
+ messageId: parentMessageId
93
+ };
94
+ subscriber.next(message);
95
+ isInTextMessage = false;
96
+ }
83
97
  subscriber.next({
84
98
  type: client.EventType.TOOL_CALL_START,
85
99
  toolCallId: streamPart.toolCallId,
@@ -100,7 +114,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
100
114
  }
101
115
  });
102
116
  }).catch((error) => {
103
- console.log("error", error);
117
+ console.error("error", error);
104
118
  subscriber.error(error);
105
119
  });
106
120
  return () => {
@@ -149,6 +163,17 @@ function convertMessagesToMastraMessages(messages) {
149
163
  role: "assistant",
150
164
  content: parts
151
165
  });
166
+ if (message.toolCalls?.length) {
167
+ result.push({
168
+ role: "tool",
169
+ content: message.toolCalls.map((toolCall) => ({
170
+ type: "tool-result",
171
+ toolCallId: toolCall.id,
172
+ toolName: toolCall.function.name,
173
+ result: JSON.parse(toolCall.function.arguments)
174
+ }))
175
+ });
176
+ }
152
177
  } else if (message.role === "user") {
153
178
  result.push({
154
179
  role: "user",
@@ -170,6 +195,12 @@ function convertMessagesToMastraMessages(messages) {
170
195
  }
171
196
  return result;
172
197
  }
198
+ function zodToJsonSchema(zodSchema) {
199
+ if (!(zodSchema instanceof zod.ZodSchema)) {
200
+ return zodSchema;
201
+ }
202
+ return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "none" });
203
+ }
173
204
 
174
205
  // src/resources/base.ts
175
206
  var BaseResource = class {
@@ -189,7 +220,7 @@ var BaseResource = class {
189
220
  let delay = backoffMs;
190
221
  for (let attempt = 0; attempt <= retries; attempt++) {
191
222
  try {
192
- const response = await fetch(`${baseUrl}${path}`, {
223
+ const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
193
224
  ...options,
194
225
  headers: {
195
226
  ...headers,
@@ -300,8 +331,9 @@ var Agent = class extends BaseResource {
300
331
  generate(params) {
301
332
  const processedParams = {
302
333
  ...params,
303
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
304
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
334
+ output: params.output ? zodToJsonSchema(params.output) : void 0,
335
+ experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
336
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
305
337
  };
306
338
  return this.request(`/api/agents/${this.agentId}/generate`, {
307
339
  method: "POST",
@@ -316,8 +348,9 @@ var Agent = class extends BaseResource {
316
348
  async stream(params) {
317
349
  const processedParams = {
318
350
  ...params,
319
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
320
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
351
+ output: params.output ? zodToJsonSchema(params.output) : void 0,
352
+ experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
353
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
321
354
  };
322
355
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
323
356
  method: "POST",
@@ -343,6 +376,22 @@ var Agent = class extends BaseResource {
343
376
  getTool(toolId) {
344
377
  return this.request(`/api/agents/${this.agentId}/tools/${toolId}`);
345
378
  }
379
+ /**
380
+ * Executes a tool for the agent
381
+ * @param toolId - ID of the tool to execute
382
+ * @param params - Parameters required for tool execution
383
+ * @returns Promise containing the tool execution results
384
+ */
385
+ executeTool(toolId, params) {
386
+ const body = {
387
+ data: params.data,
388
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
389
+ };
390
+ return this.request(`/api/agents/${this.agentId}/tools/${toolId}/execute`, {
391
+ method: "POST",
392
+ body
393
+ });
394
+ }
346
395
  /**
347
396
  * Retrieves evaluation results for the agent
348
397
  * @returns Promise containing agent evaluations
@@ -378,8 +427,8 @@ var Network = class extends BaseResource {
378
427
  generate(params) {
379
428
  const processedParams = {
380
429
  ...params,
381
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
382
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
430
+ output: zodToJsonSchema(params.output),
431
+ experimental_output: zodToJsonSchema(params.experimental_output)
383
432
  };
384
433
  return this.request(`/api/networks/${this.networkId}/generate`, {
385
434
  method: "POST",
@@ -394,8 +443,8 @@ var Network = class extends BaseResource {
394
443
  async stream(params) {
395
444
  const processedParams = {
396
445
  ...params,
397
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
398
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
446
+ output: zodToJsonSchema(params.output),
447
+ experimental_output: zodToJsonSchema(params.experimental_output)
399
448
  };
400
449
  const response = await this.request(`/api/networks/${this.networkId}/stream`, {
401
450
  method: "POST",
@@ -451,10 +500,15 @@ var MemoryThread = class extends BaseResource {
451
500
  }
452
501
  /**
453
502
  * Retrieves messages associated with the thread
503
+ * @param params - Optional parameters including limit for number of messages to retrieve
454
504
  * @returns Promise containing thread messages and UI messages
455
505
  */
456
- getMessages() {
457
- return this.request(`/api/memory/threads/${this.threadId}/messages?agentId=${this.agentId}`);
506
+ getMessages(params) {
507
+ const query = new URLSearchParams({
508
+ agentId: this.agentId,
509
+ ...params?.limit ? { limit: params.limit.toString() } : {}
510
+ });
511
+ return this.request(`/api/memory/threads/${this.threadId}/messages?${query.toString()}`);
458
512
  }
459
513
  };
460
514
 
@@ -740,9 +794,13 @@ var Tool = class extends BaseResource {
740
794
  if (params.runId) {
741
795
  url.set("runId", params.runId);
742
796
  }
797
+ const body = {
798
+ data: params.data,
799
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
800
+ };
743
801
  return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
744
802
  method: "POST",
745
- body: params.data
803
+ body
746
804
  });
747
805
  }
748
806
  };
@@ -854,9 +912,10 @@ var VNextWorkflow = class extends BaseResource {
854
912
  * @returns Promise containing success message
855
913
  */
856
914
  start(params) {
915
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
857
916
  return this.request(`/api/workflows/v-next/${this.workflowId}/start?runId=${params.runId}`, {
858
917
  method: "POST",
859
- body: { inputData: params?.inputData, runtimeContext: params.runtimeContext }
918
+ body: { inputData: params?.inputData, runtimeContext }
860
919
  });
861
920
  }
862
921
  /**
@@ -868,8 +927,9 @@ var VNextWorkflow = class extends BaseResource {
868
927
  step,
869
928
  runId,
870
929
  resumeData,
871
- runtimeContext
930
+ ...rest
872
931
  }) {
932
+ const runtimeContext = rest.runtimeContext ? Object.fromEntries(rest.runtimeContext.entries()) : void 0;
873
933
  return this.request(`/api/workflows/v-next/${this.workflowId}/resume?runId=${runId}`, {
874
934
  method: "POST",
875
935
  stream: true,
@@ -890,9 +950,10 @@ var VNextWorkflow = class extends BaseResource {
890
950
  if (!!params?.runId) {
891
951
  searchParams.set("runId", params.runId);
892
952
  }
953
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
893
954
  return this.request(`/api/workflows/v-next/${this.workflowId}/start-async?${searchParams.toString()}`, {
894
955
  method: "POST",
895
- body: { inputData: params.inputData, runtimeContext: params.runtimeContext }
956
+ body: { inputData: params.inputData, runtimeContext }
896
957
  });
897
958
  }
898
959
  /**
@@ -901,12 +962,13 @@ var VNextWorkflow = class extends BaseResource {
901
962
  * @returns Promise containing the vNext workflow resume results
902
963
  */
903
964
  resumeAsync(params) {
965
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
904
966
  return this.request(`/api/workflows/v-next/${this.workflowId}/resume-async?runId=${params.runId}`, {
905
967
  method: "POST",
906
968
  body: {
907
969
  step: params.step,
908
970
  resumeData: params.resumeData,
909
- runtimeContext: params.runtimeContext
971
+ runtimeContext
910
972
  }
911
973
  });
912
974
  }
@@ -931,6 +993,114 @@ var VNextWorkflow = class extends BaseResource {
931
993
  }
932
994
  };
933
995
 
996
+ // src/resources/a2a.ts
997
+ var A2A = class extends BaseResource {
998
+ constructor(options, agentId) {
999
+ super(options);
1000
+ this.agentId = agentId;
1001
+ }
1002
+ /**
1003
+ * Get the agent card with metadata about the agent
1004
+ * @returns Promise containing the agent card information
1005
+ */
1006
+ async getCard() {
1007
+ return this.request(`/.well-known/${this.agentId}/agent.json`);
1008
+ }
1009
+ /**
1010
+ * Send a message to the agent and get a response
1011
+ * @param params - Parameters for the task
1012
+ * @returns Promise containing the task response
1013
+ */
1014
+ async sendMessage(params) {
1015
+ const response = await this.request(`/a2a/${this.agentId}`, {
1016
+ method: "POST",
1017
+ body: {
1018
+ method: "tasks/send",
1019
+ params
1020
+ }
1021
+ });
1022
+ return { task: response.result };
1023
+ }
1024
+ /**
1025
+ * Get the status and result of a task
1026
+ * @param params - Parameters for querying the task
1027
+ * @returns Promise containing the task response
1028
+ */
1029
+ async getTask(params) {
1030
+ const response = await this.request(`/a2a/${this.agentId}`, {
1031
+ method: "POST",
1032
+ body: {
1033
+ method: "tasks/get",
1034
+ params
1035
+ }
1036
+ });
1037
+ return response.result;
1038
+ }
1039
+ /**
1040
+ * Cancel a running task
1041
+ * @param params - Parameters identifying the task to cancel
1042
+ * @returns Promise containing the task response
1043
+ */
1044
+ async cancelTask(params) {
1045
+ return this.request(`/a2a/${this.agentId}`, {
1046
+ method: "POST",
1047
+ body: {
1048
+ method: "tasks/cancel",
1049
+ params
1050
+ }
1051
+ });
1052
+ }
1053
+ /**
1054
+ * Send a message and subscribe to streaming updates (not fully implemented)
1055
+ * @param params - Parameters for the task
1056
+ * @returns Promise containing the task response
1057
+ */
1058
+ async sendAndSubscribe(params) {
1059
+ return this.request(`/a2a/${this.agentId}`, {
1060
+ method: "POST",
1061
+ body: {
1062
+ method: "tasks/sendSubscribe",
1063
+ params
1064
+ },
1065
+ stream: true
1066
+ });
1067
+ }
1068
+ };
1069
+
1070
+ // src/resources/mcp-tool.ts
1071
+ var MCPTool = class extends BaseResource {
1072
+ serverId;
1073
+ toolId;
1074
+ constructor(options, serverId, toolId) {
1075
+ super(options);
1076
+ this.serverId = serverId;
1077
+ this.toolId = toolId;
1078
+ }
1079
+ /**
1080
+ * Retrieves details about this specific tool from the MCP server.
1081
+ * @returns Promise containing the tool's information (name, description, schema).
1082
+ */
1083
+ details() {
1084
+ return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}`);
1085
+ }
1086
+ /**
1087
+ * Executes this specific tool on the MCP server.
1088
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
1089
+ * @returns Promise containing the result of the tool execution.
1090
+ */
1091
+ execute(params) {
1092
+ const body = {};
1093
+ if (params.data !== void 0) body.data = params.data;
1094
+ if (params.runtimeContext !== void 0) {
1095
+ body.runtimeContext = params.runtimeContext;
1096
+ }
1097
+ return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}/execute`, {
1098
+ method: "POST",
1099
+ body: Object.keys(body).length > 0 ? body : void 0
1100
+ });
1101
+ }
1102
+ };
1103
+
934
1104
  // src/client.ts
935
1105
  var MastraClient = class extends BaseResource {
936
1106
  constructor(options) {
@@ -1141,6 +1311,62 @@ var MastraClient = class extends BaseResource {
1141
1311
  getNetwork(networkId) {
1142
1312
  return new Network(this.options, networkId);
1143
1313
  }
1314
+ /**
1315
+ * Retrieves a list of available MCP servers.
1316
+ * @param params - Optional parameters for pagination (limit, offset).
1317
+ * @returns Promise containing the list of MCP servers and pagination info.
1318
+ */
1319
+ getMcpServers(params) {
1320
+ const searchParams = new URLSearchParams();
1321
+ if (params?.limit !== void 0) {
1322
+ searchParams.set("limit", String(params.limit));
1323
+ }
1324
+ if (params?.offset !== void 0) {
1325
+ searchParams.set("offset", String(params.offset));
1326
+ }
1327
+ const queryString = searchParams.toString();
1328
+ return this.request(`/api/mcp/v0/servers${queryString ? `?${queryString}` : ""}`);
1329
+ }
1330
+ /**
1331
+ * Retrieves detailed information for a specific MCP server.
1332
+ * @param serverId - The ID of the MCP server to retrieve.
1333
+ * @param params - Optional parameters, e.g., specific version.
1334
+ * @returns Promise containing the detailed MCP server information.
1335
+ */
1336
+ getMcpServerDetails(serverId, params) {
1337
+ const searchParams = new URLSearchParams();
1338
+ if (params?.version) {
1339
+ searchParams.set("version", params.version);
1340
+ }
1341
+ const queryString = searchParams.toString();
1342
+ return this.request(`/api/mcp/v0/servers/${serverId}${queryString ? `?${queryString}` : ""}`);
1343
+ }
1344
+ /**
1345
+ * Retrieves a list of tools for a specific MCP server.
1346
+ * @param serverId - The ID of the MCP server.
1347
+ * @returns Promise containing the list of tools.
1348
+ */
1349
+ getMcpServerTools(serverId) {
1350
+ return this.request(`/api/mcp/${serverId}/tools`);
1351
+ }
1352
+ /**
1353
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1354
+ * This instance can then be used to fetch details or execute the tool.
1355
+ * @param serverId - The ID of the MCP server.
1356
+ * @param toolId - The ID of the tool.
1357
+ * @returns MCPTool instance.
1358
+ */
1359
+ getMcpServerTool(serverId, toolId) {
1360
+ return new MCPTool(this.options, serverId, toolId);
1361
+ }
1362
+ /**
1363
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1364
+ * @param agentId - ID of the agent to interact with
1365
+ * @returns A2A client instance
1366
+ */
1367
+ getA2A(agentId) {
1368
+ return new A2A(this.options, agentId);
1369
+ }
1144
1370
  };
1145
1371
 
1146
1372
  exports.MastraClient = MastraClient;