fix(labels): add DestructiveHint to label_write tool#2763
Open
syf2211 wants to merge 1 commit into
Open
Conversation
The label_write delete method removes labels repository-wide but the tool only advertised ReadOnlyHint:false. Set DestructiveHint:true so MCP clients can warn before destructive label deletions, matching projects_write. Fixes github#2723 Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
Add
DestructiveHint: trueto thelabel_writetool annotations so MCP clients can surface appropriate warnings before repository-wide label deletions.Motivation
The
label_writetool supportscreate,update, anddeletemethods. Thedeletemethod permanently removes a label and all of its associations from every issue and PR in the repository. The tool currently only setsReadOnlyHint: false, giving clients no destructive-operation signal.Deleting a label removes it repository-wide from all issues and pull requests (GitHub API permanent delete).
Fixes #2723
Rationale
label_writeis a multi-method tool (create/update/delete). MCP tool annotations are tool-scoped (no per-method hints), so we mark the entire tooldestructiveHint: truewhen any method is destructive—matchingprojects_writeanddiscussion_comment_write.Changes
DestructiveHint: jsonschema.Ptr(true)onlabel_writeinpkg/github/labels.gopkg/github/labels_test.golabel_writetoolsnapTests
go test ./pkg/github -run 'TestWriteLabel' -count=1 -v— PASSImpact
Hosts/clients may show destructive-operation warnings for all
label_writecalls, including create/update. This is intentional conservative labeling.