@azure-devops/mcp 2.3.0-nightly.20251205 → 2.3.0-nightly.20251207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/repositories.js +24 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -259,7 +259,8 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
|
|
|
259
259
|
deleteSourceBranch: z.boolean().optional().default(false).describe("Whether to delete the source branch when the pull request autocompletes. Defaults to false."),
|
|
260
260
|
transitionWorkItems: z.boolean().optional().default(true).describe("Whether to transition associated work items to the next state when the pull request autocompletes. Defaults to true."),
|
|
261
261
|
bypassReason: z.string().optional().describe("Reason for bypassing branch policies. When provided, branch policies will be automatically bypassed during autocompletion."),
|
|
262
|
-
|
|
262
|
+
labels: z.array(z.string()).optional().describe("Array of label names to replace existing labels on the pull request. This will remove all current labels and add the specified ones."),
|
|
263
|
+
}, async ({ repositoryId, pullRequestId, title, description, isDraft, targetRefName, status, autoComplete, mergeStrategy, deleteSourceBranch, transitionWorkItems, bypassReason, labels }) => {
|
|
263
264
|
try {
|
|
264
265
|
const connection = await connectionProvider();
|
|
265
266
|
const gitApi = await connection.getGitApi();
|
|
@@ -300,13 +301,32 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
|
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
303
|
// Validate that at least one field is provided for update
|
|
303
|
-
if (Object.keys(updateRequest).length === 0) {
|
|
304
|
+
if (Object.keys(updateRequest).length === 0 && !labels) {
|
|
304
305
|
return {
|
|
305
|
-
content: [{ type: "text", text: "Error: At least one field (title, description, isDraft, targetRefName, status,
|
|
306
|
+
content: [{ type: "text", text: "Error: At least one field (title, description, isDraft, targetRefName, status, autoComplete options, or labels) must be provided for update." }],
|
|
306
307
|
isError: true,
|
|
307
308
|
};
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
+
// Update labels if provided
|
|
311
|
+
if (labels) {
|
|
312
|
+
const currentLabels = await gitApi.getPullRequestLabels(repositoryId, pullRequestId);
|
|
313
|
+
for (const currentLabel of currentLabels) {
|
|
314
|
+
if (currentLabel.id) {
|
|
315
|
+
await gitApi.deletePullRequestLabels(repositoryId, pullRequestId, currentLabel.id);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
for (const label of labels) {
|
|
319
|
+
await gitApi.createPullRequestLabel({ name: label }, repositoryId, pullRequestId);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
let updatedPullRequest;
|
|
323
|
+
if (Object.keys(updateRequest).length > 0) {
|
|
324
|
+
updatedPullRequest = await gitApi.updatePullRequest(updateRequest, repositoryId, pullRequestId);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
// If only labels were updated, get the current pull request
|
|
328
|
+
updatedPullRequest = await gitApi.getPullRequest(repositoryId, pullRequestId);
|
|
329
|
+
}
|
|
310
330
|
const trimmedUpdatedPullRequest = trimPullRequest(updatedPullRequest, true);
|
|
311
331
|
return {
|
|
312
332
|
content: [{ type: "text", text: JSON.stringify(trimmedUpdatedPullRequest, null, 2) }],
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "2.3.0-nightly.
|
|
1
|
+
export const packageVersion = "2.3.0-nightly.20251207";
|