From 5e8f886bcf4e20b964e20192202d2e3ca936f937 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Thu, 23 Jul 2026 12:35:49 +0200 Subject: [PATCH] fix(notifications): mark subscription tools destructive Both tools expose a delete action, so the tool-level annotation must remain conservative even though their other actions only update preferences. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: be9c15fe-a113-4ebd-b9ab-09a520d522b6 --- .../manage_notification_subscription.snap | 1 + .../manage_repository_notification_subscription.snap | 1 + pkg/github/notifications.go | 10 ++++++---- pkg/github/notifications_test.go | 6 ++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/github/__toolsnaps__/manage_notification_subscription.snap b/pkg/github/__toolsnaps__/manage_notification_subscription.snap index 603099200a..e062f2d25d 100644 --- a/pkg/github/__toolsnaps__/manage_notification_subscription.snap +++ b/pkg/github/__toolsnaps__/manage_notification_subscription.snap @@ -1,5 +1,6 @@ { "annotations": { + "destructiveHint": true, "idempotentHint": false, "readOnlyHint": false, "title": "Manage notification subscription" diff --git a/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap b/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap index 1bd09afd14..7f4464860d 100644 --- a/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap +++ b/pkg/github/__toolsnaps__/manage_repository_notification_subscription.snap @@ -1,5 +1,6 @@ { "annotations": { + "destructiveHint": true, "idempotentHint": false, "readOnlyHint": false, "title": "Manage repository notification subscription" diff --git a/pkg/github/notifications.go b/pkg/github/notifications.go index 618cbdef59..cd71a6c9d8 100644 --- a/pkg/github/notifications.go +++ b/pkg/github/notifications.go @@ -413,8 +413,9 @@ func ManageNotificationSubscription(t translations.TranslationHelperFunc) invent Name: "manage_notification_subscription", Description: t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a notification subscription: ignore, watch, or delete a notification thread subscription."), Annotations: &mcp.ToolAnnotations{ - Title: t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage notification subscription"), - ReadOnlyHint: false, + Title: t("TOOL_MANAGE_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage notification subscription"), + ReadOnlyHint: false, + DestructiveHint: jsonschema.Ptr(true), }, InputSchema: &jsonschema.Schema{ Type: "object", @@ -509,8 +510,9 @@ func ManageRepositoryNotificationSubscription(t translations.TranslationHelperFu Name: "manage_repository_notification_subscription", Description: t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_DESCRIPTION", "Manage a repository notification subscription: ignore, watch, or delete repository notifications subscription for the provided repository."), Annotations: &mcp.ToolAnnotations{ - Title: t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage repository notification subscription"), - ReadOnlyHint: false, + Title: t("TOOL_MANAGE_REPOSITORY_NOTIFICATION_SUBSCRIPTION_USER_TITLE", "Manage repository notification subscription"), + ReadOnlyHint: false, + DestructiveHint: jsonschema.Ptr(true), }, InputSchema: &jsonschema.Schema{ Type: "object", diff --git a/pkg/github/notifications_test.go b/pkg/github/notifications_test.go index 0262ab8388..f2cbaff9f4 100644 --- a/pkg/github/notifications_test.go +++ b/pkg/github/notifications_test.go @@ -146,6 +146,9 @@ func Test_ManageNotificationSubscription(t *testing.T) { assert.Equal(t, "manage_notification_subscription", tool.Name) assert.NotEmpty(t, tool.Description) + require.NotNil(t, tool.Annotations) + require.NotNil(t, tool.Annotations.DestructiveHint) + assert.True(t, *tool.Annotations.DestructiveHint, "delete removes the notification subscription") schema, ok := tool.InputSchema.(*jsonschema.Schema) require.True(t, ok, "InputSchema should be *jsonschema.Schema") @@ -282,6 +285,9 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) { assert.Equal(t, "manage_repository_notification_subscription", tool.Name) assert.NotEmpty(t, tool.Description) + require.NotNil(t, tool.Annotations) + require.NotNil(t, tool.Annotations.DestructiveHint) + assert.True(t, *tool.Annotations.DestructiveHint, "delete removes the repository notification subscription") schema, ok := tool.InputSchema.(*jsonschema.Schema) require.True(t, ok, "InputSchema should be *jsonschema.Schema")