🐛 fix: Error Handling in MCP Tool List Controller (#10570)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run

* 🔧 fix: Handle errors when fetching server tools and log missing tools in MCP tools controller, to prevent all MCP tools from not getting listed

* 🔧 fix: Remove trailing colons from error messages in MCPConnection class

* chore: Update test command patterns in package.json for cache integration tests
This commit is contained in:
Danny Avila 2025-11-18 18:28:57 -05:00 committed by GitHub
parent 4a13867a47
commit ce1812b7c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View file

@ -44,7 +44,13 @@ const getMCPTools = async (req, res) => {
continue;
}
const serverTools = await mcpManager.getServerToolFunctions(userId, serverName);
let serverTools;
try {
serverTools = await mcpManager.getServerToolFunctions(userId, serverName);
} catch (error) {
logger.error(`[getMCPTools] Error fetching tools for server ${serverName}:`, error);
continue;
}
if (!serverTools) {
logger.debug(`[getMCPTools] No tools found for server ${serverName}`);
continue;

View file

@ -16,6 +16,11 @@ async function updateMCPServerTools({ userId, serverName, tools }) {
const serverTools = {};
const mcpDelimiter = Constants.mcp_delimiter;
if (tools == null || tools.length === 0) {
logger.debug(`[MCP Cache] No tools to update for server ${serverName} (user: ${userId})`);
return serverTools;
}
for (const tool of tools) {
const name = `${tool.name}${mcpDelimiter}${serverName}`;
serverTools[name] = {