refactor: remove read-many-files tool from agent (#12796)

This commit is contained in:
Abhi
2025-11-12 21:56:37 -05:00
committed by GitHub
parent a05e0ea3a4
commit 5d27a62bec
9 changed files with 5 additions and 194 deletions
-35
View File
@@ -34,7 +34,6 @@ import { logRipgrepFallback } from '../telemetry/loggers.js';
import { RipgrepFallbackEvent } from '../telemetry/types.js';
import { ToolRegistry } from '../tools/tool-registry.js';
import { DEFAULT_MODEL_CONFIGS } from './defaultModelConfigs.js';
import { READ_MANY_FILES_TOOL_NAME } from '../tools/tool-names.js';
vi.mock('fs', async (importOriginal) => {
const actual = await importOriginal<typeof import('fs')>();
@@ -1041,40 +1040,6 @@ describe('Server Config (config.ts)', () => {
expect(mockCoreEvents.emitFeedback).not.toHaveBeenCalled();
});
});
describe('checkDeprecatedTools', () => {
it('should emit a warning when a deprecated tool is in coreTools', async () => {
const params: ConfigParameters = {
...baseParams,
coreTools: [READ_MANY_FILES_TOOL_NAME],
};
const config = new Config(params);
await config.initialize();
expect(mockCoreEvents.emitFeedback).toHaveBeenCalledWith(
'warning',
expect.stringContaining(
`The tool '${READ_MANY_FILES_TOOL_NAME}' (or 'ReadManyFilesTool') specified in 'tools.core' is deprecated`,
),
);
});
it('should emit a warning when a deprecated tool is in allowedTools', async () => {
const params: ConfigParameters = {
...baseParams,
allowedTools: ['ReadManyFilesTool'],
};
const config = new Config(params);
await config.initialize();
expect(mockCoreEvents.emitFeedback).toHaveBeenCalledWith(
'warning',
expect.stringContaining(
`The tool '${READ_MANY_FILES_TOOL_NAME}' (or 'ReadManyFilesTool') specified in 'tools.allowed' is deprecated`,
),
);
});
});
});
describe('setApprovalMode with folder trust', () => {
-29
View File
@@ -28,7 +28,6 @@ import { SmartEditTool } from '../tools/smart-edit.js';
import { ShellTool } from '../tools/shell.js';
import { WriteFileTool } from '../tools/write-file.js';
import { WebFetchTool } from '../tools/web-fetch.js';
import { ReadManyFilesTool } from '../tools/read-many-files.js';
import { MemoryTool, setGeminiMdFilename } from '../tools/memoryTool.js';
import { WebSearchTool } from '../tools/web-search.js';
import { GeminiClient } from '../core/client.js';
@@ -164,7 +163,6 @@ import {
SimpleExtensionLoader,
} from '../utils/extensionLoader.js';
import { McpClientManager } from '../tools/mcp-client-manager.js';
import { READ_MANY_FILES_TOOL_NAME } from '../tools/tool-names.js';
export type { FileFilteringOptions };
export {
@@ -632,32 +630,6 @@ export class Config {
]);
await this.geminiClient.initialize();
this.checkDeprecatedTools();
}
private checkDeprecatedTools(): void {
const deprecatedTools = [
{
name: READ_MANY_FILES_TOOL_NAME,
alternateName: 'ReadManyFilesTool',
},
];
const checkList = (list: string[] | undefined, listName: string) => {
if (!list) return;
for (const tool of deprecatedTools) {
if (list.includes(tool.name) || list.includes(tool.alternateName)) {
coreEvents.emitFeedback(
'warning',
`The tool '${tool.name}' (or '${tool.alternateName}') specified in '${listName}' is deprecated and will be removed in v0.16.0.`,
);
}
}
};
checkList(this.coreTools, 'tools.core');
checkList(this.allowedTools, 'tools.allowed');
}
getContentGenerator(): ContentGenerator {
@@ -1396,7 +1368,6 @@ export class Config {
}
registerCoreTool(WriteFileTool, this);
registerCoreTool(WebFetchTool, this);
registerCoreTool(ReadManyFilesTool, this);
registerCoreTool(ShellTool, this);
registerCoreTool(MemoryTool);
registerCoreTool(WebSearchTool, this);