mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
Add support for MCP server instructions behind config option (#13432)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -934,4 +934,43 @@ included directory memory
|
||||
expect(config.getGeminiMdFilePaths()).equals(refreshResult.filePaths);
|
||||
expect(mockEventListener).toHaveBeenCalledExactlyOnceWith(refreshResult);
|
||||
});
|
||||
|
||||
it('should include MCP instructions in user memory', async () => {
|
||||
const mockConfig = {
|
||||
getWorkingDir: vi.fn().mockReturnValue(cwd),
|
||||
shouldLoadMemoryFromIncludeDirectories: vi.fn().mockReturnValue(false),
|
||||
getDebugMode: vi.fn().mockReturnValue(false),
|
||||
getFileService: vi
|
||||
.fn()
|
||||
.mockReturnValue(new FileDiscoveryService(projectRoot)),
|
||||
getExtensionLoader: vi
|
||||
.fn()
|
||||
.mockReturnValue(new SimpleExtensionLoader([])),
|
||||
isTrustedFolder: vi.fn().mockReturnValue(true),
|
||||
getImportFormat: vi.fn().mockReturnValue('tree'),
|
||||
getFileFilteringOptions: vi.fn().mockReturnValue(undefined),
|
||||
getDiscoveryMaxDirs: vi.fn().mockReturnValue(200),
|
||||
setUserMemory: vi.fn(),
|
||||
setGeminiMdFileCount: vi.fn(),
|
||||
setGeminiMdFilePaths: vi.fn(),
|
||||
getMcpClientManager: vi.fn().mockReturnValue({
|
||||
getMcpInstructions: vi
|
||||
.fn()
|
||||
.mockReturnValue(
|
||||
"\n\n# Instructions for MCP Server 'extension-server'\nAlways be polite.",
|
||||
),
|
||||
}),
|
||||
} as unknown as Config;
|
||||
|
||||
await refreshServerHierarchicalMemory(mockConfig);
|
||||
|
||||
expect(mockConfig.setUserMemory).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
"# Instructions for MCP Server 'extension-server'",
|
||||
),
|
||||
);
|
||||
expect(mockConfig.setUserMemory).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Always be polite.'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user