Skip to content

Commit 78d4cfb

Browse files
syfcursoragent
authored andcommitted
fix(labels): add DestructiveHint to label_write tool
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 #2723 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9430064 commit 78d4cfb

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/github/__toolsnaps__/label_write.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"annotations": {
3+
"destructiveHint": true,
34
"title": "Write operations on repository labels"
45
},
56
"description": "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool.",

pkg/github/labels.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ func LabelWrite(t translations.TranslationHelperFunc) inventory.ServerTool {
226226
Name: "label_write",
227227
Description: t("TOOL_LABEL_WRITE_DESCRIPTION", "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool."),
228228
Annotations: &mcp.ToolAnnotations{
229-
Title: t("TOOL_LABEL_WRITE_TITLE", "Write operations on repository labels"),
230-
ReadOnlyHint: false,
229+
Title: t("TOOL_LABEL_WRITE_TITLE", "Write operations on repository labels"),
230+
ReadOnlyHint: false,
231+
DestructiveHint: jsonschema.Ptr(true),
231232
},
232233
InputSchema: &jsonschema.Schema{
233234
Type: "object",

pkg/github/labels_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ func TestWriteLabel(t *testing.T) {
247247
assert.Equal(t, "label_write", tool.Name)
248248
assert.NotEmpty(t, tool.Description)
249249
assert.False(t, tool.Annotations.ReadOnlyHint, "label_write tool should not be read-only")
250+
assert.NotNil(t, tool.Annotations.DestructiveHint)
251+
assert.True(t, *tool.Annotations.DestructiveHint, "label_write delete removes labels repository-wide")
250252

251253
tests := []struct {
252254
name string

0 commit comments

Comments
 (0)