summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/commands/mcpCommand.test.ts
diff options
context:
space:
mode:
authorchristine betts <[email protected]>2025-07-25 20:56:33 +0000
committerGitHub <[email protected]>2025-07-25 20:56:33 +0000
commiteb65034117f7722554a717de034e891ba1996e93 (patch)
treef279bee5ca55b0e447eabc70a11e96de307d76f3 /packages/cli/src/ui/commands/mcpCommand.test.ts
parentde968877895a8ae5f0edb83a43b37fa190cc8ec9 (diff)
Load and use MCP server prompts as slash commands in the CLI (#4828)
Co-authored-by: harold <[email protected]> Co-authored-by: N. Taylor Mullen <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/commands/mcpCommand.test.ts')
-rw-r--r--packages/cli/src/ui/commands/mcpCommand.test.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/cli/src/ui/commands/mcpCommand.test.ts b/packages/cli/src/ui/commands/mcpCommand.test.ts
index 2b8753a0..afa71ba5 100644
--- a/packages/cli/src/ui/commands/mcpCommand.test.ts
+++ b/packages/cli/src/ui/commands/mcpCommand.test.ts
@@ -71,6 +71,7 @@ describe('mcpCommand', () => {
getToolRegistry: ReturnType<typeof vi.fn>;
getMcpServers: ReturnType<typeof vi.fn>;
getBlockedMcpServers: ReturnType<typeof vi.fn>;
+ getPromptRegistry: ReturnType<typeof vi.fn>;
};
beforeEach(() => {
@@ -92,6 +93,10 @@ describe('mcpCommand', () => {
}),
getMcpServers: vi.fn().mockReturnValue({}),
getBlockedMcpServers: vi.fn().mockReturnValue([]),
+ getPromptRegistry: vi.fn().mockResolvedValue({
+ getAllPrompts: vi.fn().mockReturnValue([]),
+ getPromptsByServer: vi.fn().mockReturnValue([]),
+ }),
};
mockContext = createMockCommandContext({
@@ -223,7 +228,7 @@ describe('mcpCommand', () => {
// Server 2 - Connected
expect(message).toContain(
- '🟢 \u001b[1mserver2\u001b[0m - Ready (1 tools)',
+ '🟢 \u001b[1mserver2\u001b[0m - Ready (1 tool)',
);
expect(message).toContain('server2_tool1');
@@ -365,13 +370,13 @@ describe('mcpCommand', () => {
if (isMessageAction(result)) {
const message = result.content;
expect(message).toContain(
- '🟢 \u001b[1mserver1\u001b[0m - Ready (1 tools)',
+ '🟢 \u001b[1mserver1\u001b[0m - Ready (1 tool)',
);
expect(message).toContain('\u001b[36mserver1_tool1\u001b[0m');
expect(message).toContain(
'🔴 \u001b[1mserver2\u001b[0m - Disconnected (0 tools cached)',
);
- expect(message).toContain('No tools available');
+ expect(message).toContain('No tools or prompts available');
}
});
@@ -421,10 +426,10 @@ describe('mcpCommand', () => {
// Check server statuses
expect(message).toContain(
- '🟢 \u001b[1mserver1\u001b[0m - Ready (1 tools)',
+ '🟢 \u001b[1mserver1\u001b[0m - Ready (1 tool)',
);
expect(message).toContain(
- '🔄 \u001b[1mserver2\u001b[0m - Starting... (first startup may take longer) (tools will appear when ready)',
+ '🔄 \u001b[1mserver2\u001b[0m - Starting... (first startup may take longer) (tools and prompts will appear when ready)',
);
}
});
@@ -994,6 +999,9 @@ describe('mcpCommand', () => {
getBlockedMcpServers: vi.fn().mockReturnValue([]),
getToolRegistry: vi.fn().mockResolvedValue(mockToolRegistry),
getGeminiClient: vi.fn().mockReturnValue(mockGeminiClient),
+ getPromptRegistry: vi.fn().mockResolvedValue({
+ getPromptsByServer: vi.fn().mockReturnValue([]),
+ }),
},
},
});