github / github/github-mcp-server

Add granular `add_label_to_issue` / `remove_label_from_issue` tools

未关闭
#2,724 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
request ai review
主要语言
Go
星标
33k
派生
5k
平均合并
2 天 1 小时
30 天内合并 PR
52

描述

### Describe the feature or problem you'd like to solve

There is currently no way to remove a single label from an issue without replacing the issue's entire label set. The only issue-label tool, `update_issue_labels` (`pkg/github/issues_granular.go`), states in its own description: "This replaces the current labels with the provided list."

To remove one label, a client must:
1. Read all current labels on the issue
2. Compute the full set minus the one to remove
3. Send the complete remaining set back

If step 1 or 2 is incomplete or stale, labels are silently dropped. This read-modify-write pattern is error-prone for agents and adds round-trips.

### Proposed solution

Add discrete, non-destructive tools backed by the existing REST endpoints:
- `add_label_to_issue` → `POST /repos/{owner}/{repo}/issues/{issue_number}/labels`
- `remove_label_from_issue` → `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}`

These operate on a single label without touching the rest of the issue's labels.

### Precedent in the codebase

Sub-issues already follow exactly this granular pattern with `add_sub_issue` and `remove_sub_issue`, rather than forcing a full-set replacement. Labels-on-issues would benefit from the same treatment.

### Additional context

Related to #2412 (bulk/batch label operations). This proposal is the single-issue, single-label complement: #2412 covers operating across many issues at once, while this covers safely adding/removing one label on one issue without clobbering the others.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。