feat: add labels support to create_pull_request tool
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 20/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- go
研究方向
先查看 PR #2413,以及 issue 中提到的 CreatePullRequest InputSchema、AddLabelsToIssue 呼叫、測試和 pr-write MCP App 變更。執行 go test ./... 和 golangci-lint run --new-from-rev=HEAD;完成的標準是選用標籤能正常運作、標籤失敗時明確回報 PR 已建立,並且文件中記載的工具已更新。
由索引模型根據 Issue 內容生成。
描述
Describe the feature or problem you'd like to solve
The create_pull_request tool currently does not support adding labels during PR creation. Users who want to label PRs at creation time must make a separate add_label tool call after creating the PR, which adds friction in agentic workflows where a PR should be created with appropriate labels in a single step.
This is especially common in real-world usage — developers naturally say "create a PR and label it as bug" rather than thinking of it as two separate operations.
Proposed solution
Add an optional labels parameter (string array) to the create_pull_request tool. Since the GitHub REST API (POST /repos/{owner}/{repo}/pulls) does not natively support labels, the implementation uses a two-step approach:
- Create the PR via the existing pulls endpoint
- Apply labels via
POST /repos/{owner}/{repo}/issues/{issue_number}/labels
If label application fails after PR creation, the error clearly indicates the PR was created successfully but labels could not be applied, so no work is silently lost.
Benefits:
- Reduces tool calls needed for a common workflow (2 → 1)
- Aligns with how developers naturally think about PR creation
- Fully backwards-compatible — the parameter is optional
- Consistent with
issue_writewhich already supports labels at creation time
Example prompts or workflows (for tools/toolsets only)
-
"Create a pull request from my feature branch to main and label it as
bugandpriority:high" — Single-step PR creation with classification labels, common in triage workflows. -
"Open a PR for this hotfix, mark it as draft, and add the
urgentlabel" — Combines draft mode with labeling for time-sensitive fixes. -
"Create a PR titled 'Add user auth' from
feat/authtodevelopwith labelsenhancementandsecurity" — Full PR creation with multiple labels in one natural request. -
"Submit a pull request for my changes and tag it as
documentation" — Simple single-label use case that feels natural to say but currently requires two tool calls. -
"Create PRs for each of my feature branches and label them with their respective area labels" — Batch automation scenario where reducing tool calls per PR matters.
Additional context
I have a working implementation in PR #2413 that includes:
- Backend:
labelsarray property inCreatePullRequestInputSchema +AddLabelsToIssuepost-creation call - Tests: 2 new test cases (success with labels, label failure after PR creation)
- UI: Labels input field in the
pr-writeMCP App - Docs: Updated toolsnap + auto-generated README via
script/generate-docs
All tests pass (go test ./...) and lint is clean (golangci-lint run --new-from-rev=HEAD → 0 issues).
- 主要語言
- Go
- 星號
- 33.3k
- 分支
- 5.1k
- 平均合併
- 22 小時 46 分鐘
- 30 天內合併 PR
- 17
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/github-mcp-server 的其他 Issue
-
pull_request_read drops merge_commit_sha可能已有人在做 @thejdubb02 於 27 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 84/100
github/github-mcp-server#3235 · 1 則留言 ·
維護者通常 1 天內回覆
-
Add guidance on GitHub autolinked reference formatting for AI agents可能重新可做 關聯的 PR 已關閉且未合併。 未關閉enhancement
難度 1/5 1 小時以內 新手友好度 88/100
github/github-mcp-server#3042 · 2 則留言 ·
維護者通常 1 天內回覆
-
Incorrect install documentation leads to error "error: unknown option '-e'"可能已有人在做 @syf2211 於 56 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 72/100
github/github-mcp-server#3032 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
github/github-mcp-server#2803 · 1 則留言 ·
維護者通常 1 天內回覆
-
get_discussion and get_discussion_comments accept calls with missing required parameters instead of returning a validation error可能已有人在做 @rodboev 於 105 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
github/github-mcp-server#2740 ·
維護者通常 1 天內回覆
查看 github/github-mcp-server 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
prime-radiant-inc/evener#3726 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
temporalio/deputy#400 ·
維護者通常 1 天內回覆
-
[BUG] Async engine endpoint-label relationship counts include pending relationships of every type未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
status/0-needs-triage
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆