-
Notifications
You must be signed in to change notification settings - Fork 335
Labels
Approved ✅this issue or pull request has been approvedthis issue or pull request has been approvedRepos 📁issue in the repos areaissue in the repos area
Description
Problem Statement
Currently, the update_pull_request tool doesn't support updating labels on existing pull requests in Azure DevOps. While we recently added label support to create_pull_request, users cannot modify labels after a PR has been created through the MCP tools.
Proposed Solution
Add an optional labels parameter to the update_pull_request tool that accepts an array of label names. The behavior should follow the same pattern as other optional update fields:
undefined(not provided): Don't modify existing labels[](empty array): Remove all labels from the PR["label1", "label2"]: Replace existing labels with the specified ones
Implementation Approach
Similar to the create_pull_request implementation:
- Add an optional
labelsparameter to theupdate_pull_requesttool schema (array of strings, optional) - Map the label names to
WebApiTagDefinition[]format when provided:labels.map((label) => ({ name: label })) - Only include labels in the update request if the parameter is defined:
if (labels !== undefined) { updateRequest.labels = labels.map((label) => ({ name: label })); }
- Add comprehensive tests to verify:
- Labels are not updated when parameter is undefined
- All labels are removed when empty array is provided
- Labels are replaced when array with values is provided
Benefits
- Completes the label management story for pull requests
- Consistent API pattern with other update fields (title, description, etc.)
- Single API call to update labels instead of separate operations
- Allows removing all labels by passing empty array
Metadata
Metadata
Assignees
Labels
Approved ✅this issue or pull request has been approvedthis issue or pull request has been approvedRepos 📁issue in the repos areaissue in the repos area