Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 20, 2025

This PR implements individual tool controls as requested in #5963, allowing users to disable specific tools they don't use to reduce token usage in the system prompt.

Changes

  • Added disabledTools configuration to the global settings schema to store which tools are disabled
  • Updated tool system to filter out disabled tools from the system prompt generation
  • Created ToolSettings UI component that displays tools organized by groups with checkboxes to enable/disable them
  • Added tool settings section to the settings view with a wrench icon
  • Updated message handlers to persist disabled tools state between sessions
  • Added comprehensive tests for the disabled tools functionality
  • Ensured always-available tools (ask_followup_question, attempt_completion, switch_mode, new_task, update_todo_list) cannot be disabled

How it works

  1. Users can navigate to Settings > Tools in the UI
  2. They can see all available tools organized by their groups (read, edit, browser, command, mcp, modes)
  3. Users can toggle tools on/off using checkboxes
  4. Disabled tools are removed from the system prompt, saving valuable context tokens
  5. Always-available tools are shown but cannot be disabled

Testing

  • Added unit tests for the getToolDescriptionsForMode function to ensure disabled tools are properly filtered
  • Tested that always-available tools remain in the prompt even if included in the disabled list
  • All TypeScript compilation and linting checks pass

Fixes #5963


Important

This PR adds functionality to disable specific tools to reduce token usage, with UI components for toggling and backend support for persisting settings, while ensuring some tools remain always available.

  • Behavior:
    • Added disabledTools configuration to global-settings.ts to manage disabled tools.
    • Updated tool system in index.ts to exclude disabled tools from system prompts.
    • Implemented ToolSettings component in ToolSettings.tsx for UI to toggle tool availability.
    • Added tool settings section in SettingsView.tsx with a wrench icon.
    • Persist disabled tools state across sessions in ClineProvider.ts and webviewMessageHandler.ts.
    • Always-available tools (e.g., ask_followup_question, attempt_completion) cannot be disabled.
  • Testing:
    • Added tests in index.spec.ts to verify disabled tools are excluded from prompts.
    • Confirmed always-available tools remain in prompts even if listed as disabled.
    • Passed all TypeScript compilation and linting checks.
  • Misc:
    • Updated i18n files for multiple languages to include tool settings descriptions.

This description was created by Ellipsis for a18cf17. You can customize this summary. It will automatically update as commits are pushed.

- Add disabledTools configuration to global settings schema
- Update tool system to filter out disabled tools from system prompt
- Create ToolSettings UI component for toggling tools on/off
- Add tool settings section to settings view with wrench icon
- Update message handlers to persist disabled tools state
- Add comprehensive tests for disabled tools functionality
- Ensure always-available tools cannot be disabled

Fixes #5963
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 20, 2025 01:53
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Jul 20, 2025
if (disabledTools && disabledTools.length > 0) {
disabledTools.forEach((tool) => {
// Don't filter out always-available tools
if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider avoiding the use of 'tool as any' during the filtering of disabled tools. Strengthening the type definition (e.g., using a union type) would improve type safety.

Suggested change
if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) {
if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as ToolName)) {

Copy link
Contributor

@KJ7LNW KJ7LNW Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only filter tools at the very end of getToolDescriptionsForMode()

use the simplest possible filter implementation

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 20, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Jul 20, 2025

Hi @roomote!

I noticed the CI was failing due to missing translation keys in the non-English language files. I've created a branch with the necessary fixes: https://github.com/RooCodeInc/Roo-Code/tree/fix/translation-issues-pr-5968

The changes add the missing tools section translations to all 17 language files. For non-English files, I've kept the English text as placeholders since proper translations would need to be done by native speakers.

You can either:

  1. Cherry-pick the commit from my branch: fec146782
  2. Merge my branch into yours
  3. Or I can create a separate PR if you prefer

The fix ensures all language files have the required keys:

  • Added "tools": "Tools" to the sections object
  • Added the tools object with description and note properties

Let me know if you need any help with this!

- Remove grouped display of tools
- Show all tools as individual toggles in a flat list
- Make tool list dynamic based on global TOOL_GROUPS configuration
- Separate disableable tools from always-available tools
- Add translation for "Always available tools" section
Copy link
Contributor

@KJ7LNW KJ7LNW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roomote-agent - apply these changes and update the pull request

if (disabledTools && disabledTools.length > 0) {
disabledTools.forEach((tool) => {
// Don't filter out always-available tools
if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) {
Copy link
Contributor

@KJ7LNW KJ7LNW Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only filter tools at the very end of getToolDescriptionsForMode()

use the simplest possible filter implementation

experiments,
partialReadsEnabled,
settings,
settings?.disabledTools,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the existing settings object, getToolDescriptionsForMode most access settings.disabledTools


// Import the constants from shared/tools.ts
// Tool display names mapping
const TOOL_DISPLAY_NAMES: Record<string, string> = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use t(translations) in TOOL_DISPLAY_NAMES

}

// Tools that are always available and cannot be disabled
const ALWAYS_AVAILABLE_TOOLS = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the behavior is not specific to ALWAYS_AVAILABLE_TOOLS, they will apply enable/disable to all tools

{
maxConcurrentFileReads,
disabledTools,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/types/src/tool.ts this is the single point of truth for all tools: because this list is updated with new tools get added the PR needs to be dynamic and based on this list.

mcp: {
tools: ["use_mcp_tool", "access_mcp_resource"],
},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test must validate that all tools within packages/types/src/tool.ts are represented in TOOL_GROUPS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always explain which Roo mode was used to apply and implement and orchestrate the changes

- Added "tools" key to sections object in all non-English locale files
- Added tools configuration object with description, note, and alwaysAvailable keys
- Fixes CI failures due to missing translation keys
"includeMaxOutputTokens": "包含最大输出 Token 数",
"includeMaxOutputTokensDescription": "在 API 请求中发送最大输出 Token 参数。某些提供商可能不支持此功能。"
"includeMaxOutputTokensDescription": "在 API 请求中发送最大输出 Token 参数。某些提供商可能不支持此功能。",
"tools": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added 'tools' section (lines ~723–727) remains in English in the Simplified Chinese translation. Consider providing proper Chinese translations (or at least a note if intentional) to maintain consistency with the rest of the UI.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

"experimental": "實驗性",
"language": "語言",
"about": "關於 Roo Code"
"about": "關於 Roo Code",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Traditional Chinese translation, the 'tools' entries — both under the 'sections' key and the new 'tools' block at the bottom — are still in English. It's recommended to localize these strings (for example, translating 'Tools' to a proper Chinese term) for a consistent user experience.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

- Filter tools at the very end of getToolDescriptionsForMode()
- Use settings.disabledTools instead of separate parameter
- Use translations for tool display names
- Allow disabling all tools (not restricted to non-always-available)
- Make tool list dynamic based on packages/types/src/tool.ts
- Add tests to validate all tools are represented
@KJ7LNW
Copy link
Contributor

KJ7LNW commented Jul 20, 2025

well I tried it did not get to where it needed to be, things are starting to look worse...

@KJ7LNW KJ7LNW closed this Jul 20, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 20, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Need for individual tool controls to reduce token usage

4 participants