fix(labels): mark label_write as destructive#2836
Open
JuggerGrimrod88 wants to merge 1 commit into
Open
Conversation
label_write's delete method removes a label at the repository level, detaching it from every issue and PR in the repo — an operation whose effects cannot be automatically restored even if the label is recreated with the same name. Unlike remove_sub_issue and delete_pending_pull_request_review, label_write omitted DestructiveHint, so MCP clients received no destructive-operation signal and could execute the deletion without confirming with the user. Set DestructiveHint: true on the tool. This matches the convention already used by the other method-dispatched tools capable of destruction (projects_write, actions_run_trigger), which set the hint statically on a tool whose method set includes a destructive one. Closes github#2723 Co-Authored-By: Claude <noreply@anthropic.com>
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.
What & why
label_write'sdeletemethod removes a label at the repository level, detaching it from every issue and PR in the repo — an operation whose effects cannot be automatically restored even if the label is recreated with the same name. The tool setReadOnlyHint: falsebut omittedDestructiveHint, so MCP clients received no destructive-operation signal and could execute the deletion without confirming with the user.This addresses the concern raised in #2723.
Change
Set
DestructiveHint: trueonlabel_write(pkg/github/labels.go).label_writeis a method-dispatched tool (create/update/delete), so the static hint cannot vary per method. I set ittrueon the whole tool, matching the convention already established by the other method-dispatched tools capable of destruction:projects_write—pkg/github/projects.go:462(asserted inprojects_test.go)actions_run_trigger—pkg/github/actions.go:539The hint communicates "this tool is capable of destruction" (so clients should confirm), which is accurate for
label_writeregardless of method.Tests
TestWriteLabelthatDestructiveHintis non-nil andtrue(mirrorsprojects_test.go).toolsnapsgolden snapshot forlabel_writevia the documentedUPDATE_TOOLSNAPS=trueworkflow; the only diff is+ "destructiveHint": true.go build ./...clean.go vet ./pkg/github/clean.go test ./pkg/github/passes (full package suite).Closes #2723