summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
diff options
context:
space:
mode:
authorN. Taylor Mullen <[email protected]>2025-06-23 22:35:23 +0100
committerGitHub <[email protected]>2025-06-23 21:35:23 +0000
commitfd58d3267ed50d25bb068678376dddf86aa007d8 (patch)
tree6578f501229f4c6918c590b6e6148d0c2b795583 /packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
parentdc76bcc433d58d879f8850ac777d2cd239dad611 (diff)
feat: Open MCP docs if no MCPs are configured (#1325)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.test.ts33
1 files changed, 31 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
index 31105509..d411a2da 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
@@ -754,7 +754,8 @@ Add any other context about the problem here.
expect(commandResult).toBe(true);
});
- it('should display a message when no MCP servers are configured', async () => {
+ it('should display a message with a URL when no MCP servers are configured in a sandbox', async () => {
+ process.env.SANDBOX = 'sandbox';
mockConfig = {
...mockConfig,
getToolRegistry: vi.fn().mockResolvedValue({
@@ -773,11 +774,39 @@ Add any other context about the problem here.
2,
expect.objectContaining({
type: MessageType.INFO,
- text: 'No MCP servers configured.',
+ text: `No MCP servers configured. Please open the following URL in your browser to view documentation:\nhttps://goo.gle/gemini-cli-docs-mcp`,
}),
expect.any(Number),
);
expect(commandResult).toBe(true);
+ delete process.env.SANDBOX;
+ });
+
+ it('should display a message and open a URL when no MCP servers are configured outside a sandbox', async () => {
+ mockConfig = {
+ ...mockConfig,
+ getToolRegistry: vi.fn().mockResolvedValue({
+ getToolsByServer: vi.fn().mockReturnValue([]),
+ }),
+ getMcpServers: vi.fn().mockReturnValue({}),
+ } as unknown as Config;
+
+ const { handleSlashCommand } = getProcessor();
+ let commandResult: SlashCommandActionReturn | boolean = false;
+ await act(async () => {
+ commandResult = await handleSlashCommand('/mcp');
+ });
+
+ expect(mockAddItem).toHaveBeenNthCalledWith(
+ 2,
+ expect.objectContaining({
+ type: MessageType.INFO,
+ text: 'No MCP servers configured. Opening documentation in your browser: https://goo.gle/gemini-cli-docs-mcp',
+ }),
+ expect.any(Number),
+ );
+ expect(open).toHaveBeenCalledWith('https://goo.gle/gemini-cli-docs-mcp');
+ expect(commandResult).toBe(true);
});
it('should display configured MCP servers with status indicators and their tools', async () => {