@azure-devops/mcp 2.8.1-nightly.20260714 → 2.8.1-nightly.20260716
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/tools/advanced-security.js +31 -11
- package/dist/tools/pipelines.js +387 -376
- package/dist/tools/wiki.js +242 -273
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ const ADVSEC_TOOLS = {
|
|
|
8
8
|
get_alert_details: "advsec_get_alert_details",
|
|
9
9
|
};
|
|
10
10
|
function configureAdvSecTools(server, _, connectionProvider) {
|
|
11
|
-
server.tool(ADVSEC_TOOLS.get_alerts, "Retrieve Advanced Security alerts for a repository.", {
|
|
11
|
+
server.tool(ADVSEC_TOOLS.get_alerts, "Retrieve Advanced Security alerts for a repository. Results are scoped to the specified project and repository. Branch filters (onlyDefaultBranch, ref) apply only to code, dependency, and license alerts; they are not applicable to secret alerts and are ignored by the service, so they neither include nor exclude secrets. To narrow secret alerts by confidence, pass a single 'confidenceLevels' value ('High' or 'Other'); selecting every level is treated as no confidence filter.", {
|
|
12
12
|
project: z.string().describe("The name or ID of the Azure DevOps project."),
|
|
13
13
|
repository: z.string().describe("The name or ID of the repository to get alerts for."),
|
|
14
14
|
alertType: z
|
|
@@ -26,17 +26,22 @@ function configureAdvSecTools(server, _, connectionProvider) {
|
|
|
26
26
|
ruleId: z.string().optional().describe("Filter alerts by rule ID."),
|
|
27
27
|
ruleName: z.string().optional().describe("Filter alerts by rule name."),
|
|
28
28
|
toolName: z.string().optional().describe("Filter alerts by tool name."),
|
|
29
|
-
ref: z
|
|
30
|
-
|
|
29
|
+
ref: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Filter non-secret alerts by git reference (branch), e.g. 'refs/heads/main'. When omitted and onlyDefaultBranch is true, only alerts on the default branch are returned. Not applicable to secret alerts and ignored by this tool when alertType is 'Secret'. When alertType is unspecified, this filter is still sent and may exclude secret alerts from the results; query alertType 'Secret' separately to retrieve all secrets."),
|
|
33
|
+
onlyDefaultBranch: z
|
|
34
|
+
.boolean()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("For non-secret alerts: if true (the service default when omitted) only return alerts found on the default branch; if false, return alerts from all branches. Ignored when 'ref' is provided. Not applicable to secret alerts and ignored by this tool when alertType is 'Secret'. When alertType is unspecified, this filter is still sent and may exclude secret alerts from the results; query alertType 'Secret' separately to retrieve all secrets."),
|
|
31
37
|
confidenceLevels: z
|
|
32
38
|
.array(z.enum(getEnumKeys(Confidence)))
|
|
33
39
|
.optional()
|
|
34
|
-
.
|
|
35
|
-
.describe("Filter alerts by confidence levels. Only applicable for secret alerts. Defaults to both 'high' and 'other'."),
|
|
40
|
+
.describe("Only applicable to secret alerts. Accepted values are 'High' and 'Other'. Pass a single value (e.g. ['High']) to narrow secrets to that confidence level. Leave unset to return secrets without a confidence filter. Do not select both levels to widen results: the Alerts service does not accept a multi-value confidence filter and would return no alerts, so this tool treats an all-levels selection as no filter and omits it."),
|
|
36
41
|
validity: z
|
|
37
42
|
.array(z.enum(getEnumKeys(AlertValidityStatus)))
|
|
38
43
|
.optional()
|
|
39
|
-
.describe("
|
|
44
|
+
.describe("Only applicable to secret alerts. If omitted, alerts of all validity statuses are returned (no validity filter is applied). Filtering by validity may return fewer alerts than 'top'; use the continuation token to fetch any remaining alerts."),
|
|
40
45
|
top: z.coerce.number().optional().default(100).describe("Maximum number of alerts to return. Defaults to 100."),
|
|
41
46
|
orderBy: z.enum(["id", "firstSeen", "lastSeen", "fixedOn", "severity"]).optional().default("severity").describe("Order results by specified field. Defaults to 'severity'."),
|
|
42
47
|
continuationToken: z.string().optional().describe("Continuation token for pagination."),
|
|
@@ -44,7 +49,22 @@ function configureAdvSecTools(server, _, connectionProvider) {
|
|
|
44
49
|
try {
|
|
45
50
|
const connection = await connectionProvider();
|
|
46
51
|
const alertApi = await connection.getAlertApi();
|
|
47
|
-
const
|
|
52
|
+
const normalizedAlertType = alertType?.toLowerCase();
|
|
53
|
+
// "onlyDefaultBranch" and "ref" are not applicable to secret alerts (secrets are not
|
|
54
|
+
// branch-scoped and carry a null gitRef). Forwarding them for a secret-only query diverges
|
|
55
|
+
// from the REST API / Advanced Security UI and can incorrectly return no alerts, so only
|
|
56
|
+
// include them when the query is not restricted to secret alerts.
|
|
57
|
+
const isSecretOnly = normalizedAlertType === "secret";
|
|
58
|
+
// "confidenceLevels" and "validity" only apply to secret alerts, so include them whenever
|
|
59
|
+
// the result set can contain secrets (an explicit "secret" type or no type filter at all).
|
|
60
|
+
const canIncludeSecrets = !alertType || isSecretOnly;
|
|
61
|
+
// The Alerts service does not accept the multi-value (comma-serialized) confidence filter
|
|
62
|
+
// that the SDK emits: selecting every level (e.g. both "High" and "Other") returns zero
|
|
63
|
+
// alerts, and it is a no-op filter regardless. Only forward confidenceLevels when it
|
|
64
|
+
// narrows the result to a proper subset (a single level); otherwise omit it so secrets are
|
|
65
|
+
// returned without a confidence filter instead of an empty set.
|
|
66
|
+
const confidenceLevelValues = confidenceLevels ? mapStringArrayToEnum(confidenceLevels, Confidence) : [];
|
|
67
|
+
const narrowsByConfidence = confidenceLevelValues.length > 0 && confidenceLevelValues.length < getEnumKeys(Confidence).length;
|
|
48
68
|
const criteria = {
|
|
49
69
|
...(alertType && { alertType: mapStringToEnum(alertType, AlertType) }),
|
|
50
70
|
...(states && { states: mapStringArrayToEnum(states, State) }),
|
|
@@ -52,10 +72,10 @@ function configureAdvSecTools(server, _, connectionProvider) {
|
|
|
52
72
|
...(ruleId && { ruleId }),
|
|
53
73
|
...(ruleName && { ruleName }),
|
|
54
74
|
...(toolName && { toolName }),
|
|
55
|
-
...(ref && { ref }),
|
|
56
|
-
...(onlyDefaultBranch !== undefined && { onlyDefaultBranch }),
|
|
57
|
-
...(
|
|
58
|
-
...(
|
|
75
|
+
...(!isSecretOnly && ref && { ref }),
|
|
76
|
+
...(!isSecretOnly && onlyDefaultBranch !== undefined && { onlyDefaultBranch }),
|
|
77
|
+
...(canIncludeSecrets && narrowsByConfidence && { confidenceLevels: confidenceLevelValues }),
|
|
78
|
+
...(canIncludeSecrets && validity && { validity: mapStringArrayToEnum(validity, AlertValidityStatus) }),
|
|
59
79
|
};
|
|
60
80
|
const result = await alertApi.getAlerts(project, repository, top, orderBy, criteria, undefined, // expand parameter
|
|
61
81
|
continuationToken);
|