Skip to content

fix(labels): mark label_write as destructive#2836

Open
JuggerGrimrod88 wants to merge 1 commit into
github:mainfrom
JuggerGrimrod88:fix/label-write-destructive-hint
Open

fix(labels): mark label_write as destructive#2836
JuggerGrimrod88 wants to merge 1 commit into
github:mainfrom
JuggerGrimrod88:fix/label-write-destructive-hint

Conversation

@JuggerGrimrod88

Copy link
Copy Markdown

What & why

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. The tool set ReadOnlyHint: false but omitted DestructiveHint, 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: true on label_write (pkg/github/labels.go).

label_write is a method-dispatched tool (create/update/delete), so the static hint cannot vary per method. I set it true on the whole tool, matching the convention already established by the other method-dispatched tools capable of destruction:

  • projects_writepkg/github/projects.go:462 (asserted in projects_test.go)
  • actions_run_triggerpkg/github/actions.go:539

The hint communicates "this tool is capable of destruction" (so clients should confirm), which is accurate for label_write regardless of method.

Tests

  • Added assertions in TestWriteLabel that DestructiveHint is non-nil and true (mirrors projects_test.go).
  • Regenerated the toolsnaps golden snapshot for label_write via the documented UPDATE_TOOLSNAPS=true workflow; the only diff is + "destructiveHint": true.
  • go build ./... clean.
  • go vet ./pkg/github/ clean.
  • go test ./pkg/github/ passes (full package suite).

Closes #2723

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

label_write delete is missing DestructiveHint: true annotation

1 participant