@voltagent/core 1.1.12 → 1.1.13
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.mts +96 -461
- package/dist/index.d.ts +96 -461
- package/dist/index.js +289 -612
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -616
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,8 @@ import { SpanProcessor, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
|
16
16
|
import { DangerouslyAllowAny, PlainObject } from '@voltagent/internal/types';
|
|
17
17
|
import * as TF from 'type-fest';
|
|
18
18
|
import { EventEmitter } from 'node:events';
|
|
19
|
-
import {
|
|
19
|
+
import { A2AServerLike, A2AServerDeps, A2AServerMetadata, A2AServerFactory } from '@voltagent/internal/a2a';
|
|
20
|
+
import { MCPServerLike, MCPServerDeps, MCPServerMetadata, MCPServerFactory } from '@voltagent/internal/mcp';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Represents a collection of related tools with optional shared instructions.
|
|
@@ -2955,6 +2956,8 @@ type OperationContext = {
|
|
|
2955
2956
|
isActive: boolean;
|
|
2956
2957
|
/** Parent agent ID if part of a delegation chain */
|
|
2957
2958
|
parentAgentId?: string;
|
|
2959
|
+
/** Optional elicitation bridge for requesting user input */
|
|
2960
|
+
elicitation?: (request: unknown) => Promise<unknown>;
|
|
2958
2961
|
/** Trace context for managing span hierarchy and common attributes */
|
|
2959
2962
|
traceContext: AgentTraceContext;
|
|
2960
2963
|
/** Execution-scoped logger with full context (userId, conversationId, executionId) */
|
|
@@ -3294,6 +3297,7 @@ interface BaseGenerationOptions extends Partial<CallSettings> {
|
|
|
3294
3297
|
userId?: string;
|
|
3295
3298
|
conversationId?: string;
|
|
3296
3299
|
context?: ContextInput;
|
|
3300
|
+
elicitation?: (request: unknown) => Promise<unknown>;
|
|
3297
3301
|
parentAgentId?: string;
|
|
3298
3302
|
parentOperationContext?: OperationContext;
|
|
3299
3303
|
parentSpan?: Span;
|
|
@@ -5744,10 +5748,73 @@ interface BaseEventMetadata {
|
|
|
5744
5748
|
context?: Record<string, unknown>;
|
|
5745
5749
|
}
|
|
5746
5750
|
|
|
5751
|
+
declare class A2AServerRegistry<TServer extends A2AServerLike = A2AServerLike> {
|
|
5752
|
+
private readonly servers;
|
|
5753
|
+
private readonly idByServer;
|
|
5754
|
+
private readonly serverById;
|
|
5755
|
+
private readonly metadataById;
|
|
5756
|
+
private anonymousCounter;
|
|
5757
|
+
register(server: TServer, deps: A2AServerDeps): void;
|
|
5758
|
+
unregister(server: TServer): void;
|
|
5759
|
+
getServer(id: string): TServer | undefined;
|
|
5760
|
+
getMetadata(id: string): A2AServerMetadata | undefined;
|
|
5761
|
+
list(): TServer[];
|
|
5762
|
+
listMetadata(): A2AServerMetadata[];
|
|
5763
|
+
private resolveMetadata;
|
|
5764
|
+
private normalizeIdentifier;
|
|
5765
|
+
private ensureUniqueId;
|
|
5766
|
+
private createAnonymousSlug;
|
|
5767
|
+
private createAnonymousName;
|
|
5768
|
+
}
|
|
5769
|
+
|
|
5770
|
+
interface RegisterOptions {
|
|
5771
|
+
startTransports?: boolean;
|
|
5772
|
+
transportOptions?: Record<string, unknown>;
|
|
5773
|
+
}
|
|
5774
|
+
declare class MCPServerRegistry<TServer extends MCPServerLike = MCPServerLike> {
|
|
5775
|
+
private readonly servers;
|
|
5776
|
+
private readonly idByServer;
|
|
5777
|
+
private readonly serverById;
|
|
5778
|
+
private readonly metadataById;
|
|
5779
|
+
private anonymousCounter;
|
|
5780
|
+
register(server: TServer, deps: MCPServerDeps, options?: RegisterOptions): void;
|
|
5781
|
+
unregister(server: TServer): void;
|
|
5782
|
+
getServer(id: string): TServer | undefined;
|
|
5783
|
+
getServerMetadata(id: string): MCPServerMetadata | undefined;
|
|
5784
|
+
list(): TServer[];
|
|
5785
|
+
listMetadata(): MCPServerMetadata[];
|
|
5786
|
+
startAll(options?: Record<string, unknown>): Promise<void>;
|
|
5787
|
+
stopAll(): Promise<void>;
|
|
5788
|
+
private startConfigured;
|
|
5789
|
+
private resolveMetadata;
|
|
5790
|
+
private normalizeIdentifier;
|
|
5791
|
+
private ensureUniqueId;
|
|
5792
|
+
private createAnonymousSlug;
|
|
5793
|
+
}
|
|
5794
|
+
|
|
5747
5795
|
/**
|
|
5748
5796
|
* Basic type definitions for VoltAgent Core
|
|
5749
5797
|
*/
|
|
5750
5798
|
|
|
5799
|
+
interface MCPLoggingAdapter {
|
|
5800
|
+
setLevel?(level: string): Promise<void> | void;
|
|
5801
|
+
getLevel?(): Promise<string | undefined> | string | undefined;
|
|
5802
|
+
}
|
|
5803
|
+
interface MCPPromptsAdapter {
|
|
5804
|
+
listPrompts(): Promise<unknown[]>;
|
|
5805
|
+
getPrompt(params: unknown): Promise<unknown>;
|
|
5806
|
+
}
|
|
5807
|
+
interface MCPResourcesAdapter {
|
|
5808
|
+
listResources(): Promise<unknown>;
|
|
5809
|
+
readResource(uri: string): Promise<unknown>;
|
|
5810
|
+
listResourceTemplates?(): Promise<unknown>;
|
|
5811
|
+
subscribe?(params: unknown, headers?: Record<string, string>): Promise<void> | void;
|
|
5812
|
+
unsubscribe?(params: unknown): Promise<void> | void;
|
|
5813
|
+
}
|
|
5814
|
+
interface MCPElicitationAdapter {
|
|
5815
|
+
sendRequest(request: unknown): Promise<unknown>;
|
|
5816
|
+
}
|
|
5817
|
+
|
|
5751
5818
|
/**
|
|
5752
5819
|
* Server provider interface
|
|
5753
5820
|
*/
|
|
@@ -5784,6 +5851,12 @@ interface ServerProviderDeps {
|
|
|
5784
5851
|
logger?: Logger;
|
|
5785
5852
|
voltOpsClient?: VoltOpsClient;
|
|
5786
5853
|
observability?: VoltAgentObservability;
|
|
5854
|
+
mcp?: {
|
|
5855
|
+
registry: MCPServerRegistry;
|
|
5856
|
+
};
|
|
5857
|
+
a2a?: {
|
|
5858
|
+
registry: A2AServerRegistry;
|
|
5859
|
+
};
|
|
5787
5860
|
}
|
|
5788
5861
|
/**
|
|
5789
5862
|
* Server provider factory type
|
|
@@ -5854,6 +5927,15 @@ type VoltAgentOptions = {
|
|
|
5854
5927
|
* If not provided, a default logger will be created
|
|
5855
5928
|
*/
|
|
5856
5929
|
logger?: Logger;
|
|
5930
|
+
/**
|
|
5931
|
+
* Optional collection of MCP servers to register alongside the primary server.
|
|
5932
|
+
* Enables exposing multiple VoltAgent surfaces through separate MCP endpoints.
|
|
5933
|
+
*/
|
|
5934
|
+
mcpServers?: Record<string, MCPServerLike | MCPServerFactory>;
|
|
5935
|
+
/**
|
|
5936
|
+
* Optional collection of A2A servers to expose agents via the Agent-to-Agent protocol.
|
|
5937
|
+
*/
|
|
5938
|
+
a2aServers?: Record<string, A2AServerLike | A2AServerFactory>;
|
|
5857
5939
|
/**
|
|
5858
5940
|
* @deprecated Use `server.port` instead
|
|
5859
5941
|
*/
|
|
@@ -6213,465 +6295,6 @@ declare const createRetrieverTool: (retriever: Retriever, options?: {
|
|
|
6213
6295
|
description?: string;
|
|
6214
6296
|
}) => AgentTool;
|
|
6215
6297
|
|
|
6216
|
-
/**
|
|
6217
|
-
* Client information for MCP
|
|
6218
|
-
*/
|
|
6219
|
-
interface ClientInfo {
|
|
6220
|
-
/**
|
|
6221
|
-
* Client name
|
|
6222
|
-
*/
|
|
6223
|
-
name: string;
|
|
6224
|
-
/**
|
|
6225
|
-
* Client version
|
|
6226
|
-
*/
|
|
6227
|
-
version: string;
|
|
6228
|
-
/**
|
|
6229
|
-
* Allow additional properties for SDK compatibility
|
|
6230
|
-
*/
|
|
6231
|
-
[key: string]: unknown;
|
|
6232
|
-
}
|
|
6233
|
-
/**
|
|
6234
|
-
* Transport error from MCP
|
|
6235
|
-
*/
|
|
6236
|
-
interface TransportError extends Error {
|
|
6237
|
-
/**
|
|
6238
|
-
* Error code
|
|
6239
|
-
*/
|
|
6240
|
-
code?: string;
|
|
6241
|
-
/**
|
|
6242
|
-
* Error details
|
|
6243
|
-
*/
|
|
6244
|
-
details?: unknown;
|
|
6245
|
-
}
|
|
6246
|
-
/**
|
|
6247
|
-
* Model Context Protocol (MCP) configuration options
|
|
6248
|
-
*/
|
|
6249
|
-
type MCPOptions = {
|
|
6250
|
-
/**
|
|
6251
|
-
* Whether MCP is enabled
|
|
6252
|
-
*/
|
|
6253
|
-
enabled: boolean;
|
|
6254
|
-
/**
|
|
6255
|
-
* MCP API endpoint
|
|
6256
|
-
*/
|
|
6257
|
-
endpoint?: string;
|
|
6258
|
-
/**
|
|
6259
|
-
* API key for MCP authentication
|
|
6260
|
-
*/
|
|
6261
|
-
apiKey?: string;
|
|
6262
|
-
/**
|
|
6263
|
-
* Control parameters for MCP
|
|
6264
|
-
*/
|
|
6265
|
-
controlParams?: Record<string, unknown>;
|
|
6266
|
-
/**
|
|
6267
|
-
* Whether to fall back to the provider if MCP fails
|
|
6268
|
-
*/
|
|
6269
|
-
fallbackToProvider?: boolean;
|
|
6270
|
-
/**
|
|
6271
|
-
* Timeout in milliseconds for MCP requests
|
|
6272
|
-
* @default 30000
|
|
6273
|
-
*/
|
|
6274
|
-
timeout?: number;
|
|
6275
|
-
};
|
|
6276
|
-
/**
|
|
6277
|
-
* Configuration for MCP client
|
|
6278
|
-
*/
|
|
6279
|
-
type MCPClientConfig = {
|
|
6280
|
-
/**
|
|
6281
|
-
* Client information
|
|
6282
|
-
*/
|
|
6283
|
-
clientInfo: ClientInfo;
|
|
6284
|
-
/**
|
|
6285
|
-
* MCP server configuration
|
|
6286
|
-
*/
|
|
6287
|
-
server: MCPServerConfig;
|
|
6288
|
-
/**
|
|
6289
|
-
* MCP capabilities
|
|
6290
|
-
*/
|
|
6291
|
-
capabilities?: ClientCapabilities;
|
|
6292
|
-
/**
|
|
6293
|
-
* Timeout in milliseconds for MCP requests
|
|
6294
|
-
* @default 30000
|
|
6295
|
-
*/
|
|
6296
|
-
timeout?: number;
|
|
6297
|
-
};
|
|
6298
|
-
/**
|
|
6299
|
-
* MCP server configuration options
|
|
6300
|
-
*/
|
|
6301
|
-
type MCPServerConfig = HTTPServerConfig | SSEServerConfig | StreamableHTTPServerConfig | StdioServerConfig;
|
|
6302
|
-
/**
|
|
6303
|
-
* HTTP-based MCP server configuration with automatic fallback
|
|
6304
|
-
* Tries streamable HTTP first, falls back to SSE if not supported
|
|
6305
|
-
*/
|
|
6306
|
-
type HTTPServerConfig = {
|
|
6307
|
-
/**
|
|
6308
|
-
* Type of server connection
|
|
6309
|
-
*/
|
|
6310
|
-
type: "http";
|
|
6311
|
-
/**
|
|
6312
|
-
* URL of the MCP server
|
|
6313
|
-
*/
|
|
6314
|
-
url: string;
|
|
6315
|
-
/**
|
|
6316
|
-
* Request initialization options
|
|
6317
|
-
*/
|
|
6318
|
-
requestInit?: RequestInit;
|
|
6319
|
-
/**
|
|
6320
|
-
* Event source initialization options (used for SSE fallback)
|
|
6321
|
-
*/
|
|
6322
|
-
eventSourceInit?: EventSourceInit;
|
|
6323
|
-
/**
|
|
6324
|
-
* Optional maximum request timeout in milliseconds.
|
|
6325
|
-
* If provided, passed to MCPClient as the per-request timeout.
|
|
6326
|
-
*/
|
|
6327
|
-
timeout?: number;
|
|
6328
|
-
};
|
|
6329
|
-
/**
|
|
6330
|
-
* SSE-based MCP server configuration (explicit SSE transport)
|
|
6331
|
-
*/
|
|
6332
|
-
type SSEServerConfig = {
|
|
6333
|
-
/**
|
|
6334
|
-
* Type of server connection
|
|
6335
|
-
*/
|
|
6336
|
-
type: "sse";
|
|
6337
|
-
/**
|
|
6338
|
-
* URL of the MCP server
|
|
6339
|
-
*/
|
|
6340
|
-
url: string;
|
|
6341
|
-
/**
|
|
6342
|
-
* Request initialization options
|
|
6343
|
-
*/
|
|
6344
|
-
requestInit?: RequestInit;
|
|
6345
|
-
/**
|
|
6346
|
-
* Event source initialization options
|
|
6347
|
-
*/
|
|
6348
|
-
eventSourceInit?: EventSourceInit;
|
|
6349
|
-
/**
|
|
6350
|
-
* Optional maximum request timeout in milliseconds.
|
|
6351
|
-
* If provided, passed to MCPClient as the per-request timeout.
|
|
6352
|
-
*/
|
|
6353
|
-
timeout?: number;
|
|
6354
|
-
};
|
|
6355
|
-
/**
|
|
6356
|
-
* Streamable HTTP-based MCP server configuration (no fallback)
|
|
6357
|
-
*/
|
|
6358
|
-
type StreamableHTTPServerConfig = {
|
|
6359
|
-
/**
|
|
6360
|
-
* Type of server connection
|
|
6361
|
-
*/
|
|
6362
|
-
type: "streamable-http";
|
|
6363
|
-
/**
|
|
6364
|
-
* URL of the MCP server
|
|
6365
|
-
*/
|
|
6366
|
-
url: string;
|
|
6367
|
-
/**
|
|
6368
|
-
* Request initialization options
|
|
6369
|
-
*/
|
|
6370
|
-
requestInit?: RequestInit;
|
|
6371
|
-
/**
|
|
6372
|
-
* Session ID for the connection
|
|
6373
|
-
*/
|
|
6374
|
-
sessionId?: string;
|
|
6375
|
-
/**
|
|
6376
|
-
* Optional maximum request timeout in milliseconds.
|
|
6377
|
-
* If provided, passed to MCPClient as the per-request timeout.
|
|
6378
|
-
*/
|
|
6379
|
-
timeout?: number;
|
|
6380
|
-
};
|
|
6381
|
-
/**
|
|
6382
|
-
* Stdio-based MCP server configuration
|
|
6383
|
-
*/
|
|
6384
|
-
type StdioServerConfig = {
|
|
6385
|
-
/**
|
|
6386
|
-
* Type of server connection
|
|
6387
|
-
*/
|
|
6388
|
-
type: "stdio";
|
|
6389
|
-
/**
|
|
6390
|
-
* Command to run the MCP server
|
|
6391
|
-
*/
|
|
6392
|
-
command: string;
|
|
6393
|
-
/**
|
|
6394
|
-
* Arguments to pass to the command
|
|
6395
|
-
*/
|
|
6396
|
-
args?: string[];
|
|
6397
|
-
/**
|
|
6398
|
-
* Environment variables for the MCP server process
|
|
6399
|
-
*/
|
|
6400
|
-
env?: Record<string, string>;
|
|
6401
|
-
/**
|
|
6402
|
-
* Working directory for the MCP server process
|
|
6403
|
-
*/
|
|
6404
|
-
cwd?: string;
|
|
6405
|
-
/**
|
|
6406
|
-
* Optional maximum request timeout in milliseconds.
|
|
6407
|
-
* If provided, passed to MCPClient as the per-request timeout.
|
|
6408
|
-
*/
|
|
6409
|
-
timeout?: number;
|
|
6410
|
-
};
|
|
6411
|
-
/**
|
|
6412
|
-
* Tool call request
|
|
6413
|
-
*/
|
|
6414
|
-
type MCPToolCall = {
|
|
6415
|
-
/**
|
|
6416
|
-
* Name of the tool to call
|
|
6417
|
-
*/
|
|
6418
|
-
name: string;
|
|
6419
|
-
/**
|
|
6420
|
-
* Arguments to pass to the tool
|
|
6421
|
-
*/
|
|
6422
|
-
arguments: Record<string, unknown>;
|
|
6423
|
-
};
|
|
6424
|
-
/**
|
|
6425
|
-
* Tool call result
|
|
6426
|
-
*/
|
|
6427
|
-
type MCPToolResult = {
|
|
6428
|
-
/**
|
|
6429
|
-
* Result content from the tool
|
|
6430
|
-
*/
|
|
6431
|
-
content: unknown;
|
|
6432
|
-
};
|
|
6433
|
-
/**
|
|
6434
|
-
* MCP client events
|
|
6435
|
-
*/
|
|
6436
|
-
interface MCPClientEvents {
|
|
6437
|
-
/**
|
|
6438
|
-
* Emitted when the client connects to the server
|
|
6439
|
-
*/
|
|
6440
|
-
connect: () => void;
|
|
6441
|
-
/**
|
|
6442
|
-
* Emitted when the client disconnects from the server
|
|
6443
|
-
*/
|
|
6444
|
-
disconnect: () => void;
|
|
6445
|
-
/**
|
|
6446
|
-
* Emitted when an error occurs
|
|
6447
|
-
*/
|
|
6448
|
-
error: (error: Error | TransportError) => void;
|
|
6449
|
-
/**
|
|
6450
|
-
* Emitted when a tool call completes
|
|
6451
|
-
*/
|
|
6452
|
-
toolCall: (name: string, args: Record<string, unknown>, result: unknown) => void;
|
|
6453
|
-
}
|
|
6454
|
-
/**
|
|
6455
|
-
* Map of toolset names to tools
|
|
6456
|
-
*/
|
|
6457
|
-
type ToolsetMap = Record<string, ToolsetWithTools>;
|
|
6458
|
-
/**
|
|
6459
|
-
* A record of tools along with a helper method to convert them to an array.
|
|
6460
|
-
*/
|
|
6461
|
-
type ToolsetWithTools = Record<string, AnyToolConfig> & {
|
|
6462
|
-
/**
|
|
6463
|
-
* Converts the toolset to an array of BaseTool objects.
|
|
6464
|
-
*/
|
|
6465
|
-
getTools: () => Tool<any>[];
|
|
6466
|
-
};
|
|
6467
|
-
/**
|
|
6468
|
-
* Any tool configuration
|
|
6469
|
-
*/
|
|
6470
|
-
type AnyToolConfig = Tool<any>;
|
|
6471
|
-
|
|
6472
|
-
/**
|
|
6473
|
-
* Client for interacting with Model Context Protocol (MCP) servers.
|
|
6474
|
-
* Wraps the official MCP SDK client to provide a higher-level interface.
|
|
6475
|
-
* Internal implementation differs from original source.
|
|
6476
|
-
*/
|
|
6477
|
-
declare class MCPClient extends EventEmitter {
|
|
6478
|
-
/**
|
|
6479
|
-
* Underlying MCP client instance from the SDK.
|
|
6480
|
-
*/
|
|
6481
|
-
private client;
|
|
6482
|
-
/**
|
|
6483
|
-
* Communication channel (transport layer) for MCP interactions.
|
|
6484
|
-
*/
|
|
6485
|
-
private transport;
|
|
6486
|
-
/**
|
|
6487
|
-
* Tracks the connection status to the server.
|
|
6488
|
-
*/
|
|
6489
|
-
private connected;
|
|
6490
|
-
/**
|
|
6491
|
-
* Maximum time allowed for requests in milliseconds.
|
|
6492
|
-
*/
|
|
6493
|
-
private readonly timeout;
|
|
6494
|
-
/**
|
|
6495
|
-
* Logger instance
|
|
6496
|
-
*/
|
|
6497
|
-
private logger;
|
|
6498
|
-
/**
|
|
6499
|
-
* Information identifying this client to the server.
|
|
6500
|
-
*/
|
|
6501
|
-
private readonly clientInfo;
|
|
6502
|
-
/**
|
|
6503
|
-
* Server configuration for fallback attempts.
|
|
6504
|
-
*/
|
|
6505
|
-
private readonly serverConfig;
|
|
6506
|
-
/**
|
|
6507
|
-
* Whether to attempt SSE fallback if streamable HTTP fails.
|
|
6508
|
-
*/
|
|
6509
|
-
private shouldAttemptFallback;
|
|
6510
|
-
/**
|
|
6511
|
-
* Client capabilities for re-initialization.
|
|
6512
|
-
*/
|
|
6513
|
-
private readonly capabilities;
|
|
6514
|
-
/**
|
|
6515
|
-
* Get server info for logging
|
|
6516
|
-
*/
|
|
6517
|
-
private getServerInfo;
|
|
6518
|
-
/**
|
|
6519
|
-
* Creates a new MCP client instance.
|
|
6520
|
-
* @param config Configuration for the client, including server details and client identity.
|
|
6521
|
-
*/
|
|
6522
|
-
constructor(config: MCPClientConfig);
|
|
6523
|
-
/**
|
|
6524
|
-
* Sets up handlers for events from the underlying SDK client.
|
|
6525
|
-
*/
|
|
6526
|
-
private setupEventHandlers;
|
|
6527
|
-
/**
|
|
6528
|
-
* Establishes a connection to the configured MCP server.
|
|
6529
|
-
* Idempotent: does nothing if already connected.
|
|
6530
|
-
*/
|
|
6531
|
-
connect(): Promise<void>;
|
|
6532
|
-
/**
|
|
6533
|
-
* Attempts to connect using SSE transport as a fallback.
|
|
6534
|
-
* @param originalError The error from the initial connection attempt.
|
|
6535
|
-
*/
|
|
6536
|
-
private attemptSSEFallback;
|
|
6537
|
-
/**
|
|
6538
|
-
* Closes the connection to the MCP server.
|
|
6539
|
-
* Idempotent: does nothing if not connected.
|
|
6540
|
-
*/
|
|
6541
|
-
disconnect(): Promise<void>;
|
|
6542
|
-
/**
|
|
6543
|
-
* Fetches the definitions of available tools from the server.
|
|
6544
|
-
* @returns A record mapping tool names to their definitions (schema, description).
|
|
6545
|
-
*/
|
|
6546
|
-
listTools(): Promise<Record<string, unknown>>;
|
|
6547
|
-
/**
|
|
6548
|
-
* Builds executable Tool objects from the server's tool definitions.
|
|
6549
|
-
* These tools include an `execute` method for calling the remote tool.
|
|
6550
|
-
* @returns A record mapping namespaced tool names (`clientName_toolName`) to executable Tool objects.
|
|
6551
|
-
*/
|
|
6552
|
-
getAgentTools(): Promise<Record<string, Tool<any>>>;
|
|
6553
|
-
/**
|
|
6554
|
-
* Executes a specified tool on the remote MCP server.
|
|
6555
|
-
* @param toolCall Details of the tool to call, including name and arguments.
|
|
6556
|
-
* @returns The result content returned by the tool.
|
|
6557
|
-
*/
|
|
6558
|
-
callTool(toolCall: MCPToolCall): Promise<MCPToolResult>;
|
|
6559
|
-
/**
|
|
6560
|
-
* Retrieves a list of resource identifiers available on the server.
|
|
6561
|
-
* @returns A promise resolving to an array of resource ID strings.
|
|
6562
|
-
*/
|
|
6563
|
-
listResources(): Promise<string[]>;
|
|
6564
|
-
/**
|
|
6565
|
-
* Ensures the client is connected before proceeding with an operation.
|
|
6566
|
-
* Attempts to connect if not currently connected.
|
|
6567
|
-
* @throws Error if connection attempt fails.
|
|
6568
|
-
*/
|
|
6569
|
-
private ensureConnected;
|
|
6570
|
-
/**
|
|
6571
|
-
* Emits an 'error' event, ensuring the payload is always an Error object.
|
|
6572
|
-
* @param error The error encountered, can be of any type.
|
|
6573
|
-
*/
|
|
6574
|
-
private emitError;
|
|
6575
|
-
/**
|
|
6576
|
-
* Type guard to check if a server configuration is for an HTTP server.
|
|
6577
|
-
* @param server The server configuration object.
|
|
6578
|
-
* @returns True if the configuration type is 'http', false otherwise.
|
|
6579
|
-
*/
|
|
6580
|
-
private isHTTPServer;
|
|
6581
|
-
/**
|
|
6582
|
-
* Type guard to check if a server configuration is for an SSE server.
|
|
6583
|
-
* @param server The server configuration object.
|
|
6584
|
-
* @returns True if the configuration type is 'sse', false otherwise.
|
|
6585
|
-
*/
|
|
6586
|
-
private isSSEServer;
|
|
6587
|
-
/**
|
|
6588
|
-
* Type guard to check if a server configuration is for a Streamable HTTP server.
|
|
6589
|
-
* @param server The server configuration object.
|
|
6590
|
-
* @returns True if the configuration type is 'streamable-http', false otherwise.
|
|
6591
|
-
*/
|
|
6592
|
-
private isStreamableHTTPServer;
|
|
6593
|
-
/**
|
|
6594
|
-
* Type guard to check if a server configuration is for a Stdio server.
|
|
6595
|
-
* @param server The server configuration object.
|
|
6596
|
-
* @returns True if the configuration type is 'stdio', false otherwise.
|
|
6597
|
-
*/
|
|
6598
|
-
private isStdioServer;
|
|
6599
|
-
/**
|
|
6600
|
-
* Overrides EventEmitter's 'on' method for type-safe event listening.
|
|
6601
|
-
* Uses the original `MCPClientEvents` for event types.
|
|
6602
|
-
*/
|
|
6603
|
-
on<E extends keyof MCPClientEvents>(event: E, listener: MCPClientEvents[E]): this;
|
|
6604
|
-
/**
|
|
6605
|
-
* Overrides EventEmitter's 'emit' method for type-safe event emission.
|
|
6606
|
-
* Uses the original `MCPClientEvents` for event types.
|
|
6607
|
-
*/
|
|
6608
|
-
emit<E extends keyof MCPClientEvents>(event: E, ...args: Parameters<MCPClientEvents[E]>): boolean;
|
|
6609
|
-
}
|
|
6610
|
-
|
|
6611
|
-
/**
|
|
6612
|
-
* Configuration manager for Model Context Protocol (MCP).
|
|
6613
|
-
* Handles multiple MCP server connections and tool management.
|
|
6614
|
-
* NOTE: This version does NOT manage singleton instances automatically.
|
|
6615
|
-
*/
|
|
6616
|
-
declare class MCPConfiguration<TServerKeys extends string = string> {
|
|
6617
|
-
/**
|
|
6618
|
-
* Map of server configurations keyed by server names.
|
|
6619
|
-
*/
|
|
6620
|
-
private readonly serverConfigs;
|
|
6621
|
-
/**
|
|
6622
|
-
* Map of connected MCP clients keyed by server names (local cache).
|
|
6623
|
-
*/
|
|
6624
|
-
private readonly mcpClientsById;
|
|
6625
|
-
/**
|
|
6626
|
-
* Creates a new, independent MCP configuration instance.
|
|
6627
|
-
* @param options Configuration options including server definitions.
|
|
6628
|
-
*/
|
|
6629
|
-
constructor(options: {
|
|
6630
|
-
servers: Record<TServerKeys, MCPServerConfig>;
|
|
6631
|
-
});
|
|
6632
|
-
/**
|
|
6633
|
-
* Type guard to check if an object conforms to the basic structure of AnyToolConfig.
|
|
6634
|
-
*/
|
|
6635
|
-
private isAnyToolConfigStructure;
|
|
6636
|
-
/**
|
|
6637
|
-
* Disconnects all associated MCP clients for THIS instance.
|
|
6638
|
-
*/
|
|
6639
|
-
disconnect(): Promise<void>;
|
|
6640
|
-
/**
|
|
6641
|
-
* Retrieves agent-ready tools from all configured MCP servers for this instance.
|
|
6642
|
-
* @returns A flat array of all agent-ready tools.
|
|
6643
|
-
*/
|
|
6644
|
-
getTools(): Promise<Tool<any>[]>;
|
|
6645
|
-
/**
|
|
6646
|
-
* Retrieves raw tool definitions from all configured MCP servers for this instance.
|
|
6647
|
-
* @returns A flat record of all raw tools keyed by their namespaced name.
|
|
6648
|
-
*/
|
|
6649
|
-
getRawTools(): Promise<Record<string, AnyToolConfig>>;
|
|
6650
|
-
/**
|
|
6651
|
-
* Retrieves agent-ready toolsets grouped by server name for this instance.
|
|
6652
|
-
* @returns A record where keys are server names and values are agent-ready toolsets.
|
|
6653
|
-
*/
|
|
6654
|
-
getToolsets(): Promise<Record<TServerKeys, ToolsetWithTools>>;
|
|
6655
|
-
/**
|
|
6656
|
-
* Retrieves raw tool definitions grouped by server name for this instance.
|
|
6657
|
-
* @returns A record where keys are server names and values are records of raw tools.
|
|
6658
|
-
*/
|
|
6659
|
-
getRawToolsets(): Promise<Record<TServerKeys, Record<string, AnyToolConfig>>>;
|
|
6660
|
-
/**
|
|
6661
|
-
* Retrieves a specific connected MCP client by its server name for this instance.
|
|
6662
|
-
*/
|
|
6663
|
-
getClient(serverName: TServerKeys): Promise<MCPClient | undefined>;
|
|
6664
|
-
/**
|
|
6665
|
-
* Retrieves all configured MCP clients for this instance, ensuring they are connected.
|
|
6666
|
-
*/
|
|
6667
|
-
getClients(): Promise<Record<TServerKeys, MCPClient>>;
|
|
6668
|
-
/**
|
|
6669
|
-
* Internal helper to get/create/connect a client for this instance.
|
|
6670
|
-
* Manages the local mcpClientsById cache.
|
|
6671
|
-
*/
|
|
6672
|
-
private getConnectedClient;
|
|
6673
|
-
}
|
|
6674
|
-
|
|
6675
6298
|
/**
|
|
6676
6299
|
* Registry to manage and track agents
|
|
6677
6300
|
*/
|
|
@@ -6894,6 +6517,10 @@ declare class VoltAgent {
|
|
|
6894
6517
|
private serverInstance?;
|
|
6895
6518
|
private logger;
|
|
6896
6519
|
private observability?;
|
|
6520
|
+
private readonly mcpServers;
|
|
6521
|
+
private readonly mcpServerRegistry;
|
|
6522
|
+
private readonly a2aServers;
|
|
6523
|
+
private readonly a2aServerRegistry;
|
|
6897
6524
|
constructor(options: VoltAgentOptions);
|
|
6898
6525
|
/**
|
|
6899
6526
|
* Setup graceful shutdown handlers
|
|
@@ -6966,6 +6593,14 @@ declare class VoltAgent {
|
|
|
6966
6593
|
* Useful for programmatic cleanup or when integrating with other frameworks
|
|
6967
6594
|
*/
|
|
6968
6595
|
shutdown(): Promise<void>;
|
|
6596
|
+
private initializeMCPServer;
|
|
6597
|
+
private initializeA2AServer;
|
|
6598
|
+
private startConfiguredMcpTransports;
|
|
6599
|
+
getMCPDependencies(): MCPServerDeps;
|
|
6600
|
+
private getA2ADependencies;
|
|
6601
|
+
getServerInstance(): IServerProvider | undefined;
|
|
6602
|
+
private shutdownMcpServers;
|
|
6603
|
+
private shutdownA2AServers;
|
|
6969
6604
|
}
|
|
6970
6605
|
|
|
6971
6606
|
/**
|
|
@@ -6979,4 +6614,4 @@ declare class VoltAgent {
|
|
|
6979
6614
|
*/
|
|
6980
6615
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
6981
6616
|
|
|
6982
|
-
export { AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type
|
|
6617
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type CachedPrompt, type ChatMessage, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetMessagesOptions, type IServerProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type LLMProvider, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, Memory, type MemoryConfig, type MemoryOptions, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredWorkflow, type RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type SpanAttributes, type SpanEvent, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, VoltOpsClient, type VoltOpsClientOptions, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|