Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/core/prompts/tools/filter-tools-for-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
maxReadFileLine: state?.maxReadFileLine ?? -1,
browserToolEnabled: state?.browserToolEnabled ?? true,
modelInfo,
diffEnabled: this.diffEnabled,
})
}

Expand Down
3 changes: 3 additions & 0 deletions src/core/task/build-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface BuildToolsOptions {
maxReadFileLine: number
browserToolEnabled: boolean
modelInfo?: ModelInfo
diffEnabled: boolean
}

/**
Expand All @@ -34,6 +35,7 @@ export async function buildNativeToolsArray(options: BuildToolsOptions): Promise
maxReadFileLine,
browserToolEnabled,
modelInfo,
diffEnabled,
} = options

const mcpHub = provider.getMcpHub()
Expand All @@ -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
Expand Down
Loading