@@ -13,44 +13,65 @@ class ManageIncidentParams(BaseModel):
1313 """Parameters for managing an incident."""
1414
1515 incident_id : str | int = Field (description = "ID of the secret incident to manage" )
16- action : Literal ["assign" , " unassign" , "resolve" , "ignore" , "reopen" ] = Field (
17- description = "Action to perform on the incident"
16+ action : Literal ["unassign" , "resolve" , "ignore" , "reopen" ] = Field (
17+ description = "Action to perform on the incident: 'unassign' removes any assigned member, 'resolve' marks the incident as resolved, 'ignore' marks as ignored (use with ignore_reason), 'reopen' reopens a resolved or ignored incident "
1818 )
19- assignee_id : str | int | None = Field (
20- default = None , description = "ID of the member to assign the incident to (required for 'assign' action)"
21- )
22- ignore_reason : str | None = Field (
19+ ignore_reason : Literal ["test_credential" , "false_positive" , "low_risk" , "invalid" ] | None = Field (
2320 default = None ,
24- description = "Reason for ignoring ( test_credential, false_positive, etc.) (used with 'ignore' action )" ,
21+ description = "Reason for ignoring the incident. Only used with 'ignore' action. Options: ' test_credential' (secret is for testing), ' false_positive' (not a real secret), 'low_risk' (secret poses minimal risk), 'invalid' (secret is invalid/inactive )" ,
2522 )
26- mine : bool = Field (default = False , description = "If True, use the current user's ID for the assignee_id" )
2723
2824
2925async def manage_private_incident (params : ManageIncidentParams ) -> dict [str , Any ]:
3026 """
31- Manage a secret incident (assign, unassign, resolve, ignore, reopen).
27+ Perform lifecycle management actions on a secret incident.
28+
29+ This tool allows you to change the state of a secret incident through various actions:
30+ - 'unassign': Remove the assigned member from an incident (useful when reassigning or leaving unassigned)
31+ - 'resolve': Mark an incident as resolved (typically after the secret has been rotated/revoked)
32+ - 'ignore': Mark an incident as ignored with a reason (test_credential, false_positive, low_risk, or invalid)
33+ - 'reopen': Reopen a previously resolved or ignored incident
34+
35+ Note: To assign an incident to a member, use the dedicated 'assign_incident' tool instead.
3236
3337 Args:
34- params: ManageIncidentParams model containing incident management configuration
38+ params: ManageIncidentParams containing:
39+ - incident_id: The ID of the incident to manage
40+ - action: The lifecycle action to perform (unassign, resolve, ignore, or reopen)
41+ - ignore_reason: Required when action is 'ignore'. One of: test_credential, false_positive, low_risk, invalid
3542
3643 Returns:
37- Updated incident data
44+ Dictionary containing the updated incident data from the API
45+
46+ Raises:
47+ ToolError: If the action fails or if an invalid action is provided
3848 """
3949 client = get_client ()
4050 logger .debug (f"Managing incident { params .incident_id } with action: { params .action } " )
4151
4252 try :
43- # Make the API call
44- result = await client .manage_incident (
45- incident_id = params .incident_id ,
46- action = params .action ,
47- assignee_id = params .assignee_id ,
48- ignore_reason = params .ignore_reason ,
49- mine = params .mine ,
50- )
51-
52- logger .debug (f"Managed incident { params .incident_id } " )
53+ # Route the action to the appropriate client method
54+ if params .action == "unassign" :
55+ result = await client .unassign_incident (incident_id = str (params .incident_id ))
56+
57+ elif params .action == "resolve" :
58+ result = await client .resolve_incident (incident_id = str (params .incident_id ))
59+
60+ elif params .action == "ignore" :
61+ result = await client .ignore_incident (
62+ incident_id = str (params .incident_id ), ignore_reason = params .ignore_reason
63+ )
64+
65+ elif params .action == "reopen" :
66+ result = await client .reopen_incident (incident_id = str (params .incident_id ))
67+
68+ else :
69+ raise ToolError (f"Unknown action: { params .action } " )
70+
71+ logger .debug (f"Successfully managed incident { params .incident_id } with action: { params .action } " )
5372 return result
73+ except ToolError :
74+ raise
5475 except Exception as e :
5576 logger .error (f"Error managing incident: { str (e )} " )
5677 raise ToolError (f"Error: { str (e )} " )
@@ -77,7 +98,7 @@ async def update_incident_status(params: UpdateIncidentStatusParams) -> dict[str
7798 logger .debug (f"Updating incident { params .incident_id } status to { params .status } " )
7899
79100 try :
80- result = await client .update_incident_status (incident_id = params .incident_id , status = params .status )
101+ result = await client .update_incident (incident_id = str ( params .incident_id ) , status = params .status )
81102 logger .debug (f"Updated incident { params .incident_id } status to { params .status } " )
82103 return result
83104 except Exception as e :
0 commit comments