Check if the tool is _NOT_ read only before skipping it in read-only mode#1514
Merged
Check if the tool is _NOT_ read only before skipping it in read-only mode#1514
Conversation
almaleksia
approved these changes
Dec 1, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical logic error in the RegisterSpecificTools function that was incorrectly ported during the Go SDK migration. The bug inverted the condition for skipping write tools in read-only mode, causing the function to skip read-only tools instead.
Key Change:
- Corrects the condition from
if tool.Tool.Annotations.ReadOnlyHint && readOnlytoif !tool.Tool.Annotations.ReadOnlyHint && readOnlyto properly skip write tools (those without the ReadOnlyHint) when in read-only mode
Comments suppressed due to low confidence (1)
pkg/toolsets/toolsets.go:332
- The corrected read-only mode filtering logic lacks test coverage. Consider adding a test case in
pkg/toolsets/toolsets_test.gothat verifiesRegisterSpecificToolscorrectly skips write tools (whereReadOnlyHintis false) whenreadOnly=trueis passed, and that it registers read-only tools (whereReadOnlyHintis true).
if !tool.Tool.Annotations.ReadOnlyHint && readOnly {
// Skip write tools in read-only mode
skippedTools = append(skippedTools, toolName)
continue
}
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously these were pointers to a Bool, now they are concrete types and this was incorrectly ported in the Go SDK move.
Closes: