mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
🪶 chore: Aggregate Empty MCP Tool Logs (#14767)
* fix: aggregate empty MCP tool logs * fix: retain server names in MCP tool logs
This commit is contained in:
parent
861cfe8a3c
commit
dccef82254
2 changed files with 11 additions and 1 deletions
|
|
@ -197,6 +197,7 @@ const getMCPTools = async (req, res) => {
|
|||
const mcpServers = {};
|
||||
|
||||
const serverToolsMap = new Map();
|
||||
const serversWithoutTools = [];
|
||||
const cacheResults = await Promise.all(
|
||||
configuredServers.map(async (serverName) => {
|
||||
try {
|
||||
|
|
@ -230,7 +231,7 @@ const getMCPTools = async (req, res) => {
|
|||
continue;
|
||||
}
|
||||
if (!serverTools) {
|
||||
logger.debug(`[getMCPTools] No tools found for server ${serverName}`);
|
||||
serversWithoutTools.push(serverName);
|
||||
continue;
|
||||
}
|
||||
serverToolsMap.set(serverName, serverTools);
|
||||
|
|
@ -246,6 +247,11 @@ const getMCPTools = async (req, res) => {
|
|||
logger.error(`[getMCPTools] Failed to cache tools for ${serverName}:`, err),
|
||||
);
|
||||
}
|
||||
if (serversWithoutTools.length > 0) {
|
||||
logger.debug(
|
||||
`[getMCPTools] No tools (${serversWithoutTools.length}): ${serversWithoutTools.join(', ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Process each configured server
|
||||
for (const serverName of configuredServers) {
|
||||
|
|
|
|||
|
|
@ -3316,6 +3316,10 @@ describe('MCP Routes', () => {
|
|||
name: 'second-server',
|
||||
tools: [],
|
||||
});
|
||||
expect(logger.debug).toHaveBeenCalledTimes(1);
|
||||
expect(logger.debug).toHaveBeenCalledWith(
|
||||
'[getMCPTools] No tools (2): first-server, second-server',
|
||||
);
|
||||
expect(logger.error).toHaveBeenCalledTimes(2);
|
||||
expect(mockGetServerToolFunctionsSnapshot).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue