diff --git a/src/core/prompts/tools/filter-tools-for-mode.ts b/src/core/prompts/tools/filter-tools-for-mode.ts index 3eec44c643f..eb87c9bbeca 100644 --- a/src/core/prompts/tools/filter-tools-for-mode.ts +++ b/src/core/prompts/tools/filter-tools-for-mode.ts @@ -153,6 +153,11 @@ export function filterNativeToolsForMode( allowedToolNames.delete("browser_action") } + // Conditionally exclude apply_diff if diffs are disabled + if (settings?.diffEnabled === false) { + allowedToolNames.delete("apply_diff") + } + // Conditionally exclude access_mcp_resource if MCP is not enabled or there are no resources if (!mcpHub || !hasAnyMcpResources(mcpHub)) { allowedToolNames.delete("access_mcp_resource") diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index d084bf4b924..2abf1a549db 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -3659,6 +3659,7 @@ export class Task extends EventEmitter implements TaskLike { maxReadFileLine: state?.maxReadFileLine ?? -1, browserToolEnabled: state?.browserToolEnabled ?? true, modelInfo, + diffEnabled: this.diffEnabled, }) } diff --git a/src/core/task/build-tools.ts b/src/core/task/build-tools.ts index 4586e4b546b..575b31580e6 100644 --- a/src/core/task/build-tools.ts +++ b/src/core/task/build-tools.ts @@ -14,6 +14,7 @@ interface BuildToolsOptions { maxReadFileLine: number browserToolEnabled: boolean modelInfo?: ModelInfo + diffEnabled: boolean } /** @@ -34,6 +35,7 @@ export async function buildNativeToolsArray(options: BuildToolsOptions): Promise maxReadFileLine, browserToolEnabled, modelInfo, + diffEnabled, } = options const mcpHub = provider.getMcpHub() @@ -47,6 +49,7 @@ export async function buildNativeToolsArray(options: BuildToolsOptions): Promise todoListEnabled: apiConfiguration?.todoListEnabled ?? true, browserToolEnabled: browserToolEnabled ?? true, modelInfo, + diffEnabled, } // Determine if partial reads are enabled based on maxReadFileLine setting