Skip to content

feat: add labels support to create_pull_request tool #2414

@yashdesai30

Description

@yashdesai30

Feature Request

Problem

The create_pull_request tool currently does not support adding labels during PR creation. Users who want to label PRs at creation time must either:

  1. Make a separate add_label tool call after creating the PR
  2. Manually add labels in the GitHub UI

This creates a poor developer experience in agentic workflows where a PR should be created with appropriate labels in a single step (e.g., "Create a PR for this bugfix and label it as bug and priority:high").

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 would use a two-step approach:

  1. Create the PR via the existing pulls endpoint
  2. Apply labels via POST /repos/{owner}/{repo}/issues/{issue_number}/labels

If label application fails after PR creation, the error should clearly indicate the PR was created successfully but labels could not be applied.

Use Cases

  • Agentic workflows: "Create a PR from my feature branch and label it as enhancement"
  • CI/CD automation: Programmatically creating PRs with classification labels
  • Triage workflows: Creating PRs with priority/area labels in one step

Impact

  • Makes the create_pull_request tool more complete and reduces the number of tool calls needed
  • Aligns with how developers naturally think about PR creation (title + description + labels together)
  • No breaking changes — the parameter is fully optional

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions