diff --git a/pkg/github/__toolsnaps__/pull_request_review_write.snap b/pkg/github/__toolsnaps__/pull_request_review_write.snap index 74ef80855..5f9ee4a8b 100644 --- a/pkg/github/__toolsnaps__/pull_request_review_write.snap +++ b/pkg/github/__toolsnaps__/pull_request_review_write.snap @@ -1,5 +1,6 @@ { "annotations": { + "destructiveHint": true, "idempotentHint": false, "readOnlyHint": false, "title": "Write operations (create, submit, delete) on pull request reviews" diff --git a/pkg/github/__toolsnaps__/sub_issue_write.snap b/pkg/github/__toolsnaps__/sub_issue_write.snap index 9dc2776c3..983ab32ff 100644 --- a/pkg/github/__toolsnaps__/sub_issue_write.snap +++ b/pkg/github/__toolsnaps__/sub_issue_write.snap @@ -1,5 +1,6 @@ { "annotations": { + "destructiveHint": true, "idempotentHint": false, "readOnlyHint": false, "title": "Change sub-issue" diff --git a/pkg/github/issues.go b/pkg/github/issues.go index a40afa172..7b49f395e 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -1384,8 +1384,9 @@ func SubIssueWrite(t translations.TranslationHelperFunc) inventory.ServerTool { Name: "sub_issue_write", Description: t("TOOL_SUB_ISSUE_WRITE_DESCRIPTION", "Add a sub-issue to a parent issue in a GitHub repository."), Annotations: &mcp.ToolAnnotations{ - Title: t("TOOL_SUB_ISSUE_WRITE_USER_TITLE", "Change sub-issue"), - ReadOnlyHint: false, + Title: t("TOOL_SUB_ISSUE_WRITE_USER_TITLE", "Change sub-issue"), + ReadOnlyHint: false, + DestructiveHint: jsonschema.Ptr(true), }, InputSchema: &jsonschema.Schema{ Type: "object", diff --git a/pkg/github/issues_test.go b/pkg/github/issues_test.go index 191b6aa71..5066ae7b5 100644 --- a/pkg/github/issues_test.go +++ b/pkg/github/issues_test.go @@ -3941,6 +3941,10 @@ func Test_AddSubIssue(t *testing.T) { assert.Equal(t, "sub_issue_write", tool.Name) assert.NotEmpty(t, tool.Description) + // remove deletes a sub-issue link, so clients must treat the tool as + // destructive and confirm before running it. + require.NotNil(t, tool.Annotations.DestructiveHint, "sub_issue_write should set DestructiveHint") + assert.True(t, *tool.Annotations.DestructiveHint, "sub_issue_write should be destructive") assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method") assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 9fc845598..077efa38c 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -1784,8 +1784,9 @@ Available methods: - unresolve_thread: Unresolve a previously resolved review thread. Requires only "threadId" parameter. The owner, repo, and pullNumber parameters are not used for this method. Unresolving an already-unresolved thread is a no-op. `), Annotations: &mcp.ToolAnnotations{ - Title: t("TOOL_PULL_REQUEST_REVIEW_WRITE_USER_TITLE", "Write operations (create, submit, delete) on pull request reviews"), - ReadOnlyHint: false, + Title: t("TOOL_PULL_REQUEST_REVIEW_WRITE_USER_TITLE", "Write operations (create, submit, delete) on pull request reviews"), + ReadOnlyHint: false, + DestructiveHint: jsonschema.Ptr(true), }, InputSchema: schema, }, diff --git a/pkg/github/pullrequests_test.go b/pkg/github/pullrequests_test.go index bcae87c94..66ddc7e7a 100644 --- a/pkg/github/pullrequests_test.go +++ b/pkg/github/pullrequests_test.go @@ -2843,6 +2843,10 @@ func TestCreateAndSubmitPullRequestReview(t *testing.T) { assert.Equal(t, "pull_request_review_write", tool.Name) assert.NotEmpty(t, tool.Description) + // delete_pending discards a pending review's body, so clients must treat + // the tool as destructive and confirm before running it. + require.NotNil(t, tool.Annotations.DestructiveHint, "pull_request_review_write should set DestructiveHint") + assert.True(t, *tool.Annotations.DestructiveHint, "pull_request_review_write should be destructive") schema := tool.InputSchema.(*jsonschema.Schema) assert.Contains(t, schema.Properties, "method") assert.Contains(t, schema.Properties, "owner")