@@ -55,10 +55,9 @@ func previousWeek() string {
55
55
// ListAuditsOfUser creates a tool for listing the audit trail.
56
56
func ListUserAuditTrailTool (config * config.Config , auditClient * client.AuditService ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
57
57
return mcp .NewTool ("list_user_audits" ,
58
- mcp .WithDescription ("List the audit trail of the user." ),
59
- mcp .WithString ("user_id" ,
60
- mcp .Required (),
61
- mcp .Description ("The user id(emailId) used to retrieve the audit trail." ),
58
+ mcp .WithDescription ("List the audit trail." ),
59
+ mcp .WithString ("user_id_list" ,
60
+ mcp .Description ("Enter one or more user email IDs (comma-separated) to filter the audit trail; leave blank to include all users." ),
62
61
),
63
62
mcp .WithString ("start_time" ,
64
63
mcp .Description ("Optional start time in ISO 8601 format (e.g., '2025-07-10T08:00:00Z')" ),
@@ -68,11 +67,24 @@ func ListUserAuditTrailTool(config *config.Config, auditClient *client.AuditServ
68
67
mcp .Description ("Optional end time in ISO 8601 format (e.g., '2025-07-10T08:00:00Z')" ),
69
68
mcp .DefaultString (getCurrentTime ()),
70
69
),
70
+ mcp .WithString ("actions" ,
71
+ mcp .Description ("Optional actions to filter by. For multiple actions, use comma-separated values." ),
72
+ mcp .Enum ("CREATE" , "UPDATE" , "RESTORE" , "DELETE" , "FORCE_DELETE" , "UPSERT" , "INVITE" , "RESEND_INVITE" , "REVOKE_INVITE" ,
73
+ "ADD_COLLABORATOR" , "REMOVE_COLLABORATOR" , "CREATE_TOKEN" , "REVOKE_TOKEN" , "LOGIN" , "LOGIN2FA" , "UNSUCCESSFUL_LOGIN" ,
74
+ "ADD_MEMBERSHIP" , "REMOVE_MEMBERSHIP" , "ERROR_BUDGET_RESET" , "START" , "END" , "STAGE_START" , "STAGE_END" , "PAUSE" , "RESUME" , "ABORT" , "TIMEOUT" , "SIGNED_EULA" ,
75
+ "ROLE_ASSIGNMENT_CREATED" , "ROLE_ASSIGNMENT_UPDATED" , "ROLE_ASSIGNMENT_DELETED" , "MOVE" , "ENABLED" , "DISABLED" , "DISMISS_ANOMALY" , "RERUN" , "BYPASS" , "STABLE_VERSION_CHANGED" ,
76
+ "SYNC_START" , "START_IMPERSONATION" , "END_IMPERSONATION" , "MOVE_TO_GIT" , "FREEZE_BYPASS" , "EXPIRED" , "FORCE_PUSH" ),
77
+ ),
71
78
WithScope (config , false ),
72
79
WithPagination (),
73
80
),
74
81
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
75
- userID , err := requiredParam [string ](request , "user_id" )
82
+ userIDList , err := OptionalParam [string ](request , "user_id_list" )
83
+ if err != nil {
84
+ return mcp .NewToolResultError (err .Error ()), nil
85
+ }
86
+
87
+ actionsList , err := OptionalParam [string ](request , "actions" )
76
88
if err != nil {
77
89
return mcp .NewToolResultError (err .Error ()), nil
78
90
}
@@ -96,7 +108,7 @@ func ListUserAuditTrailTool(config *config.Config, auditClient *client.AuditServ
96
108
startTimeMilliseconds := convertDateToMilliseconds (startTime )
97
109
endTimeMilliseconds := convertDateToMilliseconds (endTime )
98
110
99
- data , err := auditClient .ListUserAuditTrail (ctx , scope , userID , page , size , startTimeMilliseconds , endTimeMilliseconds , nil )
111
+ data , err := auditClient .ListUserAuditTrail (ctx , scope , userIDList , actionsList , page , size , startTimeMilliseconds , endTimeMilliseconds , nil )
100
112
if err != nil {
101
113
return nil , fmt .Errorf ("failed to list the audit logs: %w" , err )
102
114
}
0 commit comments