diff --git a/pkg/github/__toolsnaps__/label_write.snap b/pkg/github/__toolsnaps__/label_write.snap index 6eeb9fd73..e9fdcf0d8 100644 --- a/pkg/github/__toolsnaps__/label_write.snap +++ b/pkg/github/__toolsnaps__/label_write.snap @@ -1,5 +1,6 @@ { "annotations": { + "destructiveHint": true, "idempotentHint": false, "readOnlyHint": false, "title": "Write operations on repository labels" diff --git a/pkg/github/labels.go b/pkg/github/labels.go index 0e4996849..29ae3d532 100644 --- a/pkg/github/labels.go +++ b/pkg/github/labels.go @@ -226,8 +226,9 @@ func LabelWrite(t translations.TranslationHelperFunc) inventory.ServerTool { Name: "label_write", Description: t("TOOL_LABEL_WRITE_DESCRIPTION", "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool."), Annotations: &mcp.ToolAnnotations{ - Title: t("TOOL_LABEL_WRITE_TITLE", "Write operations on repository labels"), - ReadOnlyHint: false, + Title: t("TOOL_LABEL_WRITE_TITLE", "Write operations on repository labels"), + ReadOnlyHint: false, + DestructiveHint: jsonschema.Ptr(true), }, InputSchema: &jsonschema.Schema{ Type: "object", diff --git a/pkg/github/labels_test.go b/pkg/github/labels_test.go index 88102ba3c..4407b4b4a 100644 --- a/pkg/github/labels_test.go +++ b/pkg/github/labels_test.go @@ -247,6 +247,10 @@ func TestWriteLabel(t *testing.T) { assert.Equal(t, "label_write", tool.Name) assert.NotEmpty(t, tool.Description) assert.False(t, tool.Annotations.ReadOnlyHint, "label_write tool should not be read-only") + // label_write can delete a label repo-wide (removing it from every issue/PR), + // so clients must treat the tool as destructive and confirm before running it. + require.NotNil(t, tool.Annotations.DestructiveHint, "label_write should set DestructiveHint") + assert.True(t, *tool.Annotations.DestructiveHint, "label_write should be destructive") tests := []struct { name string