Skip to content

Commit 3ae0fe5

Browse files
authored
Support for affects and affected by for adding work item links (#297)
Adding link types for affects and affected by ## GitHub issue number #269 ## **Associated Risks** None ## ✅ **PR Checklist** - [x] **I have read the [contribution guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CONTRIBUTING.md)** - [x] **I have read the [code of conduct guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CODE_OF_CONDUCT.md)** - [x] Title of the pull request is clear and informative. - [x] 👌 Code hygiene - [x] 🔭 Telemetry added, updated, or N/A - [x] 📄 Documentation added, updated, or N/A - [x] 🛡️ Automated tests added, or N/A ## 🧪 **How did you test it?** Updated tests and manual check
1 parent cf891ef commit 3ae0fe5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/tools/workitems.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ function getLinkTypeFromName(name: string) {
5050
return "Microsoft.VSTS.Common.TestedBy-Forward";
5151
case "tests":
5252
return "Microsoft.VSTS.Common.TestedBy-Reverse";
53+
case "affects":
54+
return "Microsoft.VSTS.Common.Affects-Forward";
55+
case "affected by":
56+
return "Microsoft.VSTS.Common.Affects-Reverse";
5357
default:
5458
throw new Error(`Unknown link type: ${name}`);
5559
}
@@ -678,10 +682,10 @@ function configureWorkItemTools(server: McpServer, tokenProvider: () => Promise<
678682
id: z.number().describe("The ID of the work item to update."),
679683
linkToId: z.number().describe("The ID of the work item to link to."),
680684
type: z
681-
.enum(["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests"])
685+
.enum(["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests", "affects", "affected by"])
682686
.default("related")
683687
.describe(
684-
"Type of link to create between the work items. Options include 'parent', 'child', 'duplicate', 'duplicate of', 'related', 'successor', 'predecessor', 'tested by', 'tests', 'referenced by', and 'references'. Defaults to 'related'."
688+
"Type of link to create between the work items. Options include 'parent', 'child', 'duplicate', 'duplicate of', 'related', 'successor', 'predecessor', 'tested by', 'tests', 'affects', and 'affected by'. Defaults to 'related'."
685689
),
686690
comment: z.string().optional().describe("Optional comment to include with the link. This can be used to provide additional context for the link being created."),
687691
})

test/src/tools/workitems.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ describe("configureWorkItemTools", () => {
854854
});
855855

856856
// Test different link types to cover all branches in getLinkTypeFromName
857-
const linkTypes = ["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests"];
857+
const linkTypes = ["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests", "affects", "affected by"];
858858

859859
for (const linkType of linkTypes) {
860860
const params = {
@@ -863,7 +863,7 @@ describe("configureWorkItemTools", () => {
863863
{
864864
id: 1,
865865
linkToId: 2,
866-
type: linkType as "parent" | "child" | "duplicate" | "duplicate of" | "related" | "successor" | "predecessor" | "tested by" | "tests",
866+
type: linkType as "parent" | "child" | "duplicate" | "duplicate of" | "related" | "successor" | "predecessor" | "tested by" | "tests" | "affects" | "affected by",
867867
comment: "Test comment",
868868
},
869869
],

0 commit comments

Comments
 (0)