feat: add labels support to create_pull_request tool
还没有人认领这个 Issue。
评估
- 难度
- 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.1k
- 派生
- 5k
- 平均合并
- 2 天 1 小时
- 30 天内合并 PR
- 25
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/github-mcp-server 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
github/github-mcp-server#3235 ·
-
enhancement
难度 1/5 1 小时以内 新手友好度 88/100
github/github-mcp-server#3042 · 2 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
github/github-mcp-server#3032 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 74/100
github/github-mcp-server#2803 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
github/github-mcp-server#2740 ·
查看 github/github-mcp-server 的全部 Issue
相似的 Issue
-
feature-request helm
难度 2/5 1-3 小时 新手友好度 68/100
gravitational/teleport#69785 ·
-
bug
难度 1/5 1 小时以内 新手友好度 92/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 88/100
crossplane/crossplane#7859 ·
-
难度 1/5 1 小时以内 新手友好度 90/100