From ee1693ac930d9869b41210beb71b6629f4e4c3d4 Mon Sep 17 00:00:00 2001 From: Yunus Ardaguney Date: Tue, 10 Nov 2026 13:49:07 +0300 Subject: [PATCH] fix(issues): annotate update_issue_labels and update_issue_assignees as destructive (#3760) The granular tools update_issue_labels and update_issue_assignees replace the current labels and assignees of an existing issue with the provided list. Any labels or assignees not included in the payload are removed via PATCH /repos/{owner}/{repo}/issues/{issue_number}. Previously, both tools set DestructiveHint: new(false) in their annotations, signaling to MCP clients that the operations are safe/non-destructive. A client or host keying user confirmation on destructiveHint would execute these without prompting, removing existing labels or assignees silently. Set DestructiveHint: new(true) for both tools, update toolsnaps, and add test assertions. Fixes #3760 Co-authored-by: Rafe Walker --- pkg/github/__toolsnaps__/update_issue_assignees.snap | 2 +- pkg/github/__toolsnaps__/update_issue_labels.snap | 2 +- pkg/github/granular_tools_test.go | 4 ++++ pkg/github/issues_granular.go | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/github/__toolsnaps__/update_issue_assignees.snap b/pkg/github/__toolsnaps__/update_issue_assignees.snap index 088992dc3b..4e563189d8 100644 --- a/pkg/github/__toolsnaps__/update_issue_assignees.snap +++ b/pkg/github/__toolsnaps__/update_issue_assignees.snap @@ -1,6 +1,6 @@ { "annotations": { - "destructiveHint": false, + "destructiveHint": true, "idempotentHint": false, "openWorldHint": true, "readOnlyHint": false, diff --git a/pkg/github/__toolsnaps__/update_issue_labels.snap b/pkg/github/__toolsnaps__/update_issue_labels.snap index c0cfa73ad8..a780d3a172 100644 --- a/pkg/github/__toolsnaps__/update_issue_labels.snap +++ b/pkg/github/__toolsnaps__/update_issue_labels.snap @@ -1,6 +1,6 @@ { "annotations": { - "destructiveHint": false, + "destructiveHint": true, "idempotentHint": false, "openWorldHint": true, "readOnlyHint": false, diff --git a/pkg/github/granular_tools_test.go b/pkg/github/granular_tools_test.go index 460a192766..0a1fd936e3 100644 --- a/pkg/github/granular_tools_test.go +++ b/pkg/github/granular_tools_test.go @@ -275,6 +275,8 @@ func TestGranularUpdateIssueAssignees(t *testing.T) { })) deps := BaseDeps{Client: client} serverTool := GranularUpdateIssueAssignees(translations.NullTranslationHelper) + require.NotNil(t, serverTool.Tool.Annotations.DestructiveHint) + assert.True(t, *serverTool.Tool.Annotations.DestructiveHint) handler := serverTool.Handler(deps) request := createMCPRequest(map[string]any{ @@ -512,6 +514,8 @@ func TestGranularUpdateIssueLabels(t *testing.T) { })) deps := BaseDeps{Client: client} serverTool := GranularUpdateIssueLabels(translations.NullTranslationHelper) + require.NotNil(t, serverTool.Tool.Annotations.DestructiveHint) + assert.True(t, *serverTool.Tool.Annotations.DestructiveHint) handler := serverTool.Handler(deps) request := createMCPRequest(tc.requestArgs) diff --git a/pkg/github/issues_granular.go b/pkg/github/issues_granular.go index eab4a204cd..3c4eede2ac 100644 --- a/pkg/github/issues_granular.go +++ b/pkg/github/issues_granular.go @@ -235,7 +235,7 @@ func GranularUpdateIssueAssignees(t translations.TranslationHelperFunc) inventor Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_UPDATE_ISSUE_ASSIGNEES_USER_TITLE", "Update Issue Assignees"), ReadOnlyHint: false, - DestructiveHint: new(false), + DestructiveHint: new(true), OpenWorldHint: new(true), }, InputSchema: &jsonschema.Schema{ @@ -370,7 +370,7 @@ func GranularUpdateIssueLabels(t translations.TranslationHelperFunc) inventory.S Annotations: &mcp.ToolAnnotations{ Title: t("TOOL_UPDATE_ISSUE_LABELS_USER_TITLE", "Update Issue Labels"), ReadOnlyHint: false, - DestructiveHint: new(false), + DestructiveHint: new(true), OpenWorldHint: new(true), }, InputSchema: &jsonschema.Schema{