Add support for running available commands prior to MCP servers loading (#15596)

This commit is contained in:
Adib234
2026-01-15 15:33:16 -05:00
committed by GitHub
parent 8a627d6c9a
commit 1e8f87fbdf
7 changed files with 230 additions and 8 deletions
@@ -30,6 +30,7 @@ import {
ToolErrorType,
coreEvents,
CoreEvent,
MCPDiscoveryState,
} from '@google/gemini-cli-core';
import type {
Config,
@@ -951,6 +952,26 @@ export const useGeminiStream = (
{ name: 'submitQuery' },
async ({ metadata: spanMetadata }) => {
spanMetadata.input = query;
const discoveryState = config
.getMcpClientManager()
?.getDiscoveryState();
const mcpServerCount =
config.getMcpClientManager()?.getMcpServerCount() ?? 0;
if (
!options?.isContinuation &&
typeof query === 'string' &&
!isSlashCommand(query.trim()) &&
mcpServerCount > 0 &&
discoveryState !== MCPDiscoveryState.COMPLETED
) {
coreEvents.emitFeedback(
'info',
'Waiting for MCP servers to initialize... Slash commands are still available.',
);
return;
}
const queryId = `${Date.now()}-${Math.random()}`;
activeQueryIdRef.current = queryId;
if (