Skip to content

fix(labels): add DestructiveHint to label_write tool#2763

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

fix(labels): add DestructiveHint to label_write tool#2763
syf2211 wants to merge 1 commit into
github:mainfrom
syf2211:fix/label-write-destructive-hint

Conversation

@syf2211

@syf2211 syf2211 commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Add DestructiveHint: true to the label_write tool annotations so MCP clients can surface appropriate warnings before repository-wide label deletions.

Motivation

The label_write tool supports create, update, and delete methods. The delete method permanently removes a label and all of its associations from every issue and PR in the repository. The tool currently only sets ReadOnlyHint: 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_write is a multi-method tool (create / update / delete). MCP tool annotations are tool-scoped (no per-method hints), so we mark the entire tool destructiveHint: true when any method is destructive—matching projects_write and discussion_comment_write.

Changes

  • Set DestructiveHint: jsonschema.Ptr(true) on label_write in pkg/github/labels.go
  • Add DestructiveHint assertions in pkg/github/labels_test.go
  • Update label_write toolsnap

Tests

  • go test ./pkg/github -run 'TestWriteLabel' -count=1 -v — PASS

Impact

Hosts/clients may show destructive-operation warnings for all label_write calls, including create/update. This is intentional conservative labeling.

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>
@syf2211 syf2211 requested a review from a team as a code owner June 24, 2026 11:13
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

2 participants