@juspay/neurolink 9.26.2 → 9.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +59 -9
- package/dist/cli/commands/config.d.ts +4 -4
- package/dist/cli/commands/mcp.d.ts +87 -0
- package/dist/cli/commands/mcp.js +1524 -0
- package/dist/cli/loop/optionsSchema.js +4 -0
- package/dist/core/modules/ToolsManager.js +29 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +27 -1
- package/dist/lib/core/modules/ToolsManager.js +29 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +27 -1
- package/dist/lib/mcp/agentExposure.d.ts +228 -0
- package/dist/lib/mcp/agentExposure.js +357 -0
- package/dist/lib/mcp/batching/index.d.ts +11 -0
- package/dist/lib/mcp/batching/index.js +11 -0
- package/dist/lib/mcp/batching/requestBatcher.d.ts +202 -0
- package/dist/lib/mcp/batching/requestBatcher.js +442 -0
- package/dist/lib/mcp/caching/index.d.ts +11 -0
- package/dist/lib/mcp/caching/index.js +11 -0
- package/dist/lib/mcp/caching/toolCache.d.ts +221 -0
- package/dist/lib/mcp/caching/toolCache.js +434 -0
- package/dist/lib/mcp/elicitation/elicitationManager.d.ts +169 -0
- package/dist/lib/mcp/elicitation/elicitationManager.js +377 -0
- package/dist/lib/mcp/elicitation/index.d.ts +11 -0
- package/dist/lib/mcp/elicitation/index.js +12 -0
- package/dist/lib/mcp/elicitation/types.d.ts +278 -0
- package/dist/lib/mcp/elicitation/types.js +11 -0
- package/dist/lib/mcp/elicitationProtocol.d.ts +228 -0
- package/dist/lib/mcp/elicitationProtocol.js +376 -0
- package/dist/lib/mcp/enhancedToolDiscovery.d.ts +205 -0
- package/dist/lib/mcp/enhancedToolDiscovery.js +482 -0
- package/dist/lib/mcp/index.d.ts +38 -1
- package/dist/lib/mcp/index.js +36 -3
- package/dist/lib/mcp/mcpRegistryClient.d.ts +332 -0
- package/dist/lib/mcp/mcpRegistryClient.js +489 -0
- package/dist/lib/mcp/mcpServerBase.d.ts +227 -0
- package/dist/lib/mcp/mcpServerBase.js +374 -0
- package/dist/lib/mcp/multiServerManager.d.ts +310 -0
- package/dist/lib/mcp/multiServerManager.js +580 -0
- package/dist/lib/mcp/routing/index.d.ts +11 -0
- package/dist/lib/mcp/routing/index.js +11 -0
- package/dist/lib/mcp/routing/toolRouter.d.ts +219 -0
- package/dist/lib/mcp/routing/toolRouter.js +417 -0
- package/dist/lib/mcp/serverCapabilities.d.ts +341 -0
- package/dist/lib/mcp/serverCapabilities.js +503 -0
- package/dist/lib/mcp/toolAnnotations.d.ts +154 -0
- package/dist/lib/mcp/toolAnnotations.js +240 -0
- package/dist/lib/mcp/toolConverter.d.ts +178 -0
- package/dist/lib/mcp/toolConverter.js +259 -0
- package/dist/lib/mcp/toolIntegration.d.ts +136 -0
- package/dist/lib/mcp/toolIntegration.js +335 -0
- package/dist/lib/memory/hippocampusInitializer.d.ts +2 -2
- package/dist/lib/memory/hippocampusInitializer.js +1 -1
- package/dist/lib/neurolink.d.ts +275 -2
- package/dist/lib/neurolink.js +596 -56
- package/dist/lib/providers/litellm.d.ts +10 -0
- package/dist/lib/providers/litellm.js +104 -2
- package/dist/lib/types/configTypes.d.ts +56 -0
- package/dist/lib/types/conversation.d.ts +2 -2
- package/dist/lib/types/generateTypes.d.ts +4 -0
- package/dist/lib/types/index.d.ts +2 -1
- package/dist/lib/types/modelTypes.d.ts +6 -6
- package/dist/lib/types/streamTypes.d.ts +2 -0
- package/dist/lib/types/tools.d.ts +2 -0
- package/dist/lib/utils/pricing.js +177 -17
- package/dist/lib/utils/schemaConversion.d.ts +6 -1
- package/dist/lib/utils/schemaConversion.js +50 -28
- package/dist/lib/workflow/config.d.ts +16 -16
- package/dist/mcp/agentExposure.d.ts +228 -0
- package/dist/mcp/agentExposure.js +356 -0
- package/dist/mcp/batching/index.d.ts +11 -0
- package/dist/mcp/batching/index.js +10 -0
- package/dist/mcp/batching/requestBatcher.d.ts +202 -0
- package/dist/mcp/batching/requestBatcher.js +441 -0
- package/dist/mcp/caching/index.d.ts +11 -0
- package/dist/mcp/caching/index.js +10 -0
- package/dist/mcp/caching/toolCache.d.ts +221 -0
- package/dist/mcp/caching/toolCache.js +433 -0
- package/dist/mcp/elicitation/elicitationManager.d.ts +169 -0
- package/dist/mcp/elicitation/elicitationManager.js +376 -0
- package/dist/mcp/elicitation/index.d.ts +11 -0
- package/dist/mcp/elicitation/index.js +11 -0
- package/dist/mcp/elicitation/types.d.ts +278 -0
- package/dist/mcp/elicitation/types.js +10 -0
- package/dist/mcp/elicitationProtocol.d.ts +228 -0
- package/dist/mcp/elicitationProtocol.js +375 -0
- package/dist/mcp/enhancedToolDiscovery.d.ts +205 -0
- package/dist/mcp/enhancedToolDiscovery.js +481 -0
- package/dist/mcp/index.d.ts +38 -1
- package/dist/mcp/index.js +36 -3
- package/dist/mcp/mcpRegistryClient.d.ts +332 -0
- package/dist/mcp/mcpRegistryClient.js +488 -0
- package/dist/mcp/mcpServerBase.d.ts +227 -0
- package/dist/mcp/mcpServerBase.js +373 -0
- package/dist/mcp/multiServerManager.d.ts +310 -0
- package/dist/mcp/multiServerManager.js +579 -0
- package/dist/mcp/routing/index.d.ts +11 -0
- package/dist/mcp/routing/index.js +10 -0
- package/dist/mcp/routing/toolRouter.d.ts +219 -0
- package/dist/mcp/routing/toolRouter.js +416 -0
- package/dist/mcp/serverCapabilities.d.ts +341 -0
- package/dist/mcp/serverCapabilities.js +502 -0
- package/dist/mcp/toolAnnotations.d.ts +154 -0
- package/dist/mcp/toolAnnotations.js +239 -0
- package/dist/mcp/toolConverter.d.ts +178 -0
- package/dist/mcp/toolConverter.js +258 -0
- package/dist/mcp/toolIntegration.d.ts +136 -0
- package/dist/mcp/toolIntegration.js +334 -0
- package/dist/memory/hippocampusInitializer.d.ts +2 -2
- package/dist/memory/hippocampusInitializer.js +1 -1
- package/dist/neurolink.d.ts +275 -2
- package/dist/neurolink.js +596 -56
- package/dist/providers/litellm.d.ts +10 -0
- package/dist/providers/litellm.js +104 -2
- package/dist/types/configTypes.d.ts +56 -0
- package/dist/types/conversation.d.ts +2 -2
- package/dist/types/generateTypes.d.ts +4 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/streamTypes.d.ts +2 -0
- package/dist/types/tools.d.ts +2 -0
- package/dist/utils/pricing.js +177 -17
- package/dist/utils/schemaConversion.d.ts +6 -1
- package/dist/utils/schemaConversion.js +50 -28
- package/package.json +2 -2
package/dist/neurolink.d.ts
CHANGED
|
@@ -9,11 +9,12 @@ import { type CompactionConfig, type CompactionResult } from "./context/contextC
|
|
|
9
9
|
import { ConversationMemoryManager } from "./core/conversationMemoryManager.js";
|
|
10
10
|
import type { RedisConversationMemoryManager } from "./core/redisConversationMemoryManager.js";
|
|
11
11
|
import { ExternalServerManager } from "./mcp/externalServerManager.js";
|
|
12
|
+
import type { MCPToolAnnotations } from "./mcp/toolAnnotations.js";
|
|
12
13
|
import { MCPToolRegistry } from "./mcp/toolRegistry.js";
|
|
13
14
|
import type { MetricsSummary, TraceView } from "./observability/metricsAggregator.js";
|
|
14
15
|
import type { SpanData } from "./observability/types/spanTypes.js";
|
|
15
16
|
import type { JsonObject, NeuroLinkEvents, TypedEventEmitter } from "./types/common.js";
|
|
16
|
-
import type { NeurolinkConstructorConfig } from "./types/configTypes.js";
|
|
17
|
+
import type { MCPEnhancementsConfig, NeurolinkConstructorConfig } from "./types/configTypes.js";
|
|
17
18
|
import type { ChatMessage } from "./types/conversation.js";
|
|
18
19
|
import type { ExternalMCPOperationResult, ExternalMCPServerInstance, ExternalMCPToolInfo } from "./types/externalMcp.js";
|
|
19
20
|
import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
|
|
@@ -36,6 +37,13 @@ export declare class NeuroLink {
|
|
|
36
37
|
private lastCompactionMessageCount;
|
|
37
38
|
/** Extract sessionId from options context for compaction watermark keying */
|
|
38
39
|
private getCompactionSessionId;
|
|
40
|
+
private mcpToolResultCache?;
|
|
41
|
+
private mcpToolRouter?;
|
|
42
|
+
private mcpToolBatcher?;
|
|
43
|
+
private mcpEnhancedDiscovery?;
|
|
44
|
+
private mcpToolMiddlewares;
|
|
45
|
+
private _disableToolCacheForCurrentRequest;
|
|
46
|
+
private mcpEnhancementsConfig?;
|
|
39
47
|
private toolCircuitBreakers;
|
|
40
48
|
private toolExecutionMetrics;
|
|
41
49
|
private currentStreamToolExecutions;
|
|
@@ -157,6 +165,11 @@ export declare class NeuroLink {
|
|
|
157
165
|
* Initialize HITL (Human-in-the-Loop) if enabled
|
|
158
166
|
*/
|
|
159
167
|
private initializeHITL;
|
|
168
|
+
/**
|
|
169
|
+
* Initialize MCP enhancement modules (cache, router, batcher, discovery).
|
|
170
|
+
* Wires standalone MCP modules into the core SDK execution path.
|
|
171
|
+
*/
|
|
172
|
+
private initializeMCPEnhancements;
|
|
160
173
|
/**
|
|
161
174
|
* Register file reference tools with the MCP tool registry.
|
|
162
175
|
*
|
|
@@ -921,6 +934,25 @@ export declare class NeuroLink {
|
|
|
921
934
|
* @returns true if the tool was removed, false if it didn't exist
|
|
922
935
|
*/
|
|
923
936
|
unregisterTool(name: string): boolean;
|
|
937
|
+
/**
|
|
938
|
+
* Register a global tool middleware that runs on every tool execution.
|
|
939
|
+
* Middleware receives the tool, params, context, and a next() function.
|
|
940
|
+
* @param middleware - The middleware function to register
|
|
941
|
+
* @returns this (for chaining)
|
|
942
|
+
*/
|
|
943
|
+
useToolMiddleware(middleware: import("./mcp/toolIntegration.js").ToolMiddleware): this;
|
|
944
|
+
/**
|
|
945
|
+
* Get all registered tool middlewares
|
|
946
|
+
*/
|
|
947
|
+
getToolMiddlewares(): import("./mcp/toolIntegration.js").ToolMiddleware[];
|
|
948
|
+
/**
|
|
949
|
+
* Flush any pending batched tool calls immediately
|
|
950
|
+
*/
|
|
951
|
+
flushToolBatch(): Promise<void>;
|
|
952
|
+
/**
|
|
953
|
+
* Get the current MCP enhancements configuration
|
|
954
|
+
*/
|
|
955
|
+
getMCPEnhancementsConfig(): MCPEnhancementsConfig | undefined;
|
|
924
956
|
/**
|
|
925
957
|
* Update agentic loop report metadata for a conversation session.
|
|
926
958
|
* Upserts a report entry by reportId — updates existing or adds new.
|
|
@@ -996,6 +1028,10 @@ export declare class NeuroLink {
|
|
|
996
1028
|
timeout?: number;
|
|
997
1029
|
maxRetries?: number;
|
|
998
1030
|
retryDelayMs?: number;
|
|
1031
|
+
/** Disable tool result caching for this call */
|
|
1032
|
+
disableToolCache?: boolean;
|
|
1033
|
+
/** Bypass the request batcher for this call */
|
|
1034
|
+
bypassBatcher?: boolean;
|
|
999
1035
|
authContext?: {
|
|
1000
1036
|
userId?: string;
|
|
1001
1037
|
sessionId?: string;
|
|
@@ -1004,9 +1040,18 @@ export declare class NeuroLink {
|
|
|
1004
1040
|
};
|
|
1005
1041
|
}): Promise<T>;
|
|
1006
1042
|
/**
|
|
1007
|
-
* Internal tool execution method
|
|
1043
|
+
* Internal tool execution method with MCP enhancements wired in:
|
|
1044
|
+
* - ToolCache: check/store cached results for non-destructive tools
|
|
1045
|
+
* - ToolRouter: route to best server when same tool exists on multiple servers
|
|
1046
|
+
* - Annotations: skip cache for destructive tools, retry safe tools on failure
|
|
1047
|
+
* - Middleware: apply global middleware chain before execution
|
|
1008
1048
|
*/
|
|
1009
1049
|
private executeToolInternal;
|
|
1050
|
+
/**
|
|
1051
|
+
* Get tool annotations for execution decisions (cache, retry).
|
|
1052
|
+
* Checks cached tool list first, falls back to inference from tool name.
|
|
1053
|
+
*/
|
|
1054
|
+
private getToolAnnotationsForExecution;
|
|
1010
1055
|
/**
|
|
1011
1056
|
* Get all available tools including custom and in-memory ones
|
|
1012
1057
|
* @returns Array of available tools with metadata
|
|
@@ -1343,6 +1388,234 @@ export declare class NeuroLink {
|
|
|
1343
1388
|
* Called automatically on process exit
|
|
1344
1389
|
*/
|
|
1345
1390
|
shutdownExternalMCPServers(): Promise<void>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Get the global elicitation manager for interactive tool input
|
|
1393
|
+
* Elicitation allows tools to request additional information from users during execution
|
|
1394
|
+
* @returns The global ElicitationManager instance
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```typescript
|
|
1397
|
+
* const elicitationManager = neurolink.getElicitationManager();
|
|
1398
|
+
*
|
|
1399
|
+
* // Register a handler for confirmations
|
|
1400
|
+
* elicitationManager.registerHandler(async (request) => {
|
|
1401
|
+
* if (request.type === 'confirmation') {
|
|
1402
|
+
* const answer = await askUser(request.message);
|
|
1403
|
+
* return { confirmed: answer === 'yes' };
|
|
1404
|
+
* }
|
|
1405
|
+
* });
|
|
1406
|
+
* ```
|
|
1407
|
+
*/
|
|
1408
|
+
getElicitationManager(): Promise<any>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Register an elicitation handler for interactive tool input
|
|
1411
|
+
* Handlers are called when tools need user input during execution
|
|
1412
|
+
* @param handler - Function to handle elicitation requests
|
|
1413
|
+
* @example
|
|
1414
|
+
* ```typescript
|
|
1415
|
+
* neurolink.registerElicitationHandler(async (request) => {
|
|
1416
|
+
* switch (request.type) {
|
|
1417
|
+
* case 'confirmation':
|
|
1418
|
+
* return { confirmed: await confirmWithUser(request.message) };
|
|
1419
|
+
* case 'text':
|
|
1420
|
+
* return { value: await promptUser(request.message) };
|
|
1421
|
+
* case 'select':
|
|
1422
|
+
* return { value: await selectFromOptions(request.options) };
|
|
1423
|
+
* }
|
|
1424
|
+
* });
|
|
1425
|
+
* ```
|
|
1426
|
+
*/
|
|
1427
|
+
registerElicitationHandler(handler: (request: unknown) => Promise<unknown>): Promise<void>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Get the multi-server manager for load balancing and coordination
|
|
1430
|
+
* Allows managing multiple MCP servers with failover and load balancing
|
|
1431
|
+
* @returns The global MultiServerManager instance
|
|
1432
|
+
* @example
|
|
1433
|
+
* ```typescript
|
|
1434
|
+
* const multiServer = neurolink.getMultiServerManager();
|
|
1435
|
+
*
|
|
1436
|
+
* // Create a server group with load balancing
|
|
1437
|
+
* await multiServer.createServerGroup('ai-tools', {
|
|
1438
|
+
* servers: ['openai-server', 'anthropic-server'],
|
|
1439
|
+
* strategy: 'round-robin'
|
|
1440
|
+
* });
|
|
1441
|
+
* ```
|
|
1442
|
+
*/
|
|
1443
|
+
getMultiServerManager(): Promise<any>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Get the enhanced tool discovery service
|
|
1446
|
+
* Provides advanced search, filtering, and compatibility checking for tools
|
|
1447
|
+
* @returns EnhancedToolDiscovery instance
|
|
1448
|
+
* @example
|
|
1449
|
+
* ```typescript
|
|
1450
|
+
* const discovery = neurolink.getEnhancedToolDiscovery();
|
|
1451
|
+
*
|
|
1452
|
+
* // Search for tools by criteria
|
|
1453
|
+
* const results = await discovery.searchTools({
|
|
1454
|
+
* category: 'data-processing',
|
|
1455
|
+
* capabilities: ['streaming', 'batch'],
|
|
1456
|
+
* minReliability: 0.9
|
|
1457
|
+
* });
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
getEnhancedToolDiscovery(): Promise<any>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Get the MCP registry client for discovering servers from registries
|
|
1463
|
+
* Supports multiple registry sources (official, community, custom)
|
|
1464
|
+
* @returns The global MCPRegistryClient instance
|
|
1465
|
+
* @example
|
|
1466
|
+
* ```typescript
|
|
1467
|
+
* const registryClient = neurolink.getMCPRegistryClient();
|
|
1468
|
+
*
|
|
1469
|
+
* // Search for servers
|
|
1470
|
+
* const servers = await registryClient.searchServers({
|
|
1471
|
+
* query: 'database',
|
|
1472
|
+
* categories: ['data', 'storage']
|
|
1473
|
+
* });
|
|
1474
|
+
*
|
|
1475
|
+
* // Get a well-known server config
|
|
1476
|
+
* const githubServer = registryClient.getWellKnownServer('github');
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
getMCPRegistryClient(): Promise<any>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Expose a NeuroLink agent as an MCP tool
|
|
1482
|
+
* This allows agents to be called by other systems via MCP
|
|
1483
|
+
* @param agent - The agent to expose (must include id, name, description, and execute)
|
|
1484
|
+
* @param options - Exposure configuration options (prefix, defaultAnnotations, etc.)
|
|
1485
|
+
* @returns The exposed tool definition
|
|
1486
|
+
* @example
|
|
1487
|
+
* ```typescript
|
|
1488
|
+
* const agent = {
|
|
1489
|
+
* id: 'my-agent',
|
|
1490
|
+
* name: 'My Agent',
|
|
1491
|
+
* description: 'An agent that processes data',
|
|
1492
|
+
* execute: async (params) => { ... }
|
|
1493
|
+
* };
|
|
1494
|
+
* const tool = await neurolink.exposeAgentAsTool(agent, {
|
|
1495
|
+
* prefix: 'agent_'
|
|
1496
|
+
* });
|
|
1497
|
+
* ```
|
|
1498
|
+
*/
|
|
1499
|
+
exposeAgentAsTool(agent: {
|
|
1500
|
+
id: string;
|
|
1501
|
+
name: string;
|
|
1502
|
+
description: string;
|
|
1503
|
+
execute: (params: unknown, context?: unknown) => Promise<unknown>;
|
|
1504
|
+
}, options?: {
|
|
1505
|
+
prefix?: string;
|
|
1506
|
+
includeMetadataInDescription?: boolean;
|
|
1507
|
+
wrapWithContext?: boolean;
|
|
1508
|
+
executionTimeout?: number;
|
|
1509
|
+
enableLogging?: boolean;
|
|
1510
|
+
}): Promise<import("./index.js").ExposureResult>;
|
|
1511
|
+
/**
|
|
1512
|
+
* Expose a workflow as an MCP tool
|
|
1513
|
+
* This allows workflows to be called by other systems via MCP
|
|
1514
|
+
* @param workflow - The workflow to expose (must include id, name, description, and execute)
|
|
1515
|
+
* @param options - Exposure configuration options (prefix, defaultAnnotations, etc.)
|
|
1516
|
+
* @returns The exposed tool definition
|
|
1517
|
+
* @example
|
|
1518
|
+
* ```typescript
|
|
1519
|
+
* const workflow = {
|
|
1520
|
+
* id: 'data-pipeline',
|
|
1521
|
+
* name: 'Data Pipeline',
|
|
1522
|
+
* description: 'Runs the data processing pipeline',
|
|
1523
|
+
* execute: async (params) => { ... }
|
|
1524
|
+
* };
|
|
1525
|
+
* const tool = await neurolink.exposeWorkflowAsTool(workflow, {
|
|
1526
|
+
* prefix: 'workflow_'
|
|
1527
|
+
* });
|
|
1528
|
+
* ```
|
|
1529
|
+
*/
|
|
1530
|
+
exposeWorkflowAsTool(workflow: {
|
|
1531
|
+
id: string;
|
|
1532
|
+
name: string;
|
|
1533
|
+
description: string;
|
|
1534
|
+
execute: (params: unknown, context?: unknown) => Promise<unknown>;
|
|
1535
|
+
steps?: Array<{
|
|
1536
|
+
id: string;
|
|
1537
|
+
name: string;
|
|
1538
|
+
description?: string;
|
|
1539
|
+
}>;
|
|
1540
|
+
}, options?: {
|
|
1541
|
+
prefix?: string;
|
|
1542
|
+
includeMetadataInDescription?: boolean;
|
|
1543
|
+
wrapWithContext?: boolean;
|
|
1544
|
+
executionTimeout?: number;
|
|
1545
|
+
enableLogging?: boolean;
|
|
1546
|
+
}): Promise<import("./index.js").ExposureResult>;
|
|
1547
|
+
/**
|
|
1548
|
+
* Get the tool integration manager for middleware and elicitation
|
|
1549
|
+
* Provides advanced tool wrapping with confirmation, timeout, retry, etc.
|
|
1550
|
+
* @returns The global ToolIntegrationManager instance
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```typescript
|
|
1553
|
+
* const integration = neurolink.getToolIntegrationManager();
|
|
1554
|
+
*
|
|
1555
|
+
* // Register a tool with middleware
|
|
1556
|
+
* integration.registerTool(myTool, {
|
|
1557
|
+
* timeout: 30000,
|
|
1558
|
+
* retries: 3,
|
|
1559
|
+
* requireConfirmation: true
|
|
1560
|
+
* });
|
|
1561
|
+
* ```
|
|
1562
|
+
*/
|
|
1563
|
+
getToolIntegrationManager(): Promise<any>;
|
|
1564
|
+
/**
|
|
1565
|
+
* Convert NeuroLink tools to MCP format
|
|
1566
|
+
* Useful for exposing local tools to external MCP clients
|
|
1567
|
+
* @param tools - Array of NeuroLink tool definitions
|
|
1568
|
+
* @param options - Conversion options
|
|
1569
|
+
* @returns Array of MCP-formatted tools
|
|
1570
|
+
* @example
|
|
1571
|
+
* ```typescript
|
|
1572
|
+
* const mcpTools = neurolink.convertToolsToMCPFormat([
|
|
1573
|
+
* { name: 'myTool', description: 'Does something', execute: async () => {} }
|
|
1574
|
+
* ]);
|
|
1575
|
+
* ```
|
|
1576
|
+
*/
|
|
1577
|
+
convertToolsToMCPFormat(tools: Array<{
|
|
1578
|
+
name: string;
|
|
1579
|
+
description: string;
|
|
1580
|
+
execute?: (params: unknown) => unknown;
|
|
1581
|
+
}>, options?: {
|
|
1582
|
+
namespacePrefix?: string;
|
|
1583
|
+
}): Promise<any>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Convert MCP tools to NeuroLink format
|
|
1586
|
+
* Useful for importing tools from external MCP servers
|
|
1587
|
+
* @param tools - Array of MCP tool definitions
|
|
1588
|
+
* @param options - Conversion options
|
|
1589
|
+
* @returns Array of NeuroLink-formatted tools
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```typescript
|
|
1592
|
+
* const neurolinkTools = neurolink.convertToolsFromMCPFormat(externalTools, {
|
|
1593
|
+
* removeNamespacePrefix: 'external_'
|
|
1594
|
+
* });
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
convertToolsFromMCPFormat(tools: Array<{
|
|
1598
|
+
name: string;
|
|
1599
|
+
description: string;
|
|
1600
|
+
inputSchema?: unknown;
|
|
1601
|
+
}>, options?: {
|
|
1602
|
+
removeNamespacePrefix?: string;
|
|
1603
|
+
}): Promise<any>;
|
|
1604
|
+
/**
|
|
1605
|
+
* Get tool annotations and safety information
|
|
1606
|
+
* Provides insights about tool behavior, safety levels, and retry-ability
|
|
1607
|
+
* @param toolName - Name of the tool to analyze
|
|
1608
|
+
* @returns Tool annotation summary
|
|
1609
|
+
* @example
|
|
1610
|
+
* ```typescript
|
|
1611
|
+
* const annotations = await neurolink.getToolAnnotations('deleteFile');
|
|
1612
|
+
* // Returns: { destructive: true, requiresConfirmation: true, safeToRetry: false }
|
|
1613
|
+
* ```
|
|
1614
|
+
*/
|
|
1615
|
+
getToolAnnotations(toolName: string): Promise<{
|
|
1616
|
+
annotations: MCPToolAnnotations;
|
|
1617
|
+
summary: string;
|
|
1618
|
+
} | null>;
|
|
1346
1619
|
/**
|
|
1347
1620
|
* Convert external MCP tools to Vercel AI SDK tool format
|
|
1348
1621
|
* This allows AI providers to use external tools directly
|