@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
130 lines (129 loc) • 3.63 kB
TypeScript
/**
* MCP Tool Registry - Extended Registry with Tool Management
* Updated to match industry standard camelCase interfaces
*/
import type { ExecutionContext, ToolInfo } from "./contracts/mcpContract.js";
import type { ToolResult } from "./factory.js";
import { MCPRegistry } from "./registry.js";
interface ToolImplementation {
execute: (params: unknown, context?: ExecutionContext) => Promise<unknown> | unknown;
description?: string;
inputSchema?: unknown;
outputSchema?: unknown;
category?: string;
permissions?: string[];
}
interface ServerRegistration {
id?: string;
serverId?: string;
description?: string;
title?: string;
category?: string;
tools?: Record<string, ToolImplementation>;
configuration?: Record<string, unknown>;
}
export type ToolExecutionResult = ToolResult;
/**
* Tool execution options
*/
export interface ToolExecutionOptions {
timeout?: number;
retries?: number;
context?: ExecutionContext;
preferredSource?: string;
fallbackEnabled?: boolean;
validateBeforeExecution?: boolean;
timeoutMs?: number;
}
export declare class MCPToolRegistry extends MCPRegistry {
private tools;
private toolImpls;
private toolExecutionStats;
constructor();
/**
* Register all direct tools from directAgentTools
*/
private registerDirectTools;
/**
* Register a server with its tools (updated signature)
*/
registerServer(serverOrId: string | ServerRegistration, serverConfig?: unknown, context?: ExecutionContext): Promise<void>;
/**
* Execute a tool with enhanced context
*/
executeTool<T = unknown>(toolName: string, args?: unknown, context?: ExecutionContext): Promise<T>;
/**
* List all available tools (updated signature with filtering)
*/
listTools(): Promise<ToolInfo[]>;
listTools(context: ExecutionContext): Promise<ToolInfo[]>;
listTools(filter: {
category?: string;
serverId?: string;
serverCategory?: string;
permissions?: string[];
context?: ExecutionContext;
}): Promise<ToolInfo[]>;
/**
* Get tool information with server details
*/
getToolInfo(toolName: string): {
tool: ToolInfo;
server: {
id: string;
};
} | undefined;
/**
* Update execution statistics
*/
private updateStats;
/**
* Get execution statistics
*/
getExecutionStats(): Record<string, {
count: number;
averageTime: number;
totalTime: number;
}>;
/**
* Clear execution statistics
*/
clearStats(): void;
/**
* Get tools by category
*/
getToolsByCategory(category: string): ToolInfo[];
/**
* Check if tool exists
*/
hasTool(toolName: string): boolean;
/**
* Remove a tool
*/
removeTool(toolName: string): boolean;
/**
* Get tool count
*/
getToolCount(): number;
/**
* Get comprehensive statistics
*/
getStats(): {
totalServers: number;
totalTools: number;
serversByCategory: Record<string, number>;
toolsByCategory: Record<string, number>;
executionStats: Record<string, {
count: number;
averageTime: number;
totalTime: number;
}>;
};
/**
* Unregister a server
*/
unregisterServer(serverId: string): boolean;
}
export declare const toolRegistry: MCPToolRegistry;
export declare const defaultToolRegistry: MCPToolRegistry;
export type { ToolInfo } from "./contracts/mcpContract.js";