@mastra/client-js 0.0.0-commonjs-20250227130920 → 0.0.0-course-20250527170450

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/dist/index.d.ts CHANGED
@@ -1,6 +1,16 @@
1
- import { CoreMessage, OutputType, StorageThreadType, AiMessageType, MessageType, StepAction, StepGraph, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { AbstractAgent } from '@ag-ui/client';
2
+ import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
3
+ import { processDataStream } from '@ai-sdk/ui-utils';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
2
5
  import { JSONSchema7 } from 'json-schema';
3
6
  import { ZodSchema } from 'zod';
7
+ import { BaseLogMessage } from '@mastra/core/logger';
8
+ import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
9
+ import { RuntimeContext } from '@mastra/core/runtime-context';
10
+ import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
11
+ import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
12
+ import * as stream_web from 'stream/web';
13
+ import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
4
14
 
5
15
  interface ClientOptions {
6
16
  /** Base URL for API requests */
@@ -19,27 +29,40 @@ interface RequestOptions {
19
29
  headers?: Record<string, string>;
20
30
  body?: any;
21
31
  stream?: boolean;
32
+ signal?: AbortSignal;
22
33
  }
34
+ type WithoutMethods<T> = {
35
+ [K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
36
+ (): any;
37
+ } ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
38
+ };
23
39
  interface GetAgentResponse {
24
40
  name: string;
25
41
  instructions: string;
26
42
  tools: Record<string, GetToolResponse>;
43
+ workflows: Record<string, GetWorkflowResponse>;
27
44
  provider: string;
45
+ modelId: string;
46
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
47
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
28
48
  }
29
- interface GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> {
30
- messages: string | string[] | CoreMessage[];
31
- threadId?: string;
32
- resourceid?: string;
33
- output?: OutputType | T;
34
- }
35
- interface StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> {
36
- messages: string | string[] | CoreMessage[];
37
- threadId?: string;
38
- resourceid?: string;
39
- output?: OutputType | T;
40
- }
49
+ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
50
+ messages: string | string[] | CoreMessage[] | AiMessageType[];
51
+ output?: T;
52
+ experimental_output?: T;
53
+ runtimeContext?: RuntimeContext | Record<string, any>;
54
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
55
+ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
+ messages: string | string[] | CoreMessage[] | AiMessageType[];
57
+ output?: T;
58
+ experimental_output?: T;
59
+ runtimeContext?: RuntimeContext | Record<string, any>;
60
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
41
61
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
42
62
  evals: any[];
63
+ instructions: string;
64
+ name: string;
65
+ id: string;
43
66
  }
44
67
  interface GetToolResponse {
45
68
  id: string;
@@ -47,13 +70,54 @@ interface GetToolResponse {
47
70
  inputSchema: string;
48
71
  outputSchema: string;
49
72
  }
50
- interface GetWorkflowResponse {
73
+ interface GetLegacyWorkflowResponse {
51
74
  name: string;
52
75
  triggerSchema: string;
53
76
  steps: Record<string, StepAction<any, any, any, any>>;
54
77
  stepGraph: StepGraph;
55
78
  stepSubscriberGraph: Record<string, StepGraph>;
79
+ workflowId?: string;
80
+ }
81
+ interface GetWorkflowRunsParams {
82
+ fromDate?: Date;
83
+ toDate?: Date;
84
+ limit?: number;
85
+ offset?: number;
86
+ resourceId?: string;
56
87
  }
88
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
89
+ type GetWorkflowRunsResponse = WorkflowRuns;
90
+ type LegacyWorkflowRunResult = {
91
+ activePaths: Record<string, {
92
+ status: string;
93
+ suspendPayload?: any;
94
+ stepPath: string[];
95
+ }>;
96
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
97
+ timestamp: number;
98
+ runId: string;
99
+ };
100
+ interface GetWorkflowResponse {
101
+ name: string;
102
+ description?: string;
103
+ steps: {
104
+ [key: string]: {
105
+ id: string;
106
+ description: string;
107
+ inputSchema: string;
108
+ outputSchema: string;
109
+ resumeSchema: string;
110
+ suspendSchema: string;
111
+ };
112
+ };
113
+ stepGraph: Workflow$1['serializedStepGraph'];
114
+ inputSchema: string;
115
+ outputSchema: string;
116
+ }
117
+ type WorkflowWatchResult = WatchEvent & {
118
+ runId: string;
119
+ };
120
+ type WorkflowRunResult = WorkflowResult<any, any>;
57
121
  interface UpsertVectorParams {
58
122
  indexName: string;
59
123
  vectors: number[][];
@@ -86,10 +150,10 @@ interface SaveMessageToMemoryParams {
86
150
  }
87
151
  type SaveMessageToMemoryResponse = MessageType[];
88
152
  interface CreateMemoryThreadParams {
89
- title: string;
90
- metadata: Record<string, any>;
91
- resourceid: string;
92
- threadId: string;
153
+ title?: string;
154
+ metadata?: Record<string, any>;
155
+ resourceId: string;
156
+ threadId?: string;
93
157
  agentId: string;
94
158
  }
95
159
  type CreateMemoryThreadResponse = StorageThreadType;
@@ -101,7 +165,13 @@ type GetMemoryThreadResponse = StorageThreadType[];
101
165
  interface UpdateMemoryThreadParams {
102
166
  title: string;
103
167
  metadata: Record<string, any>;
104
- resourceid: string;
168
+ resourceId: string;
169
+ }
170
+ interface GetMemoryThreadMessagesParams {
171
+ /**
172
+ * Limit the number of messages to retrieve (default: 40)
173
+ */
174
+ limit?: number;
105
175
  }
106
176
  interface GetMemoryThreadMessagesResponse {
107
177
  messages: CoreMessage[];
@@ -116,8 +186,45 @@ interface GetLogParams {
116
186
  }
117
187
  type GetLogsResponse = BaseLogMessage[];
118
188
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
189
+ type SpanStatus = {
190
+ code: number;
191
+ };
192
+ type SpanOther = {
193
+ droppedAttributesCount: number;
194
+ droppedEventsCount: number;
195
+ droppedLinksCount: number;
196
+ };
197
+ type SpanEventAttributes = {
198
+ key: string;
199
+ value: {
200
+ [key: string]: string | number | boolean | null;
201
+ };
202
+ };
203
+ type SpanEvent = {
204
+ attributes: SpanEventAttributes[];
205
+ name: string;
206
+ timeUnixNano: string;
207
+ droppedAttributesCount: number;
208
+ };
209
+ type Span = {
210
+ id: string;
211
+ parentSpanId: string | null;
212
+ traceId: string;
213
+ name: string;
214
+ scope: string;
215
+ kind: number;
216
+ status: SpanStatus;
217
+ events: SpanEvent[];
218
+ links: any[];
219
+ attributes: Record<string, string | number | boolean | null>;
220
+ startTime: number;
221
+ endTime: number;
222
+ duration: number;
223
+ other: SpanOther;
224
+ createdAt: string;
225
+ };
119
226
  interface GetTelemetryResponse {
120
- traces: any[];
227
+ traces: Span[];
121
228
  }
122
229
  interface GetTelemetryParams {
123
230
  name?: string;
@@ -125,6 +232,36 @@ interface GetTelemetryParams {
125
232
  page?: number;
126
233
  perPage?: number;
127
234
  attribute?: Record<string, string>;
235
+ fromDate?: Date;
236
+ toDate?: Date;
237
+ }
238
+ interface GetNetworkResponse {
239
+ name: string;
240
+ instructions: string;
241
+ agents: Array<{
242
+ name: string;
243
+ provider: string;
244
+ modelId: string;
245
+ }>;
246
+ routingModel: {
247
+ provider: string;
248
+ modelId: string;
249
+ };
250
+ state?: Record<string, any>;
251
+ }
252
+ interface McpServerListResponse {
253
+ servers: ServerInfo[];
254
+ next: string | null;
255
+ total_count: number;
256
+ }
257
+ interface McpToolInfo {
258
+ id: string;
259
+ name: string;
260
+ description?: string;
261
+ inputSchema: string;
262
+ }
263
+ interface McpServerToolListResponse {
264
+ tools: McpToolInfo[];
128
265
  }
129
266
 
130
267
  declare class BaseResource {
@@ -139,8 +276,40 @@ declare class BaseResource {
139
276
  request<T>(path: string, options?: RequestOptions): Promise<T>;
140
277
  }
141
278
 
279
+ declare class AgentVoice extends BaseResource {
280
+ private agentId;
281
+ constructor(options: ClientOptions, agentId: string);
282
+ /**
283
+ * Convert text to speech using the agent's voice provider
284
+ * @param text - Text to convert to speech
285
+ * @param options - Optional provider-specific options for speech generation
286
+ * @returns Promise containing the audio data
287
+ */
288
+ speak(text: string, options?: {
289
+ speaker?: string;
290
+ [key: string]: any;
291
+ }): Promise<Response>;
292
+ /**
293
+ * Convert speech to text using the agent's voice provider
294
+ * @param audio - Audio data to transcribe
295
+ * @param options - Optional provider-specific options
296
+ * @returns Promise containing the transcribed text
297
+ */
298
+ listen(audio: Blob, options?: Record<string, any>): Promise<{
299
+ text: string;
300
+ }>;
301
+ /**
302
+ * Get available speakers for the agent's voice provider
303
+ * @returns Promise containing list of available speakers
304
+ */
305
+ getSpeakers(): Promise<Array<{
306
+ voiceId: string;
307
+ [key: string]: any;
308
+ }>>;
309
+ }
142
310
  declare class Agent extends BaseResource {
143
311
  private agentId;
312
+ readonly voice: AgentVoice;
144
313
  constructor(options: ClientOptions, agentId: string);
145
314
  /**
146
315
  * Retrieves details about the agent
@@ -156,15 +325,27 @@ declare class Agent extends BaseResource {
156
325
  /**
157
326
  * Streams a response from the agent
158
327
  * @param params - Stream parameters including prompt
159
- * @returns Promise containing the streamed response
328
+ * @returns Promise containing the enhanced Response object with processDataStream method
160
329
  */
161
- stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response>;
330
+ stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
331
+ processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
332
+ }>;
162
333
  /**
163
334
  * Gets details about a specific tool available to the agent
164
335
  * @param toolId - ID of the tool to retrieve
165
336
  * @returns Promise containing tool details
166
337
  */
167
338
  getTool(toolId: string): Promise<GetToolResponse>;
339
+ /**
340
+ * Executes a tool for the agent
341
+ * @param toolId - ID of the tool to execute
342
+ * @param params - Parameters required for tool execution
343
+ * @returns Promise containing the tool execution results
344
+ */
345
+ executeTool(toolId: string, params: {
346
+ data: any;
347
+ runtimeContext?: RuntimeContext;
348
+ }): Promise<any>;
168
349
  /**
169
350
  * Retrieves evaluation results for the agent
170
351
  * @returns Promise containing agent evaluations
@@ -177,6 +358,30 @@ declare class Agent extends BaseResource {
177
358
  liveEvals(): Promise<GetEvalsByAgentIdResponse>;
178
359
  }
179
360
 
361
+ declare class Network extends BaseResource {
362
+ private networkId;
363
+ constructor(options: ClientOptions, networkId: string);
364
+ /**
365
+ * Retrieves details about the network
366
+ * @returns Promise containing network details
367
+ */
368
+ details(): Promise<GetNetworkResponse>;
369
+ /**
370
+ * Generates a response from the agent
371
+ * @param params - Generation parameters including prompt
372
+ * @returns Promise containing the generated response
373
+ */
374
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
375
+ /**
376
+ * Streams a response from the agent
377
+ * @param params - Stream parameters including prompt
378
+ * @returns Promise containing the enhanced Response object with processDataStream method
379
+ */
380
+ stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
381
+ processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
382
+ }>;
383
+ }
384
+
180
385
  declare class MemoryThread extends BaseResource {
181
386
  private threadId;
182
387
  private agentId;
@@ -201,9 +406,10 @@ declare class MemoryThread extends BaseResource {
201
406
  }>;
202
407
  /**
203
408
  * Retrieves messages associated with the thread
409
+ * @param params - Optional parameters including limit for number of messages to retrieve
204
410
  * @returns Promise containing thread messages and UI messages
205
411
  */
206
- getMessages(): Promise<GetMemoryThreadMessagesResponse>;
412
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
207
413
  }
208
414
 
209
415
  declare class Vector extends BaseResource {
@@ -252,37 +458,89 @@ declare class Vector extends BaseResource {
252
458
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
253
459
  }
254
460
 
255
- declare class Workflow extends BaseResource {
461
+ declare class LegacyWorkflow extends BaseResource {
256
462
  private workflowId;
257
463
  constructor(options: ClientOptions, workflowId: string);
258
464
  /**
259
- * Retrieves details about the workflow
260
- * @returns Promise containing workflow details including steps and graphs
465
+ * Retrieves details about the legacy workflow
466
+ * @returns Promise containing legacy workflow details including steps and graphs
261
467
  */
262
- details(): Promise<GetWorkflowResponse>;
468
+ details(): Promise<GetLegacyWorkflowResponse>;
263
469
  /**
264
- * Executes the workflow with the provided parameters
265
- * @param params - Parameters required for workflow execution
266
- * @returns Promise containing the workflow execution results
470
+ * Retrieves all runs for a legacy workflow
471
+ * @param params - Parameters for filtering runs
472
+ * @returns Promise containing legacy workflow runs array
473
+ */
474
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
475
+ /**
476
+ * Creates a new legacy workflow run
477
+ * @returns Promise containing the generated run ID
478
+ */
479
+ createRun(params?: {
480
+ runId?: string;
481
+ }): Promise<{
482
+ runId: string;
483
+ }>;
484
+ /**
485
+ * Starts a legacy workflow run synchronously without waiting for the workflow to complete
486
+ * @param params - Object containing the runId and triggerData
487
+ * @returns Promise containing success message
267
488
  */
268
- execute(params: Record<string, any>): Promise<Record<string, any>>;
489
+ start(params: {
490
+ runId: string;
491
+ triggerData: Record<string, any>;
492
+ }): Promise<{
493
+ message: string;
494
+ }>;
269
495
  /**
270
- * Resumes a suspended workflow step
496
+ * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
271
497
  * @param stepId - ID of the step to resume
272
- * @param runId - ID of the workflow run
273
- * @param context - Context to resume the workflow with
274
- * @returns Promise containing the workflow resume results
498
+ * @param runId - ID of the legacy workflow run
499
+ * @param context - Context to resume the legacy workflow with
500
+ * @returns Promise containing the legacy workflow resume results
275
501
  */
276
502
  resume({ stepId, runId, context, }: {
277
503
  stepId: string;
278
504
  runId: string;
279
505
  context: Record<string, any>;
280
- }): Promise<Record<string, any>>;
506
+ }): Promise<{
507
+ message: string;
508
+ }>;
281
509
  /**
282
- * Watches workflow transitions in real-time
283
- * @returns Promise containing the workflow watch stream
510
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
511
+ * @param params - Object containing the optional runId and triggerData
512
+ * @returns Promise containing the workflow execution results
513
+ */
514
+ startAsync(params: {
515
+ runId?: string;
516
+ triggerData: Record<string, any>;
517
+ }): Promise<LegacyWorkflowRunResult>;
518
+ /**
519
+ * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
520
+ * @param params - Object containing the runId, stepId, and context
521
+ * @returns Promise containing the workflow resume results
284
522
  */
285
- watch(): Promise<Response>;
523
+ resumeAsync(params: {
524
+ runId: string;
525
+ stepId: string;
526
+ context: Record<string, any>;
527
+ }): Promise<LegacyWorkflowRunResult>;
528
+ /**
529
+ * Creates an async generator that processes a readable stream and yields records
530
+ * separated by the Record Separator character (\x1E)
531
+ *
532
+ * @param stream - The readable stream to process
533
+ * @returns An async generator that yields parsed records
534
+ */
535
+ private streamProcessor;
536
+ /**
537
+ * Watches legacy workflow transitions in real-time
538
+ * @param runId - Optional run ID to filter the watch stream
539
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
540
+ */
541
+ watch({ runId }: {
542
+ runId?: string;
543
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
286
544
  }
287
545
 
288
546
  declare class Tool extends BaseResource {
@@ -300,6 +558,179 @@ declare class Tool extends BaseResource {
300
558
  */
301
559
  execute(params: {
302
560
  data: any;
561
+ runId?: string;
562
+ runtimeContext?: RuntimeContext | Record<string, any>;
563
+ }): Promise<any>;
564
+ }
565
+
566
+ declare class Workflow extends BaseResource {
567
+ private workflowId;
568
+ constructor(options: ClientOptions, workflowId: string);
569
+ /**
570
+ * Creates an async generator that processes a readable stream and yields workflow records
571
+ * separated by the Record Separator character (\x1E)
572
+ *
573
+ * @param stream - The readable stream to process
574
+ * @returns An async generator that yields parsed records
575
+ */
576
+ private streamProcessor;
577
+ /**
578
+ * Retrieves details about the workflow
579
+ * @returns Promise containing workflow details including steps and graphs
580
+ */
581
+ details(): Promise<GetWorkflowResponse>;
582
+ /**
583
+ * Retrieves all runs for a workflow
584
+ * @param params - Parameters for filtering runs
585
+ * @returns Promise containing workflow runs array
586
+ */
587
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
588
+ /**
589
+ * Creates a new workflow run
590
+ * @param params - Optional object containing the optional runId
591
+ * @returns Promise containing the runId of the created run
592
+ */
593
+ createRun(params?: {
594
+ runId?: string;
595
+ }): Promise<{
596
+ runId: string;
597
+ }>;
598
+ /**
599
+ * Starts a workflow run synchronously without waiting for the workflow to complete
600
+ * @param params - Object containing the runId, inputData and runtimeContext
601
+ * @returns Promise containing success message
602
+ */
603
+ start(params: {
604
+ runId: string;
605
+ inputData: Record<string, any>;
606
+ runtimeContext?: RuntimeContext | Record<string, any>;
607
+ }): Promise<{
608
+ message: string;
609
+ }>;
610
+ /**
611
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
612
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
613
+ * @returns Promise containing success message
614
+ */
615
+ resume({ step, runId, resumeData, ...rest }: {
616
+ step: string | string[];
617
+ runId: string;
618
+ resumeData?: Record<string, any>;
619
+ runtimeContext?: RuntimeContext | Record<string, any>;
620
+ }): Promise<{
621
+ message: string;
622
+ }>;
623
+ /**
624
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
625
+ * @param params - Object containing the optional runId, inputData and runtimeContext
626
+ * @returns Promise containing the workflow execution results
627
+ */
628
+ startAsync(params: {
629
+ runId?: string;
630
+ inputData: Record<string, any>;
631
+ runtimeContext?: RuntimeContext | Record<string, any>;
632
+ }): Promise<WorkflowRunResult>;
633
+ /**
634
+ * Starts a vNext workflow run and returns a stream
635
+ * @param params - Object containing the optional runId, inputData and runtimeContext
636
+ * @returns Promise containing the vNext workflow execution results
637
+ */
638
+ stream(params: {
639
+ runId?: string;
640
+ inputData: Record<string, any>;
641
+ runtimeContext?: RuntimeContext;
642
+ }): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
643
+ /**
644
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
645
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
646
+ * @returns Promise containing the workflow resume results
647
+ */
648
+ resumeAsync(params: {
649
+ runId: string;
650
+ step: string | string[];
651
+ resumeData?: Record<string, any>;
652
+ runtimeContext?: RuntimeContext | Record<string, any>;
653
+ }): Promise<WorkflowRunResult>;
654
+ /**
655
+ * Watches workflow transitions in real-time
656
+ * @param runId - Optional run ID to filter the watch stream
657
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
658
+ */
659
+ watch({ runId }: {
660
+ runId?: string;
661
+ }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
662
+ /**
663
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
664
+ * serializing each as JSON and separating them with the record separator (\x1E).
665
+ *
666
+ * @param records - An iterable or async iterable of objects to stream
667
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
668
+ */
669
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
670
+ }
671
+
672
+ /**
673
+ * Class for interacting with an agent via the A2A protocol
674
+ */
675
+ declare class A2A extends BaseResource {
676
+ private agentId;
677
+ constructor(options: ClientOptions, agentId: string);
678
+ /**
679
+ * Get the agent card with metadata about the agent
680
+ * @returns Promise containing the agent card information
681
+ */
682
+ getCard(): Promise<AgentCard>;
683
+ /**
684
+ * Send a message to the agent and get a response
685
+ * @param params - Parameters for the task
686
+ * @returns Promise containing the task response
687
+ */
688
+ sendMessage(params: TaskSendParams): Promise<{
689
+ task: Task;
690
+ }>;
691
+ /**
692
+ * Get the status and result of a task
693
+ * @param params - Parameters for querying the task
694
+ * @returns Promise containing the task response
695
+ */
696
+ getTask(params: TaskQueryParams): Promise<Task>;
697
+ /**
698
+ * Cancel a running task
699
+ * @param params - Parameters identifying the task to cancel
700
+ * @returns Promise containing the task response
701
+ */
702
+ cancelTask(params: TaskIdParams): Promise<{
703
+ task: Task;
704
+ }>;
705
+ /**
706
+ * Send a message and subscribe to streaming updates (not fully implemented)
707
+ * @param params - Parameters for the task
708
+ * @returns Promise containing the task response
709
+ */
710
+ sendAndSubscribe(params: TaskSendParams): Promise<Response>;
711
+ }
712
+
713
+ /**
714
+ * Represents a specific tool available on a specific MCP server.
715
+ * Provides methods to get details and execute the tool.
716
+ */
717
+ declare class MCPTool extends BaseResource {
718
+ private serverId;
719
+ private toolId;
720
+ constructor(options: ClientOptions, serverId: string, toolId: string);
721
+ /**
722
+ * Retrieves details about this specific tool from the MCP server.
723
+ * @returns Promise containing the tool's information (name, description, schema).
724
+ */
725
+ details(): Promise<McpToolInfo>;
726
+ /**
727
+ * Executes this specific tool on the MCP server.
728
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
729
+ * @returns Promise containing the result of the tool execution.
730
+ */
731
+ execute(params: {
732
+ data?: any;
733
+ runtimeContext?: RuntimeContext;
303
734
  }): Promise<any>;
304
735
  }
305
736
 
@@ -310,6 +741,9 @@ declare class MastraClient extends BaseResource {
310
741
  * @returns Promise containing map of agent IDs to agent details
311
742
  */
312
743
  getAgents(): Promise<Record<string, GetAgentResponse>>;
744
+ getAGUI({ resourceId }: {
745
+ resourceId: string;
746
+ }): Promise<Record<string, AbstractAgent>>;
313
747
  /**
314
748
  * Gets an agent instance by ID
315
749
  * @param agentId - ID of the agent to retrieve
@@ -358,6 +792,17 @@ declare class MastraClient extends BaseResource {
358
792
  * @returns Tool instance
359
793
  */
360
794
  getTool(toolId: string): Tool;
795
+ /**
796
+ * Retrieves all available legacy workflows
797
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
798
+ */
799
+ getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
800
+ /**
801
+ * Gets a legacy workflow instance by ID
802
+ * @param workflowId - ID of the legacy workflow to retrieve
803
+ * @returns Legacy Workflow instance
804
+ */
805
+ getLegacyWorkflow(workflowId: string): LegacyWorkflow;
361
806
  /**
362
807
  * Retrieves all available workflows
363
808
  * @returns Promise containing map of workflow IDs to workflow details
@@ -400,6 +845,55 @@ declare class MastraClient extends BaseResource {
400
845
  * @returns Promise containing telemetry data
401
846
  */
402
847
  getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse>;
848
+ /**
849
+ * Retrieves all available networks
850
+ * @returns Promise containing map of network IDs to network details
851
+ */
852
+ getNetworks(): Promise<Record<string, GetNetworkResponse>>;
853
+ /**
854
+ * Gets a network instance by ID
855
+ * @param networkId - ID of the network to retrieve
856
+ * @returns Network instance
857
+ */
858
+ getNetwork(networkId: string): Network;
859
+ /**
860
+ * Retrieves a list of available MCP servers.
861
+ * @param params - Optional parameters for pagination (limit, offset).
862
+ * @returns Promise containing the list of MCP servers and pagination info.
863
+ */
864
+ getMcpServers(params?: {
865
+ limit?: number;
866
+ offset?: number;
867
+ }): Promise<McpServerListResponse>;
868
+ /**
869
+ * Retrieves detailed information for a specific MCP server.
870
+ * @param serverId - The ID of the MCP server to retrieve.
871
+ * @param params - Optional parameters, e.g., specific version.
872
+ * @returns Promise containing the detailed MCP server information.
873
+ */
874
+ getMcpServerDetails(serverId: string, params?: {
875
+ version?: string;
876
+ }): Promise<ServerDetailInfo>;
877
+ /**
878
+ * Retrieves a list of tools for a specific MCP server.
879
+ * @param serverId - The ID of the MCP server.
880
+ * @returns Promise containing the list of tools.
881
+ */
882
+ getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
883
+ /**
884
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
885
+ * This instance can then be used to fetch details or execute the tool.
886
+ * @param serverId - The ID of the MCP server.
887
+ * @param toolId - The ID of the tool.
888
+ * @returns MCPTool instance.
889
+ */
890
+ getMcpServerTool(serverId: string, toolId: string): MCPTool;
891
+ /**
892
+ * Gets an A2A client for interacting with an agent via the A2A protocol
893
+ * @param agentId - ID of the agent to interact with
894
+ * @returns A2A client instance
895
+ */
896
+ getA2A(agentId: string): A2A;
403
897
  }
404
898
 
405
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams };
899
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };