diff --git a/core/config/load.ts b/core/config/load.ts index 3504cd8d5..a084bbd38 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -62,7 +62,7 @@ import { } from "../util/paths"; import { localPathToUri } from "../util/pathToUri"; -import { baseToolDefinitions } from "../tools"; +import { getToolsForIde } from "../tools"; import { resolveRelativePathInDir } from "../util/ideUtils"; import { modifyAnyConfigWithSharedConfig } from "./sharedConfig"; import { @@ -525,7 +525,7 @@ async function intermediateToFinalConfig({ const continueConfig: ContinueConfig = { ...config, contextProviders, - tools: [...baseToolDefinitions], + tools: await getToolsForIde(ide), mcpServerStatuses: [], slashCommands: [], modelsByRole: { diff --git a/core/tools/index.ts b/core/tools/index.ts index 5817e24db..1d5f7527f 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -17,10 +17,12 @@ import { viewDiffTool } from "./definitions/viewDiff"; import { viewRepoMapTool } from "./definitions/viewRepoMap"; import { viewSubdirectoryTool } from "./definitions/viewSubdirectory"; -// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269 -export const localOnlyToolDefinitions = [grepSearchTool]; +// I'm writing these as functions because we've messed up 3 TIMES by pushing to const, causing duplicate tool definitions on subsequent config loads. -export const baseToolDefinitions = [ +// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269 +const getLocalOnlyToolDefinitions = () => [grepSearchTool]; + +const getBaseToolDefinitions = () => [ readFileTool, createNewFileTool, runTerminalCommandTool, @@ -49,5 +51,5 @@ export const getConfigDependentToolDefinitions = ( export const getToolsForIde = async (ide: IDE) => (await ide.isWorkspaceRemote()) - ? [...baseToolDefinitions] - : [...baseToolDefinitions, ...localOnlyToolDefinitions]; + ? getBaseToolDefinitions() + : [...getBaseToolDefinitions(), ...getLocalOnlyToolDefinitions()];