advsec_get_alert_details
Retrieve detailed information for a specific Advanced Security alert in Azure DevOps by specifying project, repository, and alert ID using PAT authentication.
Instructions
Get detailed information about a specific Advanced Security alert.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alertId | Yes | The ID of the alert to retrieve details for. | |
| project | Yes | The name or ID of the Azure DevOps project. | |
| ref | No | Git reference (branch) to filter the alert. | |
| repository | Yes | The name or ID of the repository containing the alert. |
Implementation Reference
- src/tools/advsec.ts:110-140 (handler)Handler function that executes the tool logic: fetches detailed alert information from Azure DevOps Alert API.async ({ project, repository, alertId, ref }) => { try { const connection = await connectionProvider(); const alertApi = await connection.getAlertApi(); const result = await alertApi.getAlert( project, alertId, repository, ref, undefined // expand parameter ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `Error fetching alert details: ${errorMessage}`, }, ], isError: true, }; } } );
- src/tools/advsec.ts:104-109 (schema)Zod input schema defining parameters for the advsec_get_alert_details tool.{ project: z.string().describe("The name or ID of the Azure DevOps project."), repository: z.string().describe("The name or ID of the repository containing the alert."), alertId: z.number().describe("The ID of the alert to retrieve details for."), ref: z.string().optional().describe("Git reference (branch) to filter the alert."), },
- src/tools/advsec.ts:101-141 (registration)Tool registration using server.tool() in configureAdvSecTools function, which is called from src/tools.ts.server.tool( ADVSEC_TOOLS.get_alert_details, "Get detailed information about a specific Advanced Security alert.", { project: z.string().describe("The name or ID of the Azure DevOps project."), repository: z.string().describe("The name or ID of the repository containing the alert."), alertId: z.number().describe("The ID of the alert to retrieve details for."), ref: z.string().optional().describe("Git reference (branch) to filter the alert."), }, async ({ project, repository, alertId, ref }) => { try { const connection = await connectionProvider(); const alertApi = await connection.getAlertApi(); const result = await alertApi.getAlert( project, alertId, repository, ref, undefined // expand parameter ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `Error fetching alert details: ${errorMessage}`, }, ], isError: true, }; } } ); }
- src/tools/advsec.ts:11-14 (helper)Constant defining the tool name string for advsec_get_alert_details.const ADVSEC_TOOLS = { get_alerts: "advsec_get_alerts", get_alert_details: "advsec_get_alert_details", };