-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add individual tool controls to reduce token usage #5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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
src/core/prompts/tools/index.ts
Outdated
| if (disabledTools && disabledTools.length > 0) { | ||
| disabledTools.forEach((tool) => { | ||
| // Don't filter out always-available tools | ||
| if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) { |
There was a problem hiding this comment.
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.
| if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) { | |
| if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as ToolName)) { |
There was a problem hiding this comment.
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
|
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 You can either:
The fix ensures all language files have the required keys:
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
KJ7LNW
left a comment
There was a problem hiding this 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
src/core/prompts/tools/index.ts
Outdated
| if (disabledTools && disabledTools.length > 0) { | ||
| disabledTools.forEach((tool) => { | ||
| // Don't filter out always-available tools | ||
| if (!ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) { |
There was a problem hiding this comment.
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
src/core/prompts/system.ts
Outdated
| experiments, | ||
| partialReadsEnabled, | ||
| settings, | ||
| settings?.disabledTools, |
There was a problem hiding this comment.
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> = { |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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, | ||
| }, |
There was a problem hiding this comment.
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"], | ||
| }, | ||
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
|
well I tried it did not get to where it needed to be, things are starting to look worse... |
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
How it works
Testing
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.
disabledToolsconfiguration toglobal-settings.tsto manage disabled tools.index.tsto exclude disabled tools from system prompts.ToolSettingscomponent inToolSettings.tsxfor UI to toggle tool availability.SettingsView.tsxwith a wrench icon.ClineProvider.tsandwebviewMessageHandler.ts.ask_followup_question,attempt_completion) cannot be disabled.index.spec.tsto verify disabled tools are excluded from prompts.This description was created by
for a18cf17. You can customize this summary. It will automatically update as commits are pushed.