You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Description("Links an existing Azure DevOps work item to one or more other work items. relationType accepts parent, child, predecessor, successor, related, or the matching System.LinkTypes.* reference name.")]
167
+
publicasyncTask<string>LinkWorkItems(
168
+
[Description("The work item ID to update with the new link. For a story, this is the story ID.")]intsourceWorkItemId,
169
+
[Description("Comma- or semicolon-separated target work item IDs to link to (e.g., '123,456' or '123;456')")]stringtargetWorkItemIds,
170
+
[Description("Relation from the source work item's perspective: parent, child, predecessor, successor, related, or a System.LinkTypes.* reference name")]stringrelationType,
171
+
[Description("The project name (optional if default project is configured)")]string?project=null,
172
+
[Description("Optional comment to store on the relation")]string?comment=null,
173
+
CancellationTokencancellationToken=default)
174
+
{
175
+
if(sourceWorkItemId<=0)
176
+
{
177
+
returnJsonSerializer.Serialize(new{error="sourceWorkItemId must be a positive integer"},JsonOptions);
178
+
}
179
+
180
+
vartargetIds=ParseWorkItemIds(targetWorkItemIds);
181
+
if(targetIds.Count==0)
182
+
{
183
+
returnJsonSerializer.Serialize(new{error="No valid target work item IDs provided"},JsonOptions);
184
+
}
185
+
186
+
if(targetIds.Contains(sourceWorkItemId))
187
+
{
188
+
returnJsonSerializer.Serialize(new{error="A work item cannot be linked to itself"},JsonOptions);
message=$"Work item {sourceWorkItemId} linked to {targetIds.Count} work item(s)",
221
+
sourceWorkItemId,
222
+
targetWorkItemIds=targetIds,
223
+
relationType=normalizedRelationType,
224
+
workItem
225
+
},JsonOptions);
226
+
}
227
+
165
228
[McpServerTool(Name="get_recent_work_items")]
166
229
[Description("Gets recently changed work items with pagination. Returns a summary view (ID, Title, Type, State, Priority) to reduce payload size. Use get_work_item to get full details of a specific item.")]
167
230
publicasyncTask<string>GetRecentWorkItems(
@@ -477,6 +540,41 @@ public async Task<string> UpdateWorkItem(
0 commit comments