@azure-devops/mcp 2.11.1-nightly.20261124 → 2.11.1
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/auth.js +0 -0
- package/dist/index.js +0 -0
- package/dist/logger.js +0 -0
- package/dist/oauth.js +0 -0
- package/dist/org-tenants.js +0 -0
- package/dist/prompts.js +0 -0
- package/dist/shared/command.js +34 -0
- package/dist/tools/mcp-apps.js +22 -0
- package/dist/tools/work-items.js +9 -20
- package/dist/tools.js +0 -0
- package/dist/useragent.js +0 -0
- package/dist/utils.js +0 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/logger.js
CHANGED
|
File without changes
|
package/dist/oauth.js
CHANGED
|
File without changes
|
package/dist/org-tenants.js
CHANGED
|
File without changes
|
package/dist/prompts.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/** Builds an error `CallToolResult`. */
|
|
4
|
+
export const errorResult = (text) => ({ content: [{ type: "text", text }], isError: true });
|
|
5
|
+
/**
|
|
6
|
+
* Routes a validated, action-carrying args object to the matching command.
|
|
7
|
+
*
|
|
8
|
+
* This is what removes long positional parameter lists from grouped ("action")
|
|
9
|
+
* tools: instead of destructuring every possible field, the whole typed args
|
|
10
|
+
* object is forwarded to the single command keyed by `args.action`, coupling
|
|
11
|
+
* each action to exactly one command.
|
|
12
|
+
*
|
|
13
|
+
* - Unknown actions short-circuit with an "Unknown action" error and never
|
|
14
|
+
* touch the context (so no connection is opened).
|
|
15
|
+
* - Errors thrown by a command are caught and formatted using the optional
|
|
16
|
+
* per-action `errorPrefixes` map (falling back to a generic message).
|
|
17
|
+
* - Errors returned by a command (e.g. validation `errorResult`s) pass through
|
|
18
|
+
* unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export async function dispatchAction(commands, context, args, errorPrefixes) {
|
|
21
|
+
const command = commands[args.action];
|
|
22
|
+
if (!command) {
|
|
23
|
+
const supportedActions = Object.keys(commands).sort().join(", ");
|
|
24
|
+
return errorResult(`Unknown action: ${args.action}. Supported actions: ${supportedActions}`);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return await command.execute(context, args);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
31
|
+
const prefix = errorPrefixes?.[args.action];
|
|
32
|
+
return errorResult(prefix ? `${prefix}${message}` : `Error: ${message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
const MCP_APPS_TOOLS = {
|
|
4
|
+
ping: "mcp_apps_ping",
|
|
5
|
+
};
|
|
6
|
+
function configureMcpAppsTools(server) {
|
|
7
|
+
server.tool(MCP_APPS_TOOLS.ping, "A simple ping tool to verify that the mcp-apps domain is enabled.", {}, async () => {
|
|
8
|
+
try {
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: "text", text: "pong — mcp-apps domain is active" }],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
15
|
+
return {
|
|
16
|
+
content: [{ type: "text", text: `Error: ${errorMessage}` }],
|
|
17
|
+
isError: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { configureMcpAppsTools, MCP_APPS_TOOLS };
|
package/dist/tools/work-items.js
CHANGED
|
@@ -879,10 +879,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
879
879
|
if (!response.ok) {
|
|
880
880
|
throw new Error(`Failed to add a work item comment: ${response.statusText}`);
|
|
881
881
|
}
|
|
882
|
-
|
|
883
|
-
return {
|
|
884
|
-
content: [{ type: "text", text: JSON.stringify({ workItemId: added.workItemId, commentId: added.id, version: added.version, createdDate: added.createdDate, url: added.url }, null, 2) }],
|
|
885
|
-
};
|
|
882
|
+
return { content: [{ type: "text", text: await response.text() }] };
|
|
886
883
|
}
|
|
887
884
|
if (action === "update") {
|
|
888
885
|
if (!commentId)
|
|
@@ -899,12 +896,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
899
896
|
if (!response.ok) {
|
|
900
897
|
throw new Error(`Failed to update work item comment: ${response.statusText}`);
|
|
901
898
|
}
|
|
902
|
-
|
|
903
|
-
return {
|
|
904
|
-
content: [
|
|
905
|
-
{ type: "text", text: JSON.stringify({ workItemId: updated.workItemId, commentId: updated.id, version: updated.version, createdDate: updated.createdDate, url: updated.url }, null, 2) },
|
|
906
|
-
],
|
|
907
|
-
};
|
|
899
|
+
return { content: [{ type: "text", text: await response.text() }] };
|
|
908
900
|
}
|
|
909
901
|
return { content: [{ type: "text", text: `Unknown action: ${action}` }], isError: true };
|
|
910
902
|
}
|
|
@@ -1031,13 +1023,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
1031
1023
|
throw new Error(`Failed to update work items in batch: ${response.statusText}`);
|
|
1032
1024
|
}
|
|
1033
1025
|
const result = await response.json();
|
|
1034
|
-
|
|
1035
|
-
if (code < 200 || code >= 300)
|
|
1036
|
-
return { id: uniqueIds[index], error: entryBody };
|
|
1037
|
-
const workItem = JSON.parse(entryBody);
|
|
1038
|
-
return { id: workItem.id, rev: workItem.rev, url: workItem.url, added: body[index].body.map(({ value }) => ({ rel: value.rel, target: value.url })) };
|
|
1039
|
-
});
|
|
1040
|
-
return { content: [{ type: "text", text: JSON.stringify(linked, null, 2) }] };
|
|
1026
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
1041
1027
|
}
|
|
1042
1028
|
if (action === "unlink") {
|
|
1043
1029
|
if (!id)
|
|
@@ -1075,7 +1061,10 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
1075
1061
|
content: [
|
|
1076
1062
|
{
|
|
1077
1063
|
type: "text",
|
|
1078
|
-
text:
|
|
1064
|
+
text: `Removed ${removedRelations.length} link(s) of type '${type}':\n` +
|
|
1065
|
+
JSON.stringify(removedRelations, null, 2) +
|
|
1066
|
+
`\n\nUpdated work item result:\n` +
|
|
1067
|
+
JSON.stringify(updatedWorkItem, null, 2),
|
|
1079
1068
|
},
|
|
1080
1069
|
],
|
|
1081
1070
|
isError: false,
|
|
@@ -1110,7 +1099,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
1110
1099
|
return { content: [{ type: "text", text: "Work item update failed" }], isError: true };
|
|
1111
1100
|
}
|
|
1112
1101
|
return {
|
|
1113
|
-
content: [{ type: "text", text: JSON.stringify({
|
|
1102
|
+
content: [{ type: "text", text: JSON.stringify({ workItemId, pullRequestId, success: true }, null, 2) }],
|
|
1114
1103
|
};
|
|
1115
1104
|
}
|
|
1116
1105
|
if (action === "add_artifact_link") {
|
|
@@ -1213,7 +1202,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
1213
1202
|
content: [
|
|
1214
1203
|
{
|
|
1215
1204
|
type: "text",
|
|
1216
|
-
text: JSON.stringify({
|
|
1205
|
+
text: JSON.stringify({ workItemId, artifactUri: finalArtifactUri, linkType: effectiveLinkType, comment: comment || null, success: true }, null, 2),
|
|
1217
1206
|
},
|
|
1218
1207
|
],
|
|
1219
1208
|
};
|
package/dist/tools.js
CHANGED
|
File without changes
|
package/dist/useragent.js
CHANGED
|
File without changes
|
package/dist/utils.js
CHANGED
|
File without changes
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "2.11.1
|
|
1
|
+
export const packageVersion = "2.11.1";
|