refactor: Update convertMCPToolsToPlugins to use mcpManager for server configuration and adjust related tests

This commit is contained in:
Danny Avila 2025-08-17 20:05:48 -04:00
parent b2b2aee945
commit e7af3bdaed
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
4 changed files with 110 additions and 66 deletions

View file

@ -106,7 +106,9 @@ const getAvailableTools = async (req, res) => {
const cache = getLogStores(CacheKeys.CONFIG_STORE);
const cachedToolsArray = await cache.get(CacheKeys.TOOLS);
const cachedUserTools = await getCachedTools({ userId });
const userPlugins = convertMCPToolsToPlugins({ functionTools: cachedUserTools, customConfig });
const mcpManager = getMCPManager();
const userPlugins = convertMCPToolsToPlugins({ functionTools: cachedUserTools, mcpManager });
if (cachedToolsArray != null && userPlugins != null) {
const dedupedTools = filterUniquePlugins([...userPlugins, ...cachedToolsArray]);
@ -117,7 +119,6 @@ const getAvailableTools = async (req, res) => {
let pluginManifest = availableTools;
if (customConfig?.mcpServers != null) {
try {
const mcpManager = getMCPManager();
const flowsCache = getLogStores(CacheKeys.FLOWS);
const flowManager = flowsCache ? getFlowStateManager(flowsCache) : null;
const serverToolsCallback = createServerToolsCallback();