@mastra/client-js 0.1.22 → 0.2.0-alpha.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.1.22-alpha.4 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.2.0-alpha.1 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 38.25 KB
13
- ESM ⚡️ Build success in 1681ms
14
- CJS dist/index.cjs 38.52 KB
15
- CJS ⚡️ Build success in 1692ms
12
+ CJS dist/index.cjs 41.29 KB
13
+ CJS ⚡️ Build success in 1179ms
14
+ ESM dist/index.js 41.00 KB
15
+ ESM ⚡️ Build success in 1188ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 14091ms
18
- DTS dist/index.d.ts 27.63 KB
19
- DTS dist/index.d.cts 27.63 KB
17
+ DTS ⚡️ Build success in 13211ms
18
+ DTS dist/index.d.ts 30.61 KB
19
+ DTS dist/index.d.cts 30.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.2.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 83da932: Move @mastra/core to peerdeps
8
+ - 5eb5a99: Remove pino from @mastra/core into @mastra/loggers
9
+
10
+ ### Patch Changes
11
+
12
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
13
+ - 0215b0b: Add description to vnext workflow response
14
+ - 5063646: Accept plain obects as runtimeContext
15
+ - Updated dependencies [b3a3d63]
16
+ - Updated dependencies [344f453]
17
+ - Updated dependencies [0a3ae6d]
18
+ - Updated dependencies [95911be]
19
+ - Updated dependencies [5eb5a99]
20
+ - Updated dependencies [7e632c5]
21
+ - Updated dependencies [1e9fbfa]
22
+ - Updated dependencies [b2ae5aa]
23
+ - Updated dependencies [a7292b0]
24
+ - Updated dependencies [0dcb9f0]
25
+ - @mastra/core@0.10.0-alpha.1
26
+
27
+ ## 0.1.23-alpha.0
28
+
29
+ ### Patch Changes
30
+
31
+ - f53a6ac: Add VNextWorkflowRuns type
32
+ - ccdabdc: Remove trailing / from mastraClient baseUrl
33
+ - a6e3881: Remove non serializable options from agent stream,generate
34
+ - fddae56: Add telemetry to cliend SDK streamParams
35
+ - 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.
36
+ - 2672a05: Add MCP servers and tool call execution to playground
37
+ - Updated dependencies [f53a6ac]
38
+ - Updated dependencies [eabdcd9]
39
+ - Updated dependencies [90be034]
40
+ - Updated dependencies [99f050a]
41
+ - Updated dependencies [d0ee3c6]
42
+ - Updated dependencies [23f258c]
43
+ - Updated dependencies [2672a05]
44
+ - @mastra/core@0.9.5-alpha.0
45
+
3
46
  ## 0.1.22
4
47
 
5
48
  ### 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 runtimeContext = require('@mastra/core/runtime-context');
8
9
 
9
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
11
 
@@ -220,7 +221,7 @@ var BaseResource = class {
220
221
  let delay = backoffMs;
221
222
  for (let attempt = 0; attempt <= retries; attempt++) {
222
223
  try {
223
- const response = await fetch(`${baseUrl}${path}`, {
224
+ const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
224
225
  ...options,
225
226
  headers: {
226
227
  ...headers,
@@ -260,6 +261,15 @@ var BaseResource = class {
260
261
  throw lastError || new Error("Request failed");
261
262
  }
262
263
  };
264
+ function parseClientRuntimeContext(runtimeContext$1) {
265
+ if (runtimeContext$1) {
266
+ if (runtimeContext$1 instanceof runtimeContext.RuntimeContext) {
267
+ return Object.fromEntries(runtimeContext$1.entries());
268
+ }
269
+ return runtimeContext$1;
270
+ }
271
+ return void 0;
272
+ }
263
273
 
264
274
  // src/resources/agent.ts
265
275
  var AgentVoice = class extends BaseResource {
@@ -331,9 +341,9 @@ var Agent = class extends BaseResource {
331
341
  generate(params) {
332
342
  const processedParams = {
333
343
  ...params,
334
- output: zodToJsonSchema(params.output),
335
- experimental_output: zodToJsonSchema(params.experimental_output),
336
- runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
344
+ output: params.output ? zodToJsonSchema(params.output) : void 0,
345
+ experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
346
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext)
337
347
  };
338
348
  return this.request(`/api/agents/${this.agentId}/generate`, {
339
349
  method: "POST",
@@ -348,9 +358,9 @@ var Agent = class extends BaseResource {
348
358
  async stream(params) {
349
359
  const processedParams = {
350
360
  ...params,
351
- output: zodToJsonSchema(params.output),
352
- experimental_output: zodToJsonSchema(params.experimental_output),
353
- runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
361
+ output: params.output ? zodToJsonSchema(params.output) : void 0,
362
+ experimental_output: params.experimental_output ? zodToJsonSchema(params.experimental_output) : void 0,
363
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext)
354
364
  };
355
365
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
356
366
  method: "POST",
@@ -578,24 +588,24 @@ var Vector = class extends BaseResource {
578
588
  }
579
589
  };
580
590
 
581
- // src/resources/workflow.ts
591
+ // src/resources/legacy-workflow.ts
582
592
  var RECORD_SEPARATOR = "";
583
- var Workflow = class extends BaseResource {
593
+ var LegacyWorkflow = class extends BaseResource {
584
594
  constructor(options, workflowId) {
585
595
  super(options);
586
596
  this.workflowId = workflowId;
587
597
  }
588
598
  /**
589
- * Retrieves details about the workflow
590
- * @returns Promise containing workflow details including steps and graphs
599
+ * Retrieves details about the legacy workflow
600
+ * @returns Promise containing legacy workflow details including steps and graphs
591
601
  */
592
602
  details() {
593
- return this.request(`/api/workflows/${this.workflowId}`);
603
+ return this.request(`/api/workflows/legacy/${this.workflowId}`);
594
604
  }
595
605
  /**
596
- * Retrieves all runs for a workflow
606
+ * Retrieves all runs for a legacy workflow
597
607
  * @param params - Parameters for filtering runs
598
- * @returns Promise containing workflow runs array
608
+ * @returns Promise containing legacy workflow runs array
599
609
  */
600
610
  runs(params) {
601
611
  const searchParams = new URLSearchParams();
@@ -615,25 +625,13 @@ var Workflow = class extends BaseResource {
615
625
  searchParams.set("resourceId", params.resourceId);
616
626
  }
617
627
  if (searchParams.size) {
618
- return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
628
+ return this.request(`/api/workflows/legacy/${this.workflowId}/runs?${searchParams}`);
619
629
  } else {
620
- return this.request(`/api/workflows/${this.workflowId}/runs`);
630
+ return this.request(`/api/workflows/legacy/${this.workflowId}/runs`);
621
631
  }
622
632
  }
623
633
  /**
624
- * @deprecated Use `startAsync` instead
625
- * Executes the workflow with the provided parameters
626
- * @param params - Parameters required for workflow execution
627
- * @returns Promise containing the workflow execution results
628
- */
629
- execute(params) {
630
- return this.request(`/api/workflows/${this.workflowId}/execute`, {
631
- method: "POST",
632
- body: params
633
- });
634
- }
635
- /**
636
- * Creates a new workflow run
634
+ * Creates a new legacy workflow run
637
635
  * @returns Promise containing the generated run ID
638
636
  */
639
637
  createRun(params) {
@@ -641,34 +639,34 @@ var Workflow = class extends BaseResource {
641
639
  if (!!params?.runId) {
642
640
  searchParams.set("runId", params.runId);
643
641
  }
644
- return this.request(`/api/workflows/${this.workflowId}/createRun?${searchParams.toString()}`, {
642
+ return this.request(`/api/workflows/legacy/${this.workflowId}/create-run?${searchParams.toString()}`, {
645
643
  method: "POST"
646
644
  });
647
645
  }
648
646
  /**
649
- * Starts a workflow run synchronously without waiting for the workflow to complete
647
+ * Starts a legacy workflow run synchronously without waiting for the workflow to complete
650
648
  * @param params - Object containing the runId and triggerData
651
649
  * @returns Promise containing success message
652
650
  */
653
651
  start(params) {
654
- return this.request(`/api/workflows/${this.workflowId}/start?runId=${params.runId}`, {
652
+ return this.request(`/api/workflows/legacy/${this.workflowId}/start?runId=${params.runId}`, {
655
653
  method: "POST",
656
654
  body: params?.triggerData
657
655
  });
658
656
  }
659
657
  /**
660
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
658
+ * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
661
659
  * @param stepId - ID of the step to resume
662
- * @param runId - ID of the workflow run
663
- * @param context - Context to resume the workflow with
664
- * @returns Promise containing the workflow resume results
660
+ * @param runId - ID of the legacy workflow run
661
+ * @param context - Context to resume the legacy workflow with
662
+ * @returns Promise containing the legacy workflow resume results
665
663
  */
666
664
  resume({
667
665
  stepId,
668
666
  runId,
669
667
  context
670
668
  }) {
671
- return this.request(`/api/workflows/${this.workflowId}/resume?runId=${runId}`, {
669
+ return this.request(`/api/workflows/legacy/${this.workflowId}/resume?runId=${runId}`, {
672
670
  method: "POST",
673
671
  body: {
674
672
  stepId,
@@ -686,18 +684,18 @@ var Workflow = class extends BaseResource {
686
684
  if (!!params?.runId) {
687
685
  searchParams.set("runId", params.runId);
688
686
  }
689
- return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
687
+ return this.request(`/api/workflows/legacy/${this.workflowId}/start-async?${searchParams.toString()}`, {
690
688
  method: "POST",
691
689
  body: params?.triggerData
692
690
  });
693
691
  }
694
692
  /**
695
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
693
+ * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
696
694
  * @param params - Object containing the runId, stepId, and context
697
695
  * @returns Promise containing the workflow resume results
698
696
  */
699
697
  resumeAsync(params) {
700
- return this.request(`/api/workflows/${this.workflowId}/resume-async?runId=${params.runId}`, {
698
+ return this.request(`/api/workflows/legacy/${this.workflowId}/resume-async?runId=${params.runId}`, {
701
699
  method: "POST",
702
700
  body: {
703
701
  stepId: params.stepId,
@@ -751,16 +749,16 @@ var Workflow = class extends BaseResource {
751
749
  }
752
750
  }
753
751
  /**
754
- * Watches workflow transitions in real-time
752
+ * Watches legacy workflow transitions in real-time
755
753
  * @param runId - Optional run ID to filter the watch stream
756
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
754
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
757
755
  */
758
756
  async watch({ runId }, onRecord) {
759
- const response = await this.request(`/api/workflows/${this.workflowId}/watch?runId=${runId}`, {
757
+ const response = await this.request(`/api/workflows/legacy/${this.workflowId}/watch?runId=${runId}`, {
760
758
  stream: true
761
759
  });
762
760
  if (!response.ok) {
763
- throw new Error(`Failed to watch workflow: ${response.statusText}`);
761
+ throw new Error(`Failed to watch legacy workflow: ${response.statusText}`);
764
762
  }
765
763
  if (!response.body) {
766
764
  throw new Error("Response body is null");
@@ -796,7 +794,7 @@ var Tool = class extends BaseResource {
796
794
  }
797
795
  const body = {
798
796
  data: params.data,
799
- runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
797
+ runtimeContext: parseClientRuntimeContext(params.runtimeContext)
800
798
  };
801
799
  return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
802
800
  method: "POST",
@@ -804,14 +802,16 @@ var Tool = class extends BaseResource {
804
802
  });
805
803
  }
806
804
  };
805
+
806
+ // src/resources/workflow.ts
807
807
  var RECORD_SEPARATOR2 = "";
808
- var VNextWorkflow = class extends BaseResource {
808
+ var Workflow = class extends BaseResource {
809
809
  constructor(options, workflowId) {
810
810
  super(options);
811
811
  this.workflowId = workflowId;
812
812
  }
813
813
  /**
814
- * Creates an async generator that processes a readable stream and yields vNext workflow records
814
+ * Creates an async generator that processes a readable stream and yields workflow records
815
815
  * separated by the Record Separator character (\x1E)
816
816
  *
817
817
  * @param stream - The readable stream to process
@@ -856,16 +856,16 @@ var VNextWorkflow = class extends BaseResource {
856
856
  }
857
857
  }
858
858
  /**
859
- * Retrieves details about the vNext workflow
860
- * @returns Promise containing vNext workflow details including steps and graphs
859
+ * Retrieves details about the workflow
860
+ * @returns Promise containing workflow details including steps and graphs
861
861
  */
862
862
  details() {
863
- return this.request(`/api/workflows/v-next/${this.workflowId}`);
863
+ return this.request(`/api/workflows/${this.workflowId}`);
864
864
  }
865
865
  /**
866
- * Retrieves all runs for a vNext workflow
866
+ * Retrieves all runs for a workflow
867
867
  * @param params - Parameters for filtering runs
868
- * @returns Promise containing vNext workflow runs array
868
+ * @returns Promise containing workflow runs array
869
869
  */
870
870
  runs(params) {
871
871
  const searchParams = new URLSearchParams();
@@ -885,13 +885,13 @@ var VNextWorkflow = class extends BaseResource {
885
885
  searchParams.set("resourceId", params.resourceId);
886
886
  }
887
887
  if (searchParams.size) {
888
- return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
888
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
889
889
  } else {
890
- return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
890
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
891
891
  }
892
892
  }
893
893
  /**
894
- * Creates a new vNext workflow run
894
+ * Creates a new workflow run
895
895
  * @param params - Optional object containing the optional runId
896
896
  * @returns Promise containing the runId of the created run
897
897
  */
@@ -900,24 +900,24 @@ var VNextWorkflow = class extends BaseResource {
900
900
  if (!!params?.runId) {
901
901
  searchParams.set("runId", params.runId);
902
902
  }
903
- return this.request(`/api/workflows/v-next/${this.workflowId}/create-run?${searchParams.toString()}`, {
903
+ return this.request(`/api/workflows/${this.workflowId}/create-run?${searchParams.toString()}`, {
904
904
  method: "POST"
905
905
  });
906
906
  }
907
907
  /**
908
- * Starts a vNext workflow run synchronously without waiting for the workflow to complete
908
+ * Starts a workflow run synchronously without waiting for the workflow to complete
909
909
  * @param params - Object containing the runId, inputData and runtimeContext
910
910
  * @returns Promise containing success message
911
911
  */
912
912
  start(params) {
913
- const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
914
- return this.request(`/api/workflows/v-next/${this.workflowId}/start?runId=${params.runId}`, {
913
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
914
+ return this.request(`/api/workflows/${this.workflowId}/start?runId=${params.runId}`, {
915
915
  method: "POST",
916
916
  body: { inputData: params?.inputData, runtimeContext }
917
917
  });
918
918
  }
919
919
  /**
920
- * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
920
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
921
921
  * @param params - Object containing the runId, step, resumeData and runtimeContext
922
922
  * @returns Promise containing success message
923
923
  */
@@ -927,8 +927,8 @@ var VNextWorkflow = class extends BaseResource {
927
927
  resumeData,
928
928
  ...rest
929
929
  }) {
930
- const runtimeContext = rest.runtimeContext ? Object.fromEntries(rest.runtimeContext.entries()) : void 0;
931
- return this.request(`/api/workflows/v-next/${this.workflowId}/resume?runId=${runId}`, {
930
+ const runtimeContext = parseClientRuntimeContext(rest.runtimeContext);
931
+ return this.request(`/api/workflows/${this.workflowId}/resume?runId=${runId}`, {
932
932
  method: "POST",
933
933
  stream: true,
934
934
  body: {
@@ -939,29 +939,29 @@ var VNextWorkflow = class extends BaseResource {
939
939
  });
940
940
  }
941
941
  /**
942
- * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
942
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
943
943
  * @param params - Object containing the optional runId, inputData and runtimeContext
944
- * @returns Promise containing the vNext workflow execution results
944
+ * @returns Promise containing the workflow execution results
945
945
  */
946
946
  startAsync(params) {
947
947
  const searchParams = new URLSearchParams();
948
948
  if (!!params?.runId) {
949
949
  searchParams.set("runId", params.runId);
950
950
  }
951
- const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
952
- return this.request(`/api/workflows/v-next/${this.workflowId}/start-async?${searchParams.toString()}`, {
951
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
952
+ return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
953
953
  method: "POST",
954
954
  body: { inputData: params.inputData, runtimeContext }
955
955
  });
956
956
  }
957
957
  /**
958
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
958
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
959
959
  * @param params - Object containing the runId, step, resumeData and runtimeContext
960
- * @returns Promise containing the vNext workflow resume results
960
+ * @returns Promise containing the workflow resume results
961
961
  */
962
962
  resumeAsync(params) {
963
- const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
964
- return this.request(`/api/workflows/v-next/${this.workflowId}/resume-async?runId=${params.runId}`, {
963
+ const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
964
+ return this.request(`/api/workflows/${this.workflowId}/resume-async?runId=${params.runId}`, {
965
965
  method: "POST",
966
966
  body: {
967
967
  step: params.step,
@@ -971,16 +971,16 @@ var VNextWorkflow = class extends BaseResource {
971
971
  });
972
972
  }
973
973
  /**
974
- * Watches vNext workflow transitions in real-time
974
+ * Watches workflow transitions in real-time
975
975
  * @param runId - Optional run ID to filter the watch stream
976
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
976
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
977
977
  */
978
978
  async watch({ runId }, onRecord) {
979
- const response = await this.request(`/api/workflows/v-next/${this.workflowId}/watch?runId=${runId}`, {
979
+ const response = await this.request(`/api/workflows/${this.workflowId}/watch?runId=${runId}`, {
980
980
  stream: true
981
981
  });
982
982
  if (!response.ok) {
983
- throw new Error(`Failed to watch vNext workflow: ${response.statusText}`);
983
+ throw new Error(`Failed to watch workflow: ${response.statusText}`);
984
984
  }
985
985
  if (!response.body) {
986
986
  throw new Error("Response body is null");
@@ -1065,6 +1065,40 @@ var A2A = class extends BaseResource {
1065
1065
  }
1066
1066
  };
1067
1067
 
1068
+ // src/resources/mcp-tool.ts
1069
+ var MCPTool = class extends BaseResource {
1070
+ serverId;
1071
+ toolId;
1072
+ constructor(options, serverId, toolId) {
1073
+ super(options);
1074
+ this.serverId = serverId;
1075
+ this.toolId = toolId;
1076
+ }
1077
+ /**
1078
+ * Retrieves details about this specific tool from the MCP server.
1079
+ * @returns Promise containing the tool's information (name, description, schema).
1080
+ */
1081
+ details() {
1082
+ return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}`);
1083
+ }
1084
+ /**
1085
+ * Executes this specific tool on the MCP server.
1086
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
1087
+ * @returns Promise containing the result of the tool execution.
1088
+ */
1089
+ execute(params) {
1090
+ const body = {};
1091
+ if (params.data !== void 0) body.data = params.data;
1092
+ if (params.runtimeContext !== void 0) {
1093
+ body.runtimeContext = params.runtimeContext;
1094
+ }
1095
+ return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}/execute`, {
1096
+ method: "POST",
1097
+ body: Object.keys(body).length > 0 ? body : void 0
1098
+ });
1099
+ }
1100
+ };
1101
+
1068
1102
  // src/client.ts
1069
1103
  var MastraClient = class extends BaseResource {
1070
1104
  constructor(options) {
@@ -1157,6 +1191,21 @@ var MastraClient = class extends BaseResource {
1157
1191
  getTool(toolId) {
1158
1192
  return new Tool(this.options, toolId);
1159
1193
  }
1194
+ /**
1195
+ * Retrieves all available legacy workflows
1196
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1197
+ */
1198
+ getLegacyWorkflows() {
1199
+ return this.request("/api/workflows/legacy");
1200
+ }
1201
+ /**
1202
+ * Gets a legacy workflow instance by ID
1203
+ * @param workflowId - ID of the legacy workflow to retrieve
1204
+ * @returns Legacy Workflow instance
1205
+ */
1206
+ getLegacyWorkflow(workflowId) {
1207
+ return new LegacyWorkflow(this.options, workflowId);
1208
+ }
1160
1209
  /**
1161
1210
  * Retrieves all available workflows
1162
1211
  * @returns Promise containing map of workflow IDs to workflow details
@@ -1172,21 +1221,6 @@ var MastraClient = class extends BaseResource {
1172
1221
  getWorkflow(workflowId) {
1173
1222
  return new Workflow(this.options, workflowId);
1174
1223
  }
1175
- /**
1176
- * Retrieves all available vNext workflows
1177
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
1178
- */
1179
- getVNextWorkflows() {
1180
- return this.request("/api/workflows/v-next");
1181
- }
1182
- /**
1183
- * Gets a vNext workflow instance by ID
1184
- * @param workflowId - ID of the vNext workflow to retrieve
1185
- * @returns vNext Workflow instance
1186
- */
1187
- getVNextWorkflow(workflowId) {
1188
- return new VNextWorkflow(this.options, workflowId);
1189
- }
1190
1224
  /**
1191
1225
  * Gets a vector instance by name
1192
1226
  * @param vectorName - Name of the vector to retrieve
@@ -1275,6 +1309,54 @@ var MastraClient = class extends BaseResource {
1275
1309
  getNetwork(networkId) {
1276
1310
  return new Network(this.options, networkId);
1277
1311
  }
1312
+ /**
1313
+ * Retrieves a list of available MCP servers.
1314
+ * @param params - Optional parameters for pagination (limit, offset).
1315
+ * @returns Promise containing the list of MCP servers and pagination info.
1316
+ */
1317
+ getMcpServers(params) {
1318
+ const searchParams = new URLSearchParams();
1319
+ if (params?.limit !== void 0) {
1320
+ searchParams.set("limit", String(params.limit));
1321
+ }
1322
+ if (params?.offset !== void 0) {
1323
+ searchParams.set("offset", String(params.offset));
1324
+ }
1325
+ const queryString = searchParams.toString();
1326
+ return this.request(`/api/mcp/v0/servers${queryString ? `?${queryString}` : ""}`);
1327
+ }
1328
+ /**
1329
+ * Retrieves detailed information for a specific MCP server.
1330
+ * @param serverId - The ID of the MCP server to retrieve.
1331
+ * @param params - Optional parameters, e.g., specific version.
1332
+ * @returns Promise containing the detailed MCP server information.
1333
+ */
1334
+ getMcpServerDetails(serverId, params) {
1335
+ const searchParams = new URLSearchParams();
1336
+ if (params?.version) {
1337
+ searchParams.set("version", params.version);
1338
+ }
1339
+ const queryString = searchParams.toString();
1340
+ return this.request(`/api/mcp/v0/servers/${serverId}${queryString ? `?${queryString}` : ""}`);
1341
+ }
1342
+ /**
1343
+ * Retrieves a list of tools for a specific MCP server.
1344
+ * @param serverId - The ID of the MCP server.
1345
+ * @returns Promise containing the list of tools.
1346
+ */
1347
+ getMcpServerTools(serverId) {
1348
+ return this.request(`/api/mcp/${serverId}/tools`);
1349
+ }
1350
+ /**
1351
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1352
+ * This instance can then be used to fetch details or execute the tool.
1353
+ * @param serverId - The ID of the MCP server.
1354
+ * @param toolId - The ID of the tool.
1355
+ * @returns MCPTool instance.
1356
+ */
1357
+ getMcpServerTool(serverId, toolId) {
1358
+ return new MCPTool(this.options, serverId, toolId);
1359
+ }
1278
1360
  /**
1279
1361
  * Gets an A2A client for interacting with an agent via the A2A protocol
1280
1362
  * @param agentId - ID of the agent to interact with