-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: filter out Claude Code built-in tools (ExitPlanMode, BashOutput, KillBash) #7818
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
… KillBash) - Added CLAUDE_CODE_BUILTIN_TOOLS set to track built-in tools - Modified tool_use handling to silently ignore built-in tools - Added comprehensive tests for the filtering behavior - Fixes #7817
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.
Reviewing my own code is like grading my own homework - suspiciously perfect yet somehow still wrong.
src/api/providers/claude-code.ts
Outdated
| export class ClaudeCodeHandler extends BaseProvider implements ApiHandler { | ||
| private options: ApiHandlerOptions | ||
| // Claude Code built-in tools that should be filtered out | ||
| private static readonly CLAUDE_CODE_BUILTIN_TOOLS = new Set(["ExitPlanMode", "BashOutput", "KillBash"]) |
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.
Would it make sense to extract this constant to a shared file like src/integrations/claude-code/constants.ts? This would:
- Provide a single source of truth for Claude Code built-in tools
- Make it reusable if needed elsewhere
- Make it easier to maintain if the list changes
Also, I noticed in src/integrations/claude-code/run.ts there's already a list of disabled tools that includes exit_plan_mode (snake_case) but not these PascalCase versions. Should these lists be synchronized?
|
|
||
| consoleSpy.mockRestore() | ||
| }) | ||
| }) |
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 adding a test that verifies the Set contains exactly these three tools and no others. Something like:
| }) | |
| test("should have exactly the expected Claude Code built-in tools", () => { | |
| const expectedTools = new Set(["ExitPlanMode", "BashOutput", "KillBash"]) | |
| // Would need to make CLAUDE_CODE_BUILTIN_TOOLS accessible for testing | |
| expect(ClaudeCodeHandler.CLAUDE_CODE_BUILTIN_TOOLS).toEqual(expectedTools) | |
| }) |
This would prevent accidental additions or removals in the future.
|
@roomote-agent Can't you just add them to the |
|
Hi @juliettefournier-econ! I see your suggestion about adding the tools to the |
As suggested by @juliettefournier-econ, this change moves the filtering of Claude Code built-in tools (ExitPlanMode, BashOutput, KillBash) from the handler level to the CLI configuration level by adding them to the claudeCodeTools disallowed list in run.ts. This is a cleaner approach as it prevents these tools from being used at the source rather than filtering them after the fact.
|
I've implemented your suggestion and refactored the code to add the Claude Code built-in tools ( This is indeed a cleaner approach as it prevents these tools from being used at the CLI level rather than filtering them after the fact. Changes made:
All tests are passing locally. The PR is ready for review! Thank you for the excellent suggestion! 🎉 |
daniel-lxs
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.
LGTM
|
What do you think of switching to allowed tools instead of disallowed tools? Otherwise seems like this will break again soon. |
|
@mrubens I think this is done this way cause there's no flag to disallow all tools and having a single tool allowed might make Claude Code try to use it which will probably break something on Roo Code, maybe we should find a tool that doesn't cause any issues and only allow that one? |
Description
This PR addresses Issue #7817 by filtering out newer Claude Code built-in tools that were not being disabled, causing Roo to attempt to call them incorrectly.
Changes
CLAUDE_CODE_BUILTIN_TOOLScontaining the three built-in tools to filtertool_usecase handler to silently ignore Claude Code built-in toolsTesting
Related Issues
Fixes #7817
Checklist
Important
Filters out specific Claude Code built-in tools to prevent incorrect calls by Roo and adds tests to ensure functionality.
ExitPlanMode,BashOutput,KillBashinrun.tsto prevent incorrect calls by Roo.tool_usehandler to silently ignore these tools.This description was created by
for d64c66e. You can customize this summary. It will automatically update as commits are pushed.