Skip to content

Query on availability of Delete Branch tool #1476

Open

Description

@klakshmikantha

Hi,

In the set of tools listed, I can see 'create branch' and 'delete file' tools but not 'delete branch'. Is this intentionally excluded?
Is it in the roadmap to add the tool with some guardrails like only allow deleting unprotected branches or branches created by the MCP server tool?
Appreciate any inputs.

Thank you.

Activity

  1. bfedorov-clgx commented on Apr 23, 2026

    @bfedorov-clgx

    hello team!

    I agree with colleague, it's highy necessary feature. Please add delete_branch tool.

  2. nmime commented on Jun 1, 2026

    @nmime

    Can it be added?

  3. huzaifa678 commented on Jun 28, 2026

    @huzaifa678

    Hello I'd like to pick this up. I've implemented a delete_branch tool following the same pattern as the existing create_branch, with the guardrail suggested above: it fetches the branch first and refuses to delete protected branches, returning a clear error to the model instead of attempting the deletion.

    The Behavior:

    Required params: owner, repo, branch
    Checks branch protection via GET /repos/{owner}/{repo}/branches/{branch} before deleting
    Deletes via DELETE /repos/{owner}/{repo}/git/refs/heads/{branch}
    ReadOnlyHint: false, scoped to repo
    Tests cover success, protected-branch refusal, branch-not-found, and delete-failure cases. Happy to adjust the guardrail scope (e.g. also blocking the default branch) based on maintainer preference. Opening a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions