Repository: microsoft/azure-devops-mcp

Issue:
Add links tool should support all link types like Affects
Our ADO uses link type "Affects". Link WIT tool has been restrictive in terms of which link types are supported. This is verbatim output from Copilot.

---

The challenge I'm encountering is that the Azure DevOps API tools available have limitations:

The mcp_ado_wit_work_items_link tool only supports specific enum values and doesn't include "affects"
The mcp_ado_wit_update_work_item tool is very strict about the JSON-patch format for relationships

---

Discussion:
@danhellem: @zendu are you using CMMI templates?

Solution patch:
diff --git a/src/tools/workitems.ts b/src/tools/workitems.ts
index 9efe3b1..00b0485 100644
--- a/src/tools/workitems.ts
+++ b/src/tools/workitems.ts
@@ -50,6 +50,10 @@ function getLinkTypeFromName(name: string) {
       return "Microsoft.VSTS.Common.TestedBy-Forward";
     case "tests":
       return "Microsoft.VSTS.Common.TestedBy-Reverse";
+    case "affects":
+      return "Microsoft.VSTS.Common.Affects-Forward";
+    case "affected by":
+      return "Microsoft.VSTS.Common.Affects-Reverse";
     default:
       throw new Error(`Unknown link type: ${name}`);
   }
@@ -678,10 +682,10 @@ function configureWorkItemTools(server: McpServer, tokenProvider: () => Promise<
             id: z.number().describe("The ID of the work item to update."),
             linkToId: z.number().describe("The ID of the work item to link to."),
             type: z
-              .enum(["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests"])
+              .enum(["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests", "affects", "affected by"])
               .default("related")
               .describe(
-                "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'."
+                "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'."
               ),
             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."),
           })



Test patch:
diff --git a/test/src/tools/workitems.test.ts b/test/src/tools/workitems.test.ts
index 8659f70..2b745db 100644
--- a/test/src/tools/workitems.test.ts
+++ b/test/src/tools/workitems.test.ts
@@ -854,7 +854,7 @@ describe("configureWorkItemTools", () => {
       });
 
       // Test different link types to cover all branches in getLinkTypeFromName
-      const linkTypes = ["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests"];
+      const linkTypes = ["parent", "child", "duplicate", "duplicate of", "related", "successor", "predecessor", "tested by", "tests", "affects", "affected by"];
 
       for (const linkType of linkTypes) {
         const params = {
@@ -863,7 +863,7 @@ describe("configureWorkItemTools", () => {
             {
               id: 1,
               linkToId: 2,
-              type: linkType as "parent" | "child" | "duplicate" | "duplicate of" | "related" | "successor" | "predecessor" | "tested by" | "tests",
+              type: linkType as "parent" | "child" | "duplicate" | "duplicate of" | "related" | "successor" | "predecessor" | "tested by" | "tests" | "affects" | "affected by",
               comment: "Test comment",
             },
           ],