Skip to content

Feature request: expose branch ahead/behind (base version comparison) for merged-branch cleanup #1442

Description

Summary

repo_get_branch_by_name (and the underlying Get Branch endpoint) currently only returns basic branch info (name, objectId, creator). The Azure DevOps REST API supports comparing a branch against a base ref via baseVersionDescriptor, returning aheadCount/behindCount. This isn't exposed anywhere in the current MCP tool surface.

Use case

A common cleanup workflow is: "list branches that are already merged into main and have no new commits, so they're safe to delete." Today, doing this through the MCP tools requires cross-referencing repo_list_pull_requests_by_repo_or_project (to find a Completed PR per branch) with commit-level lookups, which is indirect and, in my testing, some of the commit-search tools (repo_search_commits, repo_list_pull_requests_by_commits) timed out/hung repeatedly on a mid-size private org repo.

Suggestion

Either:

  1. Add optional baseVersionDescriptor (branch/commit/tag + version) params to repo_get_branch_by_name, returning aheadCount/behindCount when provided, or
  2. Add a dedicated repo_compare_branches tool wrapping the "Get Branch" stats/branches endpoint with base comparison.

This would let a single call per branch answer "is this branch merged and up to date with main" directly, instead of needing PR cross-referencing.

Environment

  • Package: @azure-devops/mcp (local/stdio server, via npx @azure-devops/mcp <org>)
  • Used via Claude Desktop

Metadata

Metadata

Labels

Needs Review 👓needs review by the product teamRepos 📁issue in the repos area

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions