@mastra/core 0.9.4 → 0.9.5-alpha.0

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.
Files changed (95) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +5 -5
  3. package/dist/agent/index.d.ts +5 -5
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CAEcd6q2.d.cts → base-BV8SNIdm.d.cts} +301 -42
  6. package/dist/{base-BCfssGt6.d.ts → base-CI7Uz2GO.d.ts} +301 -42
  7. package/dist/{chunk-H4CEZSRM.js → chunk-6EPEYXAE.js} +1 -1
  8. package/dist/{chunk-XRGDVLM4.cjs → chunk-BATBI3D4.cjs} +5 -5
  9. package/dist/{chunk-WIKOYZ63.js → chunk-BZUIFK6C.js} +1 -1
  10. package/dist/{chunk-GXKODTLA.cjs → chunk-EYQLTWRJ.cjs} +55 -15
  11. package/dist/{chunk-EJITEVAB.cjs → chunk-F7HNPG53.cjs} +24 -1
  12. package/dist/{chunk-WE36CRQV.cjs → chunk-HKCSQI7G.cjs} +2 -2
  13. package/dist/{chunk-4WABQORE.js → chunk-JMJXBE7L.js} +139 -77
  14. package/dist/{chunk-5JUWUTPJ.cjs → chunk-LF5CE7LU.cjs} +2 -2
  15. package/dist/{chunk-S34QVMKE.js → chunk-MF5BUJO6.js} +21 -2
  16. package/dist/{chunk-WQKOM7XM.cjs → chunk-NQE264UM.cjs} +1 -1
  17. package/dist/{chunk-PEK4TY3P.js → chunk-PU2TNRKO.js} +1 -1
  18. package/dist/{chunk-SOLXHDNQ.js → chunk-RVKA5VUT.js} +51 -11
  19. package/dist/{chunk-FW5RS6WV.js → chunk-RWWUZTAK.js} +4 -4
  20. package/dist/{chunk-66GQROSI.cjs → chunk-S3Y7QBO7.cjs} +15 -15
  21. package/dist/{chunk-NZV4OA6P.js → chunk-SU4O2A72.js} +1 -1
  22. package/dist/{chunk-QHDPLMHB.cjs → chunk-UCZWRJRW.cjs} +8 -8
  23. package/dist/{chunk-QDAMIZY3.cjs → chunk-YNOTY72R.cjs} +140 -78
  24. package/dist/{chunk-CIEPFV6B.js → chunk-ZY2DW2VQ.js} +3 -3
  25. package/dist/eval/index.d.cts +4 -4
  26. package/dist/eval/index.d.ts +4 -4
  27. package/dist/index.cjs +87 -71
  28. package/dist/index.d.cts +4 -4
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +12 -12
  31. package/dist/integration/index.cjs +3 -3
  32. package/dist/integration/index.d.cts +4 -4
  33. package/dist/integration/index.d.ts +4 -4
  34. package/dist/integration/index.js +1 -1
  35. package/dist/llm/index.d.cts +6 -6
  36. package/dist/llm/index.d.ts +6 -6
  37. package/dist/mastra/index.cjs +2 -2
  38. package/dist/mastra/index.d.cts +3 -3
  39. package/dist/mastra/index.d.ts +3 -3
  40. package/dist/mastra/index.js +1 -1
  41. package/dist/mcp/index.cjs +71 -13
  42. package/dist/mcp/index.d.cts +5 -5
  43. package/dist/mcp/index.d.ts +5 -5
  44. package/dist/mcp/index.js +67 -13
  45. package/dist/memory/index.cjs +4 -4
  46. package/dist/memory/index.d.cts +4 -4
  47. package/dist/memory/index.d.ts +4 -4
  48. package/dist/memory/index.js +1 -1
  49. package/dist/network/index.cjs +5 -5
  50. package/dist/network/index.d.cts +4 -4
  51. package/dist/network/index.d.ts +4 -4
  52. package/dist/network/index.js +3 -3
  53. package/dist/relevance/index.cjs +4 -4
  54. package/dist/relevance/index.d.cts +4 -4
  55. package/dist/relevance/index.d.ts +4 -4
  56. package/dist/relevance/index.js +1 -1
  57. package/dist/server/index.d.cts +3 -3
  58. package/dist/server/index.d.ts +3 -3
  59. package/dist/storage/index.d.cts +4 -4
  60. package/dist/storage/index.d.ts +4 -4
  61. package/dist/storage/libsql/index.cjs +15 -8
  62. package/dist/storage/libsql/index.d.cts +4 -4
  63. package/dist/storage/libsql/index.d.ts +4 -4
  64. package/dist/storage/libsql/index.js +15 -8
  65. package/dist/telemetry/index.d.cts +4 -4
  66. package/dist/telemetry/index.d.ts +4 -4
  67. package/dist/tools/index.cjs +4 -4
  68. package/dist/tools/index.d.cts +4 -4
  69. package/dist/tools/index.d.ts +4 -4
  70. package/dist/tools/index.js +1 -1
  71. package/dist/utils.cjs +28 -12
  72. package/dist/utils.d.cts +46 -2
  73. package/dist/utils.d.ts +46 -2
  74. package/dist/utils.js +1 -1
  75. package/dist/vector/index.cjs +2 -2
  76. package/dist/vector/index.d.cts +31 -9
  77. package/dist/vector/index.d.ts +31 -9
  78. package/dist/vector/index.js +1 -1
  79. package/dist/vector/libsql/index.cjs +3 -3
  80. package/dist/vector/libsql/index.d.cts +13 -9
  81. package/dist/vector/libsql/index.d.ts +13 -9
  82. package/dist/vector/libsql/index.js +1 -1
  83. package/dist/voice/index.d.cts +4 -4
  84. package/dist/voice/index.d.ts +4 -4
  85. package/dist/workflows/index.cjs +22 -22
  86. package/dist/workflows/index.d.cts +7 -7
  87. package/dist/workflows/index.d.ts +7 -7
  88. package/dist/workflows/index.js +1 -1
  89. package/dist/workflows/vNext/index.cjs +8 -6
  90. package/dist/workflows/vNext/index.d.cts +5 -5
  91. package/dist/workflows/vNext/index.d.ts +5 -5
  92. package/dist/workflows/vNext/index.js +6 -4
  93. package/package.json +2 -1
  94. /package/dist/{chunk-CTKNWYK2.js → chunk-GH6EMQSO.js} +0 -0
  95. /package/dist/{chunk-RAQBTCIR.cjs → chunk-T6DN4C76.cjs} +0 -0
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunk66GQROSI_cjs = require('../chunk-66GQROSI.cjs');
3
+ var chunkS3Y7QBO7_cjs = require('../chunk-S3Y7QBO7.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Agent", {
8
8
  enumerable: true,
9
- get: function () { return chunk66GQROSI_cjs.Agent; }
9
+ get: function () { return chunkS3Y7QBO7_cjs.Agent; }
10
10
  });
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, bl as AgentGenerateOptions, bm as AgentStreamOptions, bk as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bj as ToolsetsInput } from '../base-CAEcd6q2.cjs';
4
+ export { G as Agent, H as AgentConfig, bA as AgentGenerateOptions, bB as AgentStreamOptions, bz as DynamicArgument, b5 as MastraLanguageModel, b7 as ToolsInput, by as ToolsetsInput } from '../base-BV8SNIdm.cjs';
5
5
  import '../base-H7siSAfu.cjs';
6
6
  import '../types-BtMyV38I.cjs';
7
7
  import '../runtime-context/index.cjs';
@@ -12,12 +12,12 @@ import 'pino';
12
12
  import '@opentelemetry/api';
13
13
  import 'xstate';
14
14
  import 'node:events';
15
- import '../vector/index.cjs';
16
- import '../vector/filter/index.cjs';
17
- import '@opentelemetry/sdk-trace-base';
18
- import '../tts/index.cjs';
19
15
  import 'node:http';
20
16
  import 'hono';
17
+ import '../tts/index.cjs';
18
+ import '@opentelemetry/sdk-trace-base';
19
+ import '../vector/index.cjs';
20
+ import '../vector/filter/index.cjs';
21
21
  import 'events';
22
22
  import '../deployer/index.cjs';
23
23
  import '../bundler/index.cjs';
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, bl as AgentGenerateOptions, bm as AgentStreamOptions, bk as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bj as ToolsetsInput } from '../base-BCfssGt6.js';
4
+ export { G as Agent, H as AgentConfig, bA as AgentGenerateOptions, bB as AgentStreamOptions, bz as DynamicArgument, b5 as MastraLanguageModel, b7 as ToolsInput, by as ToolsetsInput } from '../base-CI7Uz2GO.js';
5
5
  import '../base-4Z34GQL8.js';
6
6
  import '../types-BtMyV38I.js';
7
7
  import '../runtime-context/index.js';
@@ -12,12 +12,12 @@ import 'pino';
12
12
  import '@opentelemetry/api';
13
13
  import 'xstate';
14
14
  import 'node:events';
15
- import '../vector/index.js';
16
- import '../vector/filter/index.js';
17
- import '@opentelemetry/sdk-trace-base';
18
- import '../tts/index.js';
19
15
  import 'node:http';
20
16
  import 'hono';
17
+ import '../tts/index.js';
18
+ import '@opentelemetry/sdk-trace-base';
19
+ import '../vector/index.js';
20
+ import '../vector/filter/index.js';
21
21
  import 'events';
22
22
  import '../deployer/index.js';
23
23
  import '../bundler/index.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-FW5RS6WV.js';
1
+ export { Agent } from '../chunk-RWWUZTAK.js';
@@ -11,10 +11,10 @@ import { Span } from '@opentelemetry/api';
11
11
  import * as xstate from 'xstate';
12
12
  import { Snapshot } from 'xstate';
13
13
  import EventEmitter from 'node:events';
14
- import { MastraVector } from './vector/index.cjs';
15
- import { MastraTTS } from './tts/index.cjs';
16
14
  import * as http from 'node:http';
17
15
  import { Context, Handler, MiddlewareHandler } from 'hono';
16
+ import { MastraTTS } from './tts/index.cjs';
17
+ import { MastraVector } from './vector/index.cjs';
18
18
  import EventEmitter$1 from 'events';
19
19
  import { MastraDeployer } from './deployer/index.cjs';
20
20
  import { cors } from 'hono/cors';
@@ -75,23 +75,6 @@ declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefine
75
75
  execute: (context: TContext) => Promise<any>;
76
76
  } : Tool<TSchemaIn, TSchemaOut, TContext>;
77
77
 
78
- /**
79
- * Configuration options for an MCP server
80
- */
81
- interface MCPServerConfig {
82
- /**
83
- * Name of the MCP server
84
- */
85
- name: string;
86
- /**
87
- * Version of the MCP server
88
- */
89
- version: string;
90
- /**
91
- * Tools to register with the MCP server
92
- */
93
- tools: ToolsInput;
94
- }
95
78
  type ConvertedTool = {
96
79
  name: string;
97
80
  description?: string;
@@ -156,34 +139,238 @@ interface MCPServerHTTPOptions {
156
139
  */
157
140
  options?: any;
158
141
  }
142
+ /** Describes a source code repository. */
143
+ interface Repository {
144
+ /** The URL of the repository (e.g., a GitHub URL). */
145
+ url: string;
146
+ /** The source control platform (e.g., 'github', 'gitlab'). */
147
+ source: 'github' | 'gitlab' | string;
148
+ /** A unique identifier for the repository at the source. */
149
+ id: string;
150
+ }
151
+ /** Provides details about a specific version of an MCP server. */
152
+ interface VersionDetail {
153
+ /** The semantic version string (e.g., "1.0.2"). */
154
+ version: string;
155
+ /** The ISO 8601 date-time string when this version was released or registered. */
156
+ release_date: string;
157
+ /** Indicates if this version is the latest available. */
158
+ is_latest: boolean;
159
+ }
160
+ /** Base interface for command-line arguments. */
161
+ interface ArgumentInfo {
162
+ /** The name of the argument. */
163
+ name: string;
164
+ /** A description of what the argument is for. */
165
+ description: string;
166
+ /** Whether the argument is required. */
167
+ is_required: boolean;
168
+ /** Whether the argument can be specified multiple times. */
169
+ is_repeatable?: boolean;
170
+ /** Whether the argument's value can be edited by the user (e.g., in a UI). */
171
+ is_editable?: boolean;
172
+ /** A list of predefined choices for the argument's value. */
173
+ choices?: string[];
174
+ /** The default value for the argument if not specified. */
175
+ default_value?: string | number | boolean;
176
+ }
177
+ /** Describes a positional argument for a command. */
178
+ interface PositionalArgumentInfo extends ArgumentInfo {
179
+ /** The 0-indexed position of the argument. */
180
+ position: number;
181
+ }
182
+ /** Describes a named argument (flag) for a command. */
183
+ interface NamedArgumentInfo extends ArgumentInfo {
184
+ /** The short flag for the argument (e.g., "-y"). */
185
+ short_flag?: string;
186
+ /** The long flag for the argument (e.g., "--yes"). */
187
+ long_flag?: string;
188
+ /** Whether the flag requires a value (e.g., `--config <value>`) or is a boolean flag. */
189
+ requires_value?: boolean;
190
+ }
191
+ /** Describes a subcommand for a command-line tool. */
192
+ interface SubcommandInfo {
193
+ /** The name of the subcommand (e.g., "run", "list"). */
194
+ name: string;
195
+ /** A description of what the subcommand does. */
196
+ description: string;
197
+ /** Whether this subcommand is required if its parent command is used. */
198
+ is_required?: boolean;
199
+ /** Nested subcommands. */
200
+ subcommands?: SubcommandInfo[];
201
+ /** Positional arguments for this subcommand. */
202
+ positional_arguments?: PositionalArgumentInfo[];
203
+ /** Named arguments (flags) for this subcommand. */
204
+ named_arguments?: NamedArgumentInfo[];
205
+ }
206
+ /** Describes a command to run an MCP server package. */
207
+ interface CommandInfo {
208
+ /** The primary command executable (e.g., "npx", "docker"). */
209
+ name: 'npx' | 'docker' | 'pypi' | 'uvx' | string;
210
+ /** Subcommands to append to the primary command. */
211
+ subcommands?: SubcommandInfo[];
212
+ /** Positional arguments for the command. */
213
+ positional_arguments?: PositionalArgumentInfo[];
214
+ /** Named arguments (flags) for the command. */
215
+ named_arguments?: NamedArgumentInfo[];
216
+ }
217
+ /** Describes an environment variable required or used by an MCP server package. */
218
+ interface EnvironmentVariableInfo {
219
+ /** The name of the environment variable (e.g., "API_KEY"). */
220
+ name: string;
221
+ /** A description of what the environment variable is for. */
222
+ description: string;
223
+ /** Whether the environment variable is required. */
224
+ required?: boolean;
225
+ /** The default value for the environment variable if not set. */
226
+ default_value?: string;
227
+ }
228
+ /** Describes an installable package for an MCP server. */
229
+ interface PackageInfo {
230
+ /** The name of the package registry (e.g., "npm", "docker"). */
231
+ registry_name: 'npm' | 'docker' | 'pypi' | 'homebrew' | string;
232
+ /** The name of the package. */
233
+ name: string;
234
+ /** The version of the package. */
235
+ version: string;
236
+ /** The command structure to run this package as an MCP server. */
237
+ command?: CommandInfo;
238
+ /** Environment variables relevant to this package. */
239
+ environment_variables?: EnvironmentVariableInfo[];
240
+ }
241
+ /** Describes a remote endpoint for accessing an MCP server. */
242
+ interface RemoteInfo {
243
+ /** The transport type for the remote connection (e.g., "sse", "streamable"). */
244
+ transport_type: 'streamable' | 'sse' | string;
245
+ /** The URL of the remote endpoint. */
246
+ url: string;
247
+ }
248
+ /** Configuration options for creating an MCPServer instance. */
249
+ interface MCPServerConfig {
250
+ /** The display name of the MCP server. */
251
+ name: string;
252
+ /** The semantic version of the MCP server. */
253
+ version: string;
254
+ /** The tools that this MCP server will expose. */
255
+ tools: ToolsInput;
256
+ /**
257
+ * Optional unique identifier for the server.
258
+ * If not provided, a UUID will be generated.
259
+ * If provided, this ID is considered final and cannot be changed by Mastra.
260
+ */
261
+ id?: string;
262
+ /** Optional description of the MCP server. */
263
+ description?: string;
264
+ /** Optional repository information for the server's source code. */
265
+ repository?: Repository;
266
+ /**
267
+ * Optional release date of this server version (ISO 8601 string).
268
+ * Defaults to the time of instantiation if not provided.
269
+ */
270
+ releaseDate?: string;
271
+ /**
272
+ * Optional flag indicating if this is the latest version.
273
+ * Defaults to true if not provided.
274
+ */
275
+ isLatest?: boolean;
276
+ /**
277
+ * Optional canonical packaging format if the server is distributed as a package
278
+ * (e.g., "npm", "docker").
279
+ */
280
+ packageCanonical?: 'npm' | 'docker' | 'pypi' | 'crates' | string;
281
+ /** Optional list of installable packages for this server. */
282
+ packages?: PackageInfo[];
283
+ /** Optional list of remote access points for this server. */
284
+ remotes?: RemoteInfo[];
285
+ }
286
+ /** Basic information about an MCP server, conforming to the MCP Registry 'Server' schema. */
287
+ interface ServerInfo {
288
+ /** The unique ID of the server. */
289
+ id: string;
290
+ /** The name of the server. */
291
+ name: string;
292
+ /** A description of the server. */
293
+ description?: string;
294
+ /** Repository information for the server. */
295
+ repository?: Repository;
296
+ /** Detailed version information. */
297
+ version_detail: VersionDetail;
298
+ }
299
+ /** Detailed information about an MCP server, conforming to the MCP Registry 'ServerDetail' schema. */
300
+ interface ServerDetailInfo extends ServerInfo {
301
+ /** The canonical packaging format, if applicable. */
302
+ package_canonical?: MCPServerConfig['packageCanonical'];
303
+ /** Information about installable packages for this server. */
304
+ packages?: PackageInfo[];
305
+ /** Information about remote access points for this server. */
306
+ remotes?: RemoteInfo[];
307
+ }
159
308
 
160
309
  /**
161
- * Abstract base class for MCP server implementations
162
- * This provides a common interface for all MCP servers that can be registered with Mastra
310
+ * Abstract base class for MCP server implementations.
311
+ * This provides a common interface and shared functionality for all MCP servers
312
+ * that can be registered with Mastra, including handling of server metadata.
163
313
  */
164
314
  declare abstract class MCPServerBase extends MastraBase {
315
+ /** Tracks if the server ID has been definitively set. */
316
+ private idWasSet;
317
+ /** The display name of the MCP server. */
318
+ readonly name: string;
319
+ /** The semantic version of the MCP server. */
320
+ readonly version: string;
321
+ /** Internal storage for the server's unique ID. */
322
+ private _id;
323
+ /** A description of what the MCP server does. */
324
+ readonly description?: string;
325
+ /** Repository information for the server's source code. */
326
+ readonly repository?: Repository;
327
+ /** The release date of this server version (ISO 8601 string). */
328
+ readonly releaseDate: string;
329
+ /** Indicates if this version is the latest available. */
330
+ readonly isLatest: boolean;
331
+ /** The canonical packaging format (e.g., "npm", "docker"), if applicable. */
332
+ readonly packageCanonical?: MCPServerConfig['packageCanonical'];
333
+ /** Information about installable packages for this server. */
334
+ readonly packages?: PackageInfo[];
335
+ /** Information about remote access points for this server. */
336
+ readonly remotes?: RemoteInfo[];
337
+ /** The tools registered with and converted by this MCP server. */
338
+ readonly convertedTools: Record<string, ConvertedTool>;
339
+ /** Reference to the Mastra instance if this server is registered with one. */
340
+ mastra: Mastra | undefined;
165
341
  /**
166
- * Name of the MCP server
342
+ * Public getter for the server's unique ID.
343
+ * The ID is set at construction or by Mastra and is read-only afterwards.
167
344
  */
168
- readonly name: string;
345
+ get id(): string;
169
346
  /**
170
- * Version of the MCP server
347
+ * Gets a read-only view of the registered tools.
348
+ * @returns A readonly record of converted tools.
171
349
  */
172
- readonly version: string;
350
+ tools(): Readonly<Record<string, ConvertedTool>>;
173
351
  /**
174
- * Tools registered with the MCP server
352
+ * Sets the server's unique ID. This method is typically called by Mastra when
353
+ * registering the server, using the key provided in the Mastra configuration.
354
+ * It ensures the ID is set only once.
355
+ * If an ID was already provided in the MCPServerConfig, this method will be a no-op.
356
+ * @param id The unique ID to assign to the server.
175
357
  */
176
- readonly convertedTools: Record<string, ConvertedTool>;
177
- mastra: Mastra | undefined;
358
+ setId(id: string): void;
178
359
  /**
179
- * Get a read-only view of the registered tools (for testing/introspection).
360
+ * Abstract method to convert and validate tool definitions provided to the server.
361
+ * @param tools Tool definitions to convert.
362
+ * @returns A record of converted and validated tools.
180
363
  */
181
- tools(): Readonly<Record<string, ConvertedTool>>;
182
364
  abstract convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
365
+ /**
366
+ * Internal method used by Mastra to register itself with the server.
367
+ * @param mastra The Mastra instance.
368
+ * @internal
369
+ */
183
370
  __registerMastra(mastra: Mastra): void;
184
371
  /**
185
- * Constructor for the MCPServerBase
186
- * @param config Configuration options for the MCP server
372
+ * Constructor for the MCPServerBase.
373
+ * @param config Configuration options for the MCP server, including metadata.
187
374
  */
188
375
  constructor(config: MCPServerConfig);
189
376
  /**
@@ -212,6 +399,51 @@ declare abstract class MCPServerBase extends MastraBase {
212
399
  * Close the MCP server and all its connections
213
400
  */
214
401
  abstract close(): Promise<void>;
402
+ /**
403
+ * Gets the basic information about the server, conforming to the MCP Registry 'Server' schema.
404
+ * This information is suitable for listing multiple servers.
405
+ * @returns ServerInfo object containing basic server metadata.
406
+ */
407
+ abstract getServerInfo(): ServerInfo;
408
+ /**
409
+ * Gets detailed information about the server, conforming to the MCP Registry 'ServerDetail' schema.
410
+ * This includes all information from `getServerInfo` plus package and remote details.
411
+ * @returns ServerDetailInfo object containing comprehensive server metadata.
412
+ */
413
+ abstract getServerDetail(): ServerDetailInfo;
414
+ /**
415
+ * Gets a list of tools provided by this MCP server, including their schemas.
416
+ * @returns An object containing an array of tool information.
417
+ */
418
+ abstract getToolListInfo(): {
419
+ tools: Array<{
420
+ name: string;
421
+ description?: string;
422
+ inputSchema: string;
423
+ }>;
424
+ };
425
+ /**
426
+ * Gets information for a specific tool provided by this MCP server.
427
+ * @param toolId The ID/name of the tool to retrieve.
428
+ * @returns Tool information (name, description, inputSchema) or undefined if not found.
429
+ */
430
+ abstract getToolInfo(toolId: string): {
431
+ name: string;
432
+ description?: string;
433
+ inputSchema: string;
434
+ } | undefined;
435
+ /**
436
+ * Executes a specific tool provided by this MCP server.
437
+ * @param toolId The ID/name of the tool to execute.
438
+ * @param args The arguments to pass to the tool's execute function.
439
+ * @param executionContext Optional context for the tool execution (e.g., messages, toolCallId).
440
+ * @returns A promise that resolves to the result of the tool execution.
441
+ * @throws Error if the tool is not found, or if execution fails.
442
+ */
443
+ abstract executeTool(toolId: string, args: any, executionContext?: {
444
+ messages?: any[];
445
+ toolCallId?: string;
446
+ }): Promise<any>;
215
447
  }
216
448
 
217
449
  type AgentNetworkConfig = {
@@ -1289,6 +1521,7 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
1289
1521
  runtimeContext: RuntimeContext;
1290
1522
  inputData: TStepInput;
1291
1523
  resumeData?: TResumeSchema;
1524
+ getInitData<T extends z.ZodType<any>>(): z.infer<T>;
1292
1525
  getInitData<T extends NewWorkflow<any, any, any, any, any>>(): T extends undefined ? unknown : z.infer<NonNullable<T['inputSchema']>>;
1293
1526
  getStepResult<T extends NewStep<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
1294
1527
  suspend(suspendPayload: TSuspendSchema): Promise<void>;
@@ -1368,6 +1601,16 @@ type WatchEvent = {
1368
1601
  eventTimestamp: Date;
1369
1602
  };
1370
1603
  type ZodPathType<T extends z.ZodTypeAny, P extends string> = T extends z.ZodObject<infer Shape> ? P extends `${infer Key}.${infer Rest}` ? Key extends keyof Shape ? Shape[Key] extends z.ZodTypeAny ? ZodPathType<Shape[Key], Rest> : never : never : P extends keyof Shape ? Shape[P] : never : never;
1604
+ interface VNextWorkflowRunState {
1605
+ runId: string;
1606
+ value: Record<string, string>;
1607
+ context: {
1608
+ input?: Record<string, any>;
1609
+ } & Record<string, StepResult<any>>;
1610
+ activePaths: Array<unknown>;
1611
+ suspendedPaths: Record<string, number[]>;
1612
+ timestamp: number;
1613
+ }
1371
1614
 
1372
1615
  /**
1373
1616
  * Represents an execution graph for a workflow
@@ -1639,8 +1882,8 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1639
1882
  limit?: number;
1640
1883
  offset?: number;
1641
1884
  resourceId?: string;
1642
- }): Promise<WorkflowRuns>;
1643
- getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
1885
+ }): Promise<VNextWorkflowRuns>;
1886
+ getWorkflowRunById(runId: string): Promise<VNextWorkflowRun | null>;
1644
1887
  }
1645
1888
  /**
1646
1889
  * Represents a workflow run that can be executed
@@ -2450,16 +2693,20 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
2450
2693
  }): Promise<BaseLogMessage[] | undefined>;
2451
2694
  getLogs(transportId: string): Promise<BaseLogMessage[]>;
2452
2695
  /**
2453
- * Get a specific MCP server by ID
2454
- * @param serverId - The ID of the MCP server to retrieve
2455
- * @returns The MCP server with the specified ID, or undefined if not found
2696
+ * Get all registered MCP server instances.
2697
+ * @returns A record of MCP server ID to MCPServerBase instance, or undefined if none are registered.
2456
2698
  */
2457
- getMCPServer(serverId: string): MCPServerBase | undefined;
2699
+ getMCPServers(): Record<string, MCPServerBase> | undefined;
2458
2700
  /**
2459
- * Get all registered MCP servers as a Record, with keys being their IDs.
2460
- * @returns Record of MCP server IDs to MCPServerBase instances, or undefined if none.
2701
+ * Get a specific MCP server instance.
2702
+ * If a version is provided, it attempts to find the server with that exact logical ID and version.
2703
+ * If no version is provided, it returns the server with the specified logical ID that has the most recent releaseDate.
2704
+ * The logical ID should match the `id` property of the MCPServer instance (typically set via MCPServerConfig.id).
2705
+ * @param serverId - The logical ID of the MCP server to retrieve.
2706
+ * @param version - Optional specific version of the MCP server to retrieve.
2707
+ * @returns The MCP server instance, or undefined if not found or if the specific version is not found.
2461
2708
  */
2462
- getMCPServers(): TMCPServers | undefined;
2709
+ getMCPServer(serverId: string, version?: string): MCPServerBase | undefined;
2463
2710
  }
2464
2711
 
2465
2712
  type MastraPrimitives = {
@@ -2693,6 +2940,18 @@ interface WorkflowRun {
2693
2940
  updatedAt: Date;
2694
2941
  resourceId?: string;
2695
2942
  }
2943
+ interface VNextWorkflowRuns {
2944
+ runs: VNextWorkflowRun[];
2945
+ total: number;
2946
+ }
2947
+ interface VNextWorkflowRun {
2948
+ workflowName: string;
2949
+ runId: string;
2950
+ snapshot: VNextWorkflowRunState | string;
2951
+ createdAt: Date;
2952
+ updatedAt: Date;
2953
+ resourceId?: string;
2954
+ }
2696
2955
  type StorageGetMessagesArg = {
2697
2956
  threadId: string;
2698
2957
  resourceId?: string;
@@ -2877,4 +3136,4 @@ declare abstract class MastraStorage extends MastraBase {
2877
3136
  }): Promise<WorkflowRun | null>;
2878
3137
  }
2879
3138
 
2880
- export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type MCPServerHonoSSEOptions as ba, type MCPServerHTTPOptions as bb, type AgentNetworkConfig as bc, type VoiceEventType as bd, type VoiceEventMap as be, type VoiceConfig as bf, MastraVoice as bg, CompositeVoice as bh, DefaultVoice as bi, type ToolsetsInput as bj, type DynamicArgument as bk, type AgentGenerateOptions as bl, type AgentStreamOptions as bm, TABLE_WORKFLOW_SNAPSHOT as bn, TABLE_EVALS as bo, TABLE_MESSAGES as bp, TABLE_THREADS as bq, TABLE_TRACES as br, TABLE_SCHEMAS as bs, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
3139
+ export { type CoreSystemMessage as $, type ApiRoute as A, type WatchEvent as B, type VNextWorkflowRunState as C, type DynamicMapping as D, type EvalRow as E, type ToolAction as F, Agent as G, type AgentConfig as H, MastraMemory as I, type ToolExecutionContext as J, Tool as K, Step as L, type Methods as M, type NewStep as N, Workflow as O, type PathsToStringProps as P, type WorkflowOptions as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type VNextWorkflowRuns as U, type VariableReference as V, type WorkflowRuns as W, type VNextWorkflowRun as X, type LanguageModel as Y, type ZodPathType as Z, type CoreMessage as _, Mastra as a, type ExtractStepResult as a$, type CoreAssistantMessage as a0, type CoreUserMessage as a1, type CoreToolMessage as a2, type EmbedResult as a3, type EmbedManyResult as a4, type BaseStructuredOutputType as a5, type StructuredOutputType as a6, type StructuredOutputArrayItem as a7, type StructuredOutput as a8, type GenerateReturn as a9, type StepNode as aA, type StepGraph as aB, type RetryConfig as aC, type VariableReference$1 as aD, type BaseCondition as aE, type ActionContext as aF, WhenConditionReturnValue as aG, type StepDef as aH, type StepCondition as aI, type StepConfig as aJ, type StepResult$1 as aK, type StepsRecord$1 as aL, type WorkflowRunResult as aM, type WorkflowContext as aN, type WorkflowLogMessage as aO, type WorkflowEvent as aP, type ResolverFunctionInput as aQ, type ResolverFunctionOutput as aR, type SubscriberFunctionOutput as aS, type DependencyCheckOutput as aT, type StepResolverOutput as aU, type WorkflowActors as aV, type WorkflowActionParams as aW, type WorkflowActions as aX, type WorkflowState as aY, type StepId as aZ, type ExtractSchemaFromStep$1 as a_, type StreamReturn as aa, type OutputType as ab, type DefaultLLMTextOptions as ac, type DefaultLLMTextObjectOptions as ad, type DefaultLLMStreamOptions as ae, type DefaultLLMStreamObjectOptions as af, type LLMTextOptions as ag, type LLMTextObjectOptions as ah, type LLMStreamOptions as ai, type LLMInnerStreamOptions as aj, type LLMStreamObjectOptions as ak, createMockModel as al, type Config as am, type MessageResponse as an, type MemoryConfig as ao, type SharedMemoryConfig as ap, type MemoryProcessorOpts as aq, MemoryProcessor as ar, memoryDefaultOptions as as, createTool as at, type VercelTool as au, type CoreTool as av, type InternalCoreTool as aw, type StepExecutionContext as ax, type StepAction as ay, type StepVariableType as az, MastraStorage as b, type StepInputType as b0, type ExtractSchemaType$1 as b1, type PathsToStringProps$1 as b2, type WorkflowRunState as b3, type WorkflowResumeResult as b4, type MastraLanguageModel as b5, type MastraPrimitives as b6, type ToolsInput as b7, AgentNetwork as b8, MCPServerBase as b9, type AgentGenerateOptions as bA, type AgentStreamOptions as bB, TABLE_WORKFLOW_SNAPSHOT as bC, TABLE_EVALS as bD, TABLE_MESSAGES as bE, TABLE_THREADS as bF, TABLE_TRACES as bG, TABLE_SCHEMAS as bH, type ConvertedTool as ba, type MCPServerSSEOptions as bb, type MCPServerHonoSSEOptions as bc, type MCPServerHTTPOptions as bd, type Repository as be, type VersionDetail as bf, type ArgumentInfo as bg, type PositionalArgumentInfo as bh, type NamedArgumentInfo as bi, type SubcommandInfo as bj, type CommandInfo as bk, type EnvironmentVariableInfo as bl, type PackageInfo as bm, type RemoteInfo as bn, type MCPServerConfig as bo, type ServerInfo as bp, type ServerDetailInfo as bq, type AgentNetworkConfig as br, type VoiceEventType as bs, type VoiceEventMap as bt, type VoiceConfig as bu, MastraVoice as bv, CompositeVoice as bw, DefaultVoice as bx, type ToolsetsInput as by, type DynamicArgument as bz, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };