Fix: List Incidents Severity Filter and Enhanced Tool Documentation#13
Open
apetti1920 wants to merge 6 commits intoincident-io:mainfrom
Open
Fix: List Incidents Severity Filter and Enhanced Tool Documentation#13apetti1920 wants to merge 6 commits intoincident-io:mainfrom
apetti1920 wants to merge 6 commits intoincident-io:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug where the
list_incidentstool's severity filter was not working, and significantly enhances the tool's documentation to guide proper usage, particularly around severity filtering workflows.Problem Statement
Issue 1: Severity Filter Not Working
The
list_incidentstool was accepting aseverityparameter but not actually filtering incidents by severity. When attempting to filter by severity name (e.g.,["sev_1"]), all incidents within the page_size limit were being returned instead of only those matching the specified severity.Root Cause: The implementation was using the incorrect API parameter name. The code was sending
severityas the query parameter, but the incident.io API v2 requiresseverity[one_of]for filtering by specific severity IDs.Issue 2: Insufficient Tool Documentation
The tool description was too brief (
"List incidents from incident.io with optional filters") and didn't provide adequate guidance on:list_severitiesfirst to discover valid IDsThis lack of clarity could lead to confusion, especially for AI agents that rely on tool descriptions for proper usage.
Changes Made
1. Core Bug Fix: API Parameter Correction
File:
/internal/incidentio/incidents.goFixed the severity filter to use the correct incident.io API parameter:
Why
severity[one_of]?According to the incident.io API v2 documentation, the list incidents endpoint uses structured parameter names with operators:
severity[one_of]- Filters incidents matching ANY of the provided severity IDs (OR logic)severity[lte]- Filters incidents with severity less than or equal to specified valueThe
[one_of]operator is essential because:Using just
severitywas ignored by the API, resulting in no filtering.2. Enhanced Tool Description
File:
/internal/tools/incidents.go-ListIncidentsTool.Description()Replaced the brief description with a comprehensive multi-section guide:
New Description Structure:
Key Additions:
Why This Matters:
list_severitiesBEFORE using severity filters3. Enhanced Parameter Descriptions
File:
/internal/tools/incidents.go-ListIncidentsTool.InputSchema()Updated all three parameter descriptions with detailed guidance:
Rationale:
list_severitiestool first