MCPConnectionService

Implements IMCP

Service class for managing MCP (Model Context Protocol) connections and operations. Implements the IMCP interface to handle tool listing, checking, calling, and disposal.

constructor();
loggerService: any

Injected LoggerService for logging operations.

busService: any

Injected BusService for communication or event handling.

methodContextService: any

Injected MethodContextService for accessing method context information.

mcpSchemaService: any

Injected MCPSchemaService for managing MCP schemas.

getMCP: ((mcpName: string) => ClientMCP) & IClearableMemoize<string> & IControlMemoize<string, ClientMCP>

Memoized function to retrieve or create an MCP instance for a given MCP name.

dispose: (clientId: string) => Promise<void>

Disposes of resources associated with a client, clearing cached MCP instances.

listTools(clientId: string): Promise<IMCPTool[]>;

Lists available tools for a given client.

updateToolsForAll(): Promise<void>;

Updates the list of tools for all clients.

updateToolsForClient(clientId: string): Promise<void>;

Updates the list of tools for a specific client.

hasTool(toolName: string, clientId: string): Promise<boolean>;

Checks if a specific tool exists for a given client.

callTool<T extends MCPToolValue = MCPToolValue>(toolName: string, dto: IMCPToolCallDto<T>): Promise<MCPToolOutput>;

Calls a specific tool with the provided parameters.