@mastra/client-js 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-vector-sources-20250516175436
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +156 -2
- package/dist/index.cjs +248 -22
- package/dist/index.d.cts +162 -9
- package/dist/index.d.ts +162 -9
- package/dist/index.js +244 -22
- package/package.json +6 -6
- package/src/adapters/agui.test.ts +19 -6
- package/src/adapters/agui.ts +31 -11
- package/src/client.ts +77 -1
- package/src/example.ts +29 -30
- package/src/index.test.ts +121 -1
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +26 -34
- package/src/resources/base.ts +1 -1
- package/src/resources/index.ts +2 -0
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.ts +13 -3
- package/src/resources/network.ts +5 -11
- package/src/resources/tool.ts +8 -2
- package/src/resources/vnext-workflow.ts +10 -6
- package/src/types.ts +48 -2
- package/src/utils/zod-to-json-schema.ts +10 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, VNextWorkflowRuns, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
4
|
import { JSONSchema7 } from 'json-schema';
|
|
5
5
|
import { ZodSchema } from 'zod';
|
|
6
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
7
|
-
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
8
7
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
8
|
+
import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
|
|
9
|
+
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
10
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/di';
|
|
11
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
9
12
|
|
|
10
13
|
interface ClientOptions {
|
|
11
14
|
/** Base URL for API requests */
|
|
@@ -26,19 +29,31 @@ interface RequestOptions {
|
|
|
26
29
|
stream?: boolean;
|
|
27
30
|
signal?: AbortSignal;
|
|
28
31
|
}
|
|
32
|
+
type WithoutMethods<T> = {
|
|
33
|
+
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
34
|
+
(): any;
|
|
35
|
+
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
36
|
+
};
|
|
29
37
|
interface GetAgentResponse {
|
|
30
38
|
name: string;
|
|
31
39
|
instructions: string;
|
|
32
40
|
tools: Record<string, GetToolResponse>;
|
|
41
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
33
42
|
provider: string;
|
|
34
43
|
modelId: string;
|
|
35
44
|
}
|
|
36
45
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
46
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
47
|
+
output?: T;
|
|
48
|
+
experimental_output?: T;
|
|
49
|
+
runtimeContext?: RuntimeContext;
|
|
50
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
39
51
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
40
52
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
41
|
-
|
|
53
|
+
output?: T;
|
|
54
|
+
experimental_output?: T;
|
|
55
|
+
runtimeContext?: RuntimeContext;
|
|
56
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
42
57
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
43
58
|
evals: any[];
|
|
44
59
|
instructions: string;
|
|
@@ -67,6 +82,7 @@ interface GetWorkflowRunsParams {
|
|
|
67
82
|
resourceId?: string;
|
|
68
83
|
}
|
|
69
84
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
85
|
+
type GetVNextWorkflowRunsResponse = VNextWorkflowRuns;
|
|
70
86
|
type WorkflowRunResult = {
|
|
71
87
|
activePaths: Record<string, {
|
|
72
88
|
status: string;
|
|
@@ -146,6 +162,12 @@ interface UpdateMemoryThreadParams {
|
|
|
146
162
|
metadata: Record<string, any>;
|
|
147
163
|
resourceId: string;
|
|
148
164
|
}
|
|
165
|
+
interface GetMemoryThreadMessagesParams {
|
|
166
|
+
/**
|
|
167
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
168
|
+
*/
|
|
169
|
+
limit?: number;
|
|
170
|
+
}
|
|
149
171
|
interface GetMemoryThreadMessagesResponse {
|
|
150
172
|
messages: CoreMessage[];
|
|
151
173
|
uiMessages: AiMessageType[];
|
|
@@ -222,6 +244,20 @@ interface GetNetworkResponse {
|
|
|
222
244
|
};
|
|
223
245
|
state?: Record<string, any>;
|
|
224
246
|
}
|
|
247
|
+
interface McpServerListResponse {
|
|
248
|
+
servers: ServerInfo[];
|
|
249
|
+
next: string | null;
|
|
250
|
+
total_count: number;
|
|
251
|
+
}
|
|
252
|
+
interface McpToolInfo {
|
|
253
|
+
id: string;
|
|
254
|
+
name: string;
|
|
255
|
+
description?: string;
|
|
256
|
+
inputSchema: string;
|
|
257
|
+
}
|
|
258
|
+
interface McpServerToolListResponse {
|
|
259
|
+
tools: McpToolInfo[];
|
|
260
|
+
}
|
|
225
261
|
|
|
226
262
|
declare class BaseResource {
|
|
227
263
|
readonly options: ClientOptions;
|
|
@@ -254,7 +290,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
254
290
|
* @param options - Optional provider-specific options
|
|
255
291
|
* @returns Promise containing the transcribed text
|
|
256
292
|
*/
|
|
257
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
293
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
294
|
+
text: string;
|
|
295
|
+
}>;
|
|
258
296
|
/**
|
|
259
297
|
* Get available speakers for the agent's voice provider
|
|
260
298
|
* @returns Promise containing list of available speakers
|
|
@@ -293,6 +331,16 @@ declare class Agent extends BaseResource {
|
|
|
293
331
|
* @returns Promise containing tool details
|
|
294
332
|
*/
|
|
295
333
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
334
|
+
/**
|
|
335
|
+
* Executes a tool for the agent
|
|
336
|
+
* @param toolId - ID of the tool to execute
|
|
337
|
+
* @param params - Parameters required for tool execution
|
|
338
|
+
* @returns Promise containing the tool execution results
|
|
339
|
+
*/
|
|
340
|
+
executeTool(toolId: string, params: {
|
|
341
|
+
data: any;
|
|
342
|
+
runtimeContext?: RuntimeContext$1;
|
|
343
|
+
}): Promise<any>;
|
|
296
344
|
/**
|
|
297
345
|
* Retrieves evaluation results for the agent
|
|
298
346
|
* @returns Promise containing agent evaluations
|
|
@@ -353,9 +401,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
353
401
|
}>;
|
|
354
402
|
/**
|
|
355
403
|
* Retrieves messages associated with the thread
|
|
404
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
356
405
|
* @returns Promise containing thread messages and UI messages
|
|
357
406
|
*/
|
|
358
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
407
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
359
408
|
}
|
|
360
409
|
|
|
361
410
|
declare class Vector extends BaseResource {
|
|
@@ -512,6 +561,7 @@ declare class Tool extends BaseResource {
|
|
|
512
561
|
execute(params: {
|
|
513
562
|
data: any;
|
|
514
563
|
runId?: string;
|
|
564
|
+
runtimeContext?: RuntimeContext$1;
|
|
515
565
|
}): Promise<any>;
|
|
516
566
|
}
|
|
517
567
|
|
|
@@ -536,7 +586,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
586
|
* @param params - Parameters for filtering runs
|
|
537
587
|
* @returns Promise containing vNext workflow runs array
|
|
538
588
|
*/
|
|
539
|
-
runs(params?: GetWorkflowRunsParams): Promise<
|
|
589
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetVNextWorkflowRunsResponse>;
|
|
540
590
|
/**
|
|
541
591
|
* Creates a new vNext workflow run
|
|
542
592
|
* @param params - Optional object containing the optional runId
|
|
@@ -564,7 +614,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
564
614
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
565
615
|
* @returns Promise containing success message
|
|
566
616
|
*/
|
|
567
|
-
resume({ step, runId, resumeData,
|
|
617
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
568
618
|
step: string | string[];
|
|
569
619
|
runId: string;
|
|
570
620
|
resumeData?: Record<string, any>;
|
|
@@ -603,6 +653,71 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
603
653
|
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
604
654
|
}
|
|
605
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Class for interacting with an agent via the A2A protocol
|
|
658
|
+
*/
|
|
659
|
+
declare class A2A extends BaseResource {
|
|
660
|
+
private agentId;
|
|
661
|
+
constructor(options: ClientOptions, agentId: string);
|
|
662
|
+
/**
|
|
663
|
+
* Get the agent card with metadata about the agent
|
|
664
|
+
* @returns Promise containing the agent card information
|
|
665
|
+
*/
|
|
666
|
+
getCard(): Promise<AgentCard>;
|
|
667
|
+
/**
|
|
668
|
+
* Send a message to the agent and get a response
|
|
669
|
+
* @param params - Parameters for the task
|
|
670
|
+
* @returns Promise containing the task response
|
|
671
|
+
*/
|
|
672
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
673
|
+
task: Task;
|
|
674
|
+
}>;
|
|
675
|
+
/**
|
|
676
|
+
* Get the status and result of a task
|
|
677
|
+
* @param params - Parameters for querying the task
|
|
678
|
+
* @returns Promise containing the task response
|
|
679
|
+
*/
|
|
680
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
681
|
+
/**
|
|
682
|
+
* Cancel a running task
|
|
683
|
+
* @param params - Parameters identifying the task to cancel
|
|
684
|
+
* @returns Promise containing the task response
|
|
685
|
+
*/
|
|
686
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
687
|
+
task: Task;
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
691
|
+
* @param params - Parameters for the task
|
|
692
|
+
* @returns Promise containing the task response
|
|
693
|
+
*/
|
|
694
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Represents a specific tool available on a specific MCP server.
|
|
699
|
+
* Provides methods to get details and execute the tool.
|
|
700
|
+
*/
|
|
701
|
+
declare class MCPTool extends BaseResource {
|
|
702
|
+
private serverId;
|
|
703
|
+
private toolId;
|
|
704
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
705
|
+
/**
|
|
706
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
707
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
708
|
+
*/
|
|
709
|
+
details(): Promise<McpToolInfo>;
|
|
710
|
+
/**
|
|
711
|
+
* Executes this specific tool on the MCP server.
|
|
712
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
713
|
+
* @returns Promise containing the result of the tool execution.
|
|
714
|
+
*/
|
|
715
|
+
execute(params: {
|
|
716
|
+
data?: any;
|
|
717
|
+
runtimeContext?: RuntimeContext;
|
|
718
|
+
}): Promise<any>;
|
|
719
|
+
}
|
|
720
|
+
|
|
606
721
|
declare class MastraClient extends BaseResource {
|
|
607
722
|
constructor(options: ClientOptions);
|
|
608
723
|
/**
|
|
@@ -725,6 +840,44 @@ declare class MastraClient extends BaseResource {
|
|
|
725
840
|
* @returns Network instance
|
|
726
841
|
*/
|
|
727
842
|
getNetwork(networkId: string): Network;
|
|
843
|
+
/**
|
|
844
|
+
* Retrieves a list of available MCP servers.
|
|
845
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
846
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
847
|
+
*/
|
|
848
|
+
getMcpServers(params?: {
|
|
849
|
+
limit?: number;
|
|
850
|
+
offset?: number;
|
|
851
|
+
}): Promise<McpServerListResponse>;
|
|
852
|
+
/**
|
|
853
|
+
* Retrieves detailed information for a specific MCP server.
|
|
854
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
855
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
856
|
+
* @returns Promise containing the detailed MCP server information.
|
|
857
|
+
*/
|
|
858
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
859
|
+
version?: string;
|
|
860
|
+
}): Promise<ServerDetailInfo>;
|
|
861
|
+
/**
|
|
862
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
863
|
+
* @param serverId - The ID of the MCP server.
|
|
864
|
+
* @returns Promise containing the list of tools.
|
|
865
|
+
*/
|
|
866
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
867
|
+
/**
|
|
868
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
869
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
870
|
+
* @param serverId - The ID of the MCP server.
|
|
871
|
+
* @param toolId - The ID of the tool.
|
|
872
|
+
* @returns MCPTool instance.
|
|
873
|
+
*/
|
|
874
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
875
|
+
/**
|
|
876
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
877
|
+
* @param agentId - ID of the agent to interact with
|
|
878
|
+
* @returns A2A client instance
|
|
879
|
+
*/
|
|
880
|
+
getA2A(agentId: string): A2A;
|
|
728
881
|
}
|
|
729
882
|
|
|
730
|
-
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 GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
883
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVNextWorkflowRunsResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, 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 VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, VNextWorkflowRuns, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
4
|
import { JSONSchema7 } from 'json-schema';
|
|
5
5
|
import { ZodSchema } from 'zod';
|
|
6
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
7
|
-
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
8
7
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
8
|
+
import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
|
|
9
|
+
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
10
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/di';
|
|
11
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
9
12
|
|
|
10
13
|
interface ClientOptions {
|
|
11
14
|
/** Base URL for API requests */
|
|
@@ -26,19 +29,31 @@ interface RequestOptions {
|
|
|
26
29
|
stream?: boolean;
|
|
27
30
|
signal?: AbortSignal;
|
|
28
31
|
}
|
|
32
|
+
type WithoutMethods<T> = {
|
|
33
|
+
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
34
|
+
(): any;
|
|
35
|
+
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
36
|
+
};
|
|
29
37
|
interface GetAgentResponse {
|
|
30
38
|
name: string;
|
|
31
39
|
instructions: string;
|
|
32
40
|
tools: Record<string, GetToolResponse>;
|
|
41
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
33
42
|
provider: string;
|
|
34
43
|
modelId: string;
|
|
35
44
|
}
|
|
36
45
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
46
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
47
|
+
output?: T;
|
|
48
|
+
experimental_output?: T;
|
|
49
|
+
runtimeContext?: RuntimeContext;
|
|
50
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
39
51
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
40
52
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
41
|
-
|
|
53
|
+
output?: T;
|
|
54
|
+
experimental_output?: T;
|
|
55
|
+
runtimeContext?: RuntimeContext;
|
|
56
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
42
57
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
43
58
|
evals: any[];
|
|
44
59
|
instructions: string;
|
|
@@ -67,6 +82,7 @@ interface GetWorkflowRunsParams {
|
|
|
67
82
|
resourceId?: string;
|
|
68
83
|
}
|
|
69
84
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
85
|
+
type GetVNextWorkflowRunsResponse = VNextWorkflowRuns;
|
|
70
86
|
type WorkflowRunResult = {
|
|
71
87
|
activePaths: Record<string, {
|
|
72
88
|
status: string;
|
|
@@ -146,6 +162,12 @@ interface UpdateMemoryThreadParams {
|
|
|
146
162
|
metadata: Record<string, any>;
|
|
147
163
|
resourceId: string;
|
|
148
164
|
}
|
|
165
|
+
interface GetMemoryThreadMessagesParams {
|
|
166
|
+
/**
|
|
167
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
168
|
+
*/
|
|
169
|
+
limit?: number;
|
|
170
|
+
}
|
|
149
171
|
interface GetMemoryThreadMessagesResponse {
|
|
150
172
|
messages: CoreMessage[];
|
|
151
173
|
uiMessages: AiMessageType[];
|
|
@@ -222,6 +244,20 @@ interface GetNetworkResponse {
|
|
|
222
244
|
};
|
|
223
245
|
state?: Record<string, any>;
|
|
224
246
|
}
|
|
247
|
+
interface McpServerListResponse {
|
|
248
|
+
servers: ServerInfo[];
|
|
249
|
+
next: string | null;
|
|
250
|
+
total_count: number;
|
|
251
|
+
}
|
|
252
|
+
interface McpToolInfo {
|
|
253
|
+
id: string;
|
|
254
|
+
name: string;
|
|
255
|
+
description?: string;
|
|
256
|
+
inputSchema: string;
|
|
257
|
+
}
|
|
258
|
+
interface McpServerToolListResponse {
|
|
259
|
+
tools: McpToolInfo[];
|
|
260
|
+
}
|
|
225
261
|
|
|
226
262
|
declare class BaseResource {
|
|
227
263
|
readonly options: ClientOptions;
|
|
@@ -254,7 +290,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
254
290
|
* @param options - Optional provider-specific options
|
|
255
291
|
* @returns Promise containing the transcribed text
|
|
256
292
|
*/
|
|
257
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
293
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
294
|
+
text: string;
|
|
295
|
+
}>;
|
|
258
296
|
/**
|
|
259
297
|
* Get available speakers for the agent's voice provider
|
|
260
298
|
* @returns Promise containing list of available speakers
|
|
@@ -293,6 +331,16 @@ declare class Agent extends BaseResource {
|
|
|
293
331
|
* @returns Promise containing tool details
|
|
294
332
|
*/
|
|
295
333
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
334
|
+
/**
|
|
335
|
+
* Executes a tool for the agent
|
|
336
|
+
* @param toolId - ID of the tool to execute
|
|
337
|
+
* @param params - Parameters required for tool execution
|
|
338
|
+
* @returns Promise containing the tool execution results
|
|
339
|
+
*/
|
|
340
|
+
executeTool(toolId: string, params: {
|
|
341
|
+
data: any;
|
|
342
|
+
runtimeContext?: RuntimeContext$1;
|
|
343
|
+
}): Promise<any>;
|
|
296
344
|
/**
|
|
297
345
|
* Retrieves evaluation results for the agent
|
|
298
346
|
* @returns Promise containing agent evaluations
|
|
@@ -353,9 +401,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
353
401
|
}>;
|
|
354
402
|
/**
|
|
355
403
|
* Retrieves messages associated with the thread
|
|
404
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
356
405
|
* @returns Promise containing thread messages and UI messages
|
|
357
406
|
*/
|
|
358
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
407
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
359
408
|
}
|
|
360
409
|
|
|
361
410
|
declare class Vector extends BaseResource {
|
|
@@ -512,6 +561,7 @@ declare class Tool extends BaseResource {
|
|
|
512
561
|
execute(params: {
|
|
513
562
|
data: any;
|
|
514
563
|
runId?: string;
|
|
564
|
+
runtimeContext?: RuntimeContext$1;
|
|
515
565
|
}): Promise<any>;
|
|
516
566
|
}
|
|
517
567
|
|
|
@@ -536,7 +586,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
586
|
* @param params - Parameters for filtering runs
|
|
537
587
|
* @returns Promise containing vNext workflow runs array
|
|
538
588
|
*/
|
|
539
|
-
runs(params?: GetWorkflowRunsParams): Promise<
|
|
589
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetVNextWorkflowRunsResponse>;
|
|
540
590
|
/**
|
|
541
591
|
* Creates a new vNext workflow run
|
|
542
592
|
* @param params - Optional object containing the optional runId
|
|
@@ -564,7 +614,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
564
614
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
565
615
|
* @returns Promise containing success message
|
|
566
616
|
*/
|
|
567
|
-
resume({ step, runId, resumeData,
|
|
617
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
568
618
|
step: string | string[];
|
|
569
619
|
runId: string;
|
|
570
620
|
resumeData?: Record<string, any>;
|
|
@@ -603,6 +653,71 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
603
653
|
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
604
654
|
}
|
|
605
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Class for interacting with an agent via the A2A protocol
|
|
658
|
+
*/
|
|
659
|
+
declare class A2A extends BaseResource {
|
|
660
|
+
private agentId;
|
|
661
|
+
constructor(options: ClientOptions, agentId: string);
|
|
662
|
+
/**
|
|
663
|
+
* Get the agent card with metadata about the agent
|
|
664
|
+
* @returns Promise containing the agent card information
|
|
665
|
+
*/
|
|
666
|
+
getCard(): Promise<AgentCard>;
|
|
667
|
+
/**
|
|
668
|
+
* Send a message to the agent and get a response
|
|
669
|
+
* @param params - Parameters for the task
|
|
670
|
+
* @returns Promise containing the task response
|
|
671
|
+
*/
|
|
672
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
673
|
+
task: Task;
|
|
674
|
+
}>;
|
|
675
|
+
/**
|
|
676
|
+
* Get the status and result of a task
|
|
677
|
+
* @param params - Parameters for querying the task
|
|
678
|
+
* @returns Promise containing the task response
|
|
679
|
+
*/
|
|
680
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
681
|
+
/**
|
|
682
|
+
* Cancel a running task
|
|
683
|
+
* @param params - Parameters identifying the task to cancel
|
|
684
|
+
* @returns Promise containing the task response
|
|
685
|
+
*/
|
|
686
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
687
|
+
task: Task;
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
691
|
+
* @param params - Parameters for the task
|
|
692
|
+
* @returns Promise containing the task response
|
|
693
|
+
*/
|
|
694
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Represents a specific tool available on a specific MCP server.
|
|
699
|
+
* Provides methods to get details and execute the tool.
|
|
700
|
+
*/
|
|
701
|
+
declare class MCPTool extends BaseResource {
|
|
702
|
+
private serverId;
|
|
703
|
+
private toolId;
|
|
704
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
705
|
+
/**
|
|
706
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
707
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
708
|
+
*/
|
|
709
|
+
details(): Promise<McpToolInfo>;
|
|
710
|
+
/**
|
|
711
|
+
* Executes this specific tool on the MCP server.
|
|
712
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
713
|
+
* @returns Promise containing the result of the tool execution.
|
|
714
|
+
*/
|
|
715
|
+
execute(params: {
|
|
716
|
+
data?: any;
|
|
717
|
+
runtimeContext?: RuntimeContext;
|
|
718
|
+
}): Promise<any>;
|
|
719
|
+
}
|
|
720
|
+
|
|
606
721
|
declare class MastraClient extends BaseResource {
|
|
607
722
|
constructor(options: ClientOptions);
|
|
608
723
|
/**
|
|
@@ -725,6 +840,44 @@ declare class MastraClient extends BaseResource {
|
|
|
725
840
|
* @returns Network instance
|
|
726
841
|
*/
|
|
727
842
|
getNetwork(networkId: string): Network;
|
|
843
|
+
/**
|
|
844
|
+
* Retrieves a list of available MCP servers.
|
|
845
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
846
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
847
|
+
*/
|
|
848
|
+
getMcpServers(params?: {
|
|
849
|
+
limit?: number;
|
|
850
|
+
offset?: number;
|
|
851
|
+
}): Promise<McpServerListResponse>;
|
|
852
|
+
/**
|
|
853
|
+
* Retrieves detailed information for a specific MCP server.
|
|
854
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
855
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
856
|
+
* @returns Promise containing the detailed MCP server information.
|
|
857
|
+
*/
|
|
858
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
859
|
+
version?: string;
|
|
860
|
+
}): Promise<ServerDetailInfo>;
|
|
861
|
+
/**
|
|
862
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
863
|
+
* @param serverId - The ID of the MCP server.
|
|
864
|
+
* @returns Promise containing the list of tools.
|
|
865
|
+
*/
|
|
866
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
867
|
+
/**
|
|
868
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
869
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
870
|
+
* @param serverId - The ID of the MCP server.
|
|
871
|
+
* @param toolId - The ID of the tool.
|
|
872
|
+
* @returns MCPTool instance.
|
|
873
|
+
*/
|
|
874
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
875
|
+
/**
|
|
876
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
877
|
+
* @param agentId - ID of the agent to interact with
|
|
878
|
+
* @returns A2A client instance
|
|
879
|
+
*/
|
|
880
|
+
getA2A(agentId: string): A2A;
|
|
728
881
|
}
|
|
729
882
|
|
|
730
|
-
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 GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
883
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVNextWorkflowRunsResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, 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 VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|