@@ -37,7 +37,12 @@ Returns complete incident information including:
3737- progress (optional): Filter by status - Triggered, Processing, Closed
3838- severity (optional): Filter by severity - Info, Warning, Critical
3939- channel_id (optional): Filter by collaboration space ID
40- - start_time, end_time (optional): Unix timestamp range (required if no incident_ids)
40+ - start_time, end_time (optional): Unix timestamp in seconds. Required if no incident_ids.
41+ **Time constraints:**
42+ - start_time must be less than end_time
43+ - Time range (end_time - start_time) must not exceed 31 days (2678400 seconds)
44+ - end_time must be within the data retention period (account-specific, typically 365 days)
45+ - If you get a time range error, use more recent timestamps (e.g., last 7-30 days from now)
4146- title (optional): Title keyword search
4247- limit (optional): Max results (default 20)
4348- include_alerts (optional): Include alerts preview (default true)
@@ -342,7 +347,7 @@ func (c *Client) fetchIncidentsByIDs(ctx context.Context, incidentIDs []string)
342347 defer func () { _ = resp .Body .Close () }()
343348
344349 if resp .StatusCode != http .StatusOK {
345- return nil , fmt . Errorf ( "API request failed with HTTP status %d" , resp . StatusCode )
350+ return nil , handleAPIError ( resp )
346351 }
347352
348353 var result struct {
@@ -392,7 +397,7 @@ func (c *Client) fetchIncidentsByFilters(ctx context.Context, progress, severity
392397 defer func () { _ = resp .Body .Close () }()
393398
394399 if resp .StatusCode != http .StatusOK {
395- return nil , fmt . Errorf ( "API request failed with HTTP status %d" , resp . StatusCode )
400+ return nil , handleAPIError ( resp )
396401 }
397402
398403 var result struct {
@@ -416,10 +421,10 @@ func (c *Client) fetchIncidentsByFilters(ctx context.Context, progress, severity
416421const createIncidentDescription = `Create a new incident in Flashduty.
417422
418423**Parameters:**
419- - title (required): Incident title
424+ - title (required): Incident title (3-200 characters)
420425- severity (required): Info, Warning, or Critical
421426- channel_id (optional): Collaboration space ID
422- - description (optional): Incident description
427+ - description (optional): Incident description (max 6144 characters)
423428- assigned_to (optional): Comma-separated person IDs to assign
424429
425430**Returns:**
@@ -500,14 +505,15 @@ const updateIncidentDescription = `Update an existing incident.
500505
501506**Parameters:**
502507- incident_id (required): Incident ID to update
503- - title (optional): New title
504- - description (optional): New description
508+ - title (optional): New title (3-200 characters)
509+ - description (optional): New description (max 6144 characters)
505510- severity (optional): New severity (Info, Warning, Critical)
506511- custom_fields (optional): JSON object of custom field updates, e.g. {"field_name": "value"}
507512
508513**Notes:**
509514- Only provided fields will be updated
510- - Use query_fields to discover available custom fields`
515+ - Use query_fields to discover available custom fields
516+ - Custom field names must match regexp: ^[a-z][a-z0-9_]*$`
511517
512518// UpdateIncident creates a tool to update an incident
513519func UpdateIncident (getClient GetFlashdutyClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
@@ -627,7 +633,7 @@ func (c *Client) updateIncidentField(ctx context.Context, incidentID, endpoint,
627633 defer func () { _ = resp .Body .Close () }()
628634
629635 if resp .StatusCode != http .StatusOK {
630- return fmt . Errorf ( "API request failed with HTTP status %d" , resp . StatusCode )
636+ return handleAPIError ( resp )
631637 }
632638
633639 var result FlashdutyResponse
@@ -655,7 +661,7 @@ func (c *Client) updateCustomField(ctx context.Context, incidentID, fieldName st
655661 defer func () { _ = resp .Body .Close () }()
656662
657663 if resp .StatusCode != http .StatusOK {
658- return fmt . Errorf ( "API request failed with HTTP status %d" , resp . StatusCode )
664+ return handleAPIError ( resp )
659665 }
660666
661667 var result FlashdutyResponse
@@ -713,7 +719,7 @@ func AckIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelpe
713719 defer func () { _ = resp .Body .Close () }()
714720
715721 if resp .StatusCode != http .StatusOK {
716- return mcp .NewToolResultError (fmt . Sprintf ( "API request failed with HTTP status %d" , resp . StatusCode )), nil
722+ return mcp .NewToolResultError (handleAPIError ( resp ). Error ( )), nil
717723 }
718724
719725 var result FlashdutyResponse
@@ -776,7 +782,7 @@ func CloseIncident(getClient GetFlashdutyClientFn, t translations.TranslationHel
776782 defer func () { _ = resp .Body .Close () }()
777783
778784 if resp .StatusCode != http .StatusOK {
779- return mcp .NewToolResultError (fmt . Sprintf ( "API request failed with HTTP status %d" , resp . StatusCode )), nil
785+ return mcp .NewToolResultError (handleAPIError ( resp ). Error ( )), nil
780786 }
781787
782788 var result FlashdutyResponse
@@ -847,7 +853,7 @@ func ListSimilarIncidents(getClient GetFlashdutyClientFn, t translations.Transla
847853 defer func () { _ = resp .Body .Close () }()
848854
849855 if resp .StatusCode != http .StatusOK {
850- return mcp .NewToolResultError (fmt . Sprintf ( "API request failed with HTTP status %d" , resp . StatusCode )), nil
856+ return mcp .NewToolResultError (handleAPIError ( resp ). Error ( )), nil
851857 }
852858
853859 var result struct {
0 commit comments