UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

93 lines (92 loc) 3.12 kB
/** * Tool Integration with Elicitation Context * * Provides integration between MCP tools and the elicitation protocol, * enabling tools to request interactive user input during execution. * * @module mcp/toolIntegration * @since 8.39.0 */ import type { NeuroLinkExecutionContext, MCPServerTool, ToolResult, ToolMiddleware, ToolWrapperOptions, ElicitationContext, ElicitationHandler } from "../types/index.js"; import { ElicitationManager } from "./elicitation/elicitationManager.js"; /** * Create elicitation context for a tool */ export declare function createElicitationContext(toolName: string, serverId: string | undefined, manager: ElicitationManager): ElicitationContext; /** * Wrap a tool with elicitation support */ export declare function wrapToolWithElicitation(tool: MCPServerTool, options?: ToolWrapperOptions): MCPServerTool; /** * Batch wrap tools with elicitation support */ export declare function wrapToolsWithElicitation(tools: MCPServerTool[], options?: ToolWrapperOptions): MCPServerTool[]; /** * Create a middleware chain for tool execution */ export declare function createToolMiddlewareChain(middlewares: ToolMiddleware[]): ToolMiddleware; /** * Built-in middleware: Logging */ export declare const loggingMiddleware: ToolMiddleware; /** * Built-in middleware: Confirmation for destructive operations */ export declare const confirmationMiddleware: ToolMiddleware; /** * Built-in middleware: Timeout */ export declare function createTimeoutMiddleware(timeoutMs: number): ToolMiddleware; /** * Built-in middleware: Retry */ export declare function createRetryMiddleware(maxRetries: number, delayMs?: number): ToolMiddleware; /** * Built-in middleware: Parameter validation */ export declare const validationMiddleware: ToolMiddleware; /** * Tool Integration Manager * * Manages tool execution with middleware and elicitation support. */ export declare class ToolIntegrationManager { private elicitationManager; private middlewares; private wrappedTools; constructor(elicitationManager?: ElicitationManager); /** * Set the elicitation handler */ setElicitationHandler(handler: ElicitationHandler): void; /** * Add middleware */ use(middleware: ToolMiddleware): this; /** * Register a tool with integration */ registerTool(tool: MCPServerTool): MCPServerTool; /** * Execute a tool with full middleware chain */ executeTool(toolName: string, params: unknown, context?: NeuroLinkExecutionContext): Promise<ToolResult | unknown>; /** * Get registered tool */ getTool(name: string): MCPServerTool | undefined; /** * Get all registered tools */ getAllTools(): MCPServerTool[]; /** * Get the elicitation manager */ getElicitationManager(): ElicitationManager; } /** * Module-level singleton ToolIntegrationManager. * Note: The default ElicitationManager has no handler set. Consumers must call * setElicitationHandler() before using elicitation methods. */ export declare const globalToolIntegrationManager: ToolIntegrationManager;