@azure-devops/mcp 2.10.0-nightly.20261014 → 2.10.0-nightly.20261016

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.
@@ -38,10 +38,8 @@ function trimPullRequestThread(thread) {
38
38
  pullRequestThreadContext: thread.pullRequestThreadContext,
39
39
  };
40
40
  }
41
- function trimComments(comments) {
42
- return comments
43
- ?.filter((comment) => !comment.isDeleted)
44
- ?.map((comment) => ({
41
+ function trimComment(comment) {
42
+ return {
45
43
  id: comment.id,
46
44
  author: {
47
45
  displayName: comment.author?.displayName,
@@ -51,7 +49,10 @@ function trimComments(comments) {
51
49
  publishedDate: comment.publishedDate,
52
50
  lastUpdatedDate: comment.lastUpdatedDate,
53
51
  lastContentUpdatedDate: comment.lastContentUpdatedDate,
54
- }));
52
+ };
53
+ }
54
+ function trimComments(comments) {
55
+ return comments?.filter((comment) => !comment.isDeleted)?.map(trimComment);
55
56
  }
56
57
  function pullRequestStatusStringToInt(status) {
57
58
  switch (status) {
@@ -901,8 +902,7 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
901
902
  status: z
902
903
  .enum(getEnumKeys(CommentThreadStatus))
903
904
  .optional()
904
- .default(CommentThreadStatus[CommentThreadStatus.Active])
905
- .describe("The thread status. Used for create (defaults to 'Active') and required for update_status."),
905
+ .describe("The thread status. Used for create (defaults to 'Active'), optionally for reply, and required for update_status."),
906
906
  filePath: z.string().optional().describe("The file path for the comment thread. Used for create."),
907
907
  fullResponse: z.boolean().optional().default(false).describe("Return full JSON response. Used for reply and update."),
908
908
  rightFileStartLine: z.coerce.number().min(1).optional().describe("Start line in the right file. Used for create."),
@@ -972,7 +972,8 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
972
972
  const pullRequestThreadContext = changeTrackingId !== undefined && firstComparingIteration !== undefined && secondComparingIteration !== undefined
973
973
  ? { changeTrackingId, iterationContext: { firstComparingIteration, secondComparingIteration } }
974
974
  : undefined;
975
- const thread = await gitApi.createThread({ comments: [{ content, commentType: 1 }], threadContext, pullRequestThreadContext, status: CommentThreadStatus[status] }, repositoryId, pullRequestId, project);
975
+ const threadStatus = status === undefined ? CommentThreadStatus.Active : CommentThreadStatus[status];
976
+ const thread = await gitApi.createThread({ comments: [{ content, commentType: 1 }], threadContext, pullRequestThreadContext, status: threadStatus }, repositoryId, pullRequestId, project);
976
977
  return { content: [{ type: "text", text: JSON.stringify(trimPullRequestThread(thread), null, 2) }] };
977
978
  }
978
979
  if (action === "reply") {
@@ -984,9 +985,55 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
984
985
  if (!comment) {
985
986
  return { content: [{ type: "text", text: `Error: Failed to add comment to thread ${threadId}. The comment was not created successfully.` }], isError: true };
986
987
  }
988
+ if (status !== undefined) {
989
+ let statusUpdateError;
990
+ let resultingThreadStatus;
991
+ try {
992
+ const thread = await gitApi.updateThread({ status: CommentThreadStatus[status] }, repositoryId, pullRequestId, threadId, project);
993
+ if (!thread) {
994
+ statusUpdateError = `Thread ${threadId} was not updated successfully.`;
995
+ }
996
+ else {
997
+ resultingThreadStatus = thread.status;
998
+ }
999
+ }
1000
+ catch (error) {
1001
+ statusUpdateError = error instanceof Error ? error.message : "Unknown error occurred";
1002
+ }
1003
+ if (statusUpdateError !== undefined) {
1004
+ return {
1005
+ content: [
1006
+ {
1007
+ type: "text",
1008
+ text: JSON.stringify({
1009
+ message: `Comment ${comment.id} was posted successfully, but the thread status update failed. Do not retry the reply.`,
1010
+ comment: trimComment(comment),
1011
+ statusUpdate: {
1012
+ succeeded: false,
1013
+ requestedStatus: status,
1014
+ error: statusUpdateError,
1015
+ },
1016
+ }, null, 2),
1017
+ },
1018
+ ],
1019
+ isError: true,
1020
+ };
1021
+ }
1022
+ return {
1023
+ content: [
1024
+ {
1025
+ type: "text",
1026
+ text: JSON.stringify({
1027
+ comment: trimComment(comment),
1028
+ status: resultingThreadStatus,
1029
+ }, null, 2),
1030
+ },
1031
+ ],
1032
+ };
1033
+ }
987
1034
  if (fullResponse)
988
1035
  return { content: [{ type: "text", text: JSON.stringify(comment, null, 2) }] };
989
- return { content: [{ type: "text", text: `Comment successfully added to thread ${threadId}.` }] };
1036
+ return { content: [{ type: "text", text: JSON.stringify(trimComment(comment), null, 2) }] };
990
1037
  }
991
1038
  if (action === "update") {
992
1039
  if (!threadId)
@@ -63,7 +63,7 @@ function configureSearchTools(server, tokenProvider, connectionProvider, userAge
63
63
  const combinedResults = await fetchCombinedResults(resultJson.results ?? [], gitApi);
64
64
  return createExternalContentResponse(resultText + JSON.stringify(combinedResults), "code search results");
65
65
  });
66
- server.tool(SEARCH_TOOLS.search_wiki, "Search Azure DevOps Wiki for a given search text", {
66
+ server.tool(SEARCH_TOOLS.search_wiki, "Search Azure DevOps Wiki for a given search text. Results include the repository path and a wiki-relative pagePath that can be used with the wiki tool.", {
67
67
  searchText: z.string().describe("Keywords to search for wiki pages"),
68
68
  project: z.array(z.string()).optional().describe("Filter by projects"),
69
69
  wiki: z.array(z.string()).optional().describe("Filter by wiki names"),
@@ -99,8 +99,10 @@ function configureSearchTools(server, tokenProvider, connectionProvider, userAge
99
99
  if (!response.ok) {
100
100
  throw new Error(`Azure DevOps Wiki Search API error: ${response.status} ${response.statusText}`);
101
101
  }
102
- const result = await response.text();
103
- return createExternalContentResponse(result, "wiki search results");
102
+ const result = (await response.json());
103
+ const results = result.results?.map(addWikiPagePath);
104
+ const enrichedResult = results ? { ...result, results } : result;
105
+ return createExternalContentResponse(JSON.stringify(enrichedResult), "wiki search results");
104
106
  });
105
107
  server.tool(SEARCH_TOOLS.search_workitem, "Get Azure DevOps Work Item search results for a given search text", {
106
108
  searchText: z.string().describe("Search text to find in work items"),
@@ -151,6 +153,27 @@ function configureSearchTools(server, tokenProvider, connectionProvider, userAge
151
153
  return createExternalContentResponse(result, "work item search results");
152
154
  });
153
155
  }
156
+ function addWikiPagePath(result) {
157
+ if (!result || result.pagePath || !result.path || !result.wiki?.mappedPath) {
158
+ return result;
159
+ }
160
+ const mappedPath = result.wiki.mappedPath === "/" ? "" : result.wiki.mappedPath.replace(/\/+$/, "");
161
+ if (mappedPath && result.path !== mappedPath && !result.path.startsWith(`${mappedPath}/`)) {
162
+ return result;
163
+ }
164
+ let relativePath;
165
+ try {
166
+ relativePath = decodeURIComponent(result.path.slice(mappedPath.length).replace(/\.md$/i, ""));
167
+ }
168
+ catch (error) {
169
+ if (error instanceof URIError) {
170
+ return result;
171
+ }
172
+ throw error;
173
+ }
174
+ const pagePath = relativePath.startsWith("/") ? relativePath : `/${relativePath}`;
175
+ return { ...result, pagePath };
176
+ }
154
177
  async function fetchCombinedResults(topSearchResults, gitApi) {
155
178
  const combinedResults = [];
156
179
  for (const searchResult of topSearchResults) {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const packageVersion = "2.10.0-nightly.20261014";
1
+ export const packageVersion = "2.10.0-nightly.20261016";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-devops/mcp",
3
- "version": "2.10.0-nightly.20261014",
3
+ "version": "2.10.0-nightly.20261016",
4
4
  "mcpName": "microsoft.com/azure-devops",
5
5
  "description": "MCP server for interacting with Azure DevOps",
6
6
  "license": "MIT",