diff options
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/slashCommandProcessor.ts | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 6159fe89..fa1e4016 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -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) { |
