mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
addressed b/423798481 (#887)
This commit is contained in:
@@ -9,7 +9,13 @@ import { type PartListUnion } from '@google/genai';
|
||||
import open from 'open';
|
||||
import process from 'node:process';
|
||||
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
import { Config, MCPServerStatus, getMCPServerStatus } from '@gemini-cli/core';
|
||||
import {
|
||||
Config,
|
||||
MCPServerStatus,
|
||||
getMCPServerStatus,
|
||||
getMCPDiscoveryState,
|
||||
MCPDiscoveryState,
|
||||
} from '@gemini-cli/core';
|
||||
import { Message, MessageType, HistoryItemWithoutId } from '../types.js';
|
||||
import { useSessionStats } from '../contexts/SessionContext.js';
|
||||
import { createShowMemoryAction } from './useShowMemoryCommand.js';
|
||||
@@ -226,32 +232,62 @@ export const useSlashCommandProcessor = (
|
||||
return;
|
||||
}
|
||||
|
||||
let message = 'Configured MCP servers and tools:\n\n';
|
||||
// Check if any servers are still connecting
|
||||
const connectingServers = serverNames.filter(
|
||||
(name) => getMCPServerStatus(name) === MCPServerStatus.CONNECTING,
|
||||
);
|
||||
const discoveryState = getMCPDiscoveryState();
|
||||
|
||||
let message = '';
|
||||
|
||||
// Add overall discovery status message if needed
|
||||
if (
|
||||
discoveryState === MCPDiscoveryState.IN_PROGRESS ||
|
||||
connectingServers.length > 0
|
||||
) {
|
||||
message += `\u001b[33m⏳ MCP servers are starting up (${connectingServers.length} initializing)...\u001b[0m\n`;
|
||||
message += `\u001b[90mNote: First startup may take longer. Tool availability will update automatically.\u001b[0m\n\n`;
|
||||
}
|
||||
|
||||
message += 'Configured MCP servers:\n\n';
|
||||
|
||||
for (const serverName of serverNames) {
|
||||
const serverTools = toolRegistry.getToolsByServer(serverName);
|
||||
const status = getMCPServerStatus(serverName);
|
||||
|
||||
// Add status indicator
|
||||
let statusDot = '';
|
||||
// Add status indicator with descriptive text
|
||||
let statusIndicator = '';
|
||||
let statusText = '';
|
||||
switch (status) {
|
||||
case MCPServerStatus.CONNECTED:
|
||||
statusDot = '🟢'; // Green dot for connected
|
||||
statusIndicator = '🟢';
|
||||
statusText = 'Ready';
|
||||
break;
|
||||
case MCPServerStatus.CONNECTING:
|
||||
statusDot = '🟡'; // Yellow dot for connecting
|
||||
statusIndicator = '🔄';
|
||||
statusText = 'Starting... (first startup may take longer)';
|
||||
break;
|
||||
case MCPServerStatus.DISCONNECTED:
|
||||
default:
|
||||
statusDot = '🔴'; // Red dot for disconnected
|
||||
statusIndicator = '🔴';
|
||||
statusText = 'Disconnected';
|
||||
break;
|
||||
}
|
||||
|
||||
// Get server description if available
|
||||
const server = mcpServers[serverName];
|
||||
|
||||
// Format server header with bold formatting
|
||||
message += `${statusDot} \u001b[1m${serverName}\u001b[0m (${serverTools.length} tools)`;
|
||||
// Format server header with bold formatting and status
|
||||
message += `${statusIndicator} \u001b[1m${serverName}\u001b[0m - ${statusText}`;
|
||||
|
||||
// Add tool count with conditional messaging
|
||||
if (status === MCPServerStatus.CONNECTED) {
|
||||
message += ` (${serverTools.length} tools)`;
|
||||
} else if (status === MCPServerStatus.CONNECTING) {
|
||||
message += ` (tools will appear when ready)`;
|
||||
} else {
|
||||
message += ` (${serverTools.length} tools cached)`;
|
||||
}
|
||||
|
||||
// Add server description with proper handling of multi-line descriptions
|
||||
if (useShowDescriptions && server?.description) {
|
||||
|
||||
Reference in New Issue
Block a user