Skip to content

Commit 3f5f2b1

Browse files
committed
Add timeframe parameter to list_jira_issues function
- Added timeframe parameter with default value of 30 days - Filters issues by Created, Updated, or ResolutionDate within timeframe - Updated function signature and docstring - Added timeframe to filters_applied response - Assisted by cursor
1 parent dd15952 commit 3f5f2b1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/tools.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ async def list_jira_issues(
5252
status: Optional[str] = None,
5353
priority: Optional[str] = None,
5454
limit: int = 50,
55-
search_text: Optional[str] = None
55+
search_text: Optional[str] = None,
56+
timeframe: int = 30
5657
) -> Dict[str, Any]:
5758
"""
5859
@@ -63,6 +64,7 @@ async def list_jira_issues(
6364
priority: Filter by priority ID
6465
limit: Maximum number of issues to return (default: 50)
6566
search_text: Search in summary and description fields
67+
timeframe: Filter issues updated/created/resolved within last N days (default: 30)
6668
6769
Returns:
6870
Dictionary containing issues list and metadata
@@ -92,6 +94,15 @@ async def list_jira_issues(
9294
search_condition = f"(LOWER(SUMMARY) LIKE '%{sanitize_sql_value(search_text.lower())}%' OR LOWER(DESCRIPTION) LIKE '%{sanitize_sql_value(search_text.lower())}%')"
9395
sql_conditions.append(search_condition)
9496

97+
# Add timeframe filter - check if any of the dates are within the specified timeframe
98+
if timeframe > 0:
99+
timeframe_condition = f"""(
100+
CREATED >= CURRENT_DATE() - INTERVAL '{timeframe} DAYS'
101+
OR UPDATED >= CURRENT_DATE() - INTERVAL '{timeframe} DAYS'
102+
OR RESOLUTIONDATE >= CURRENT_DATE() - INTERVAL '{timeframe} DAYS'
103+
)"""
104+
sql_conditions.append(timeframe_condition)
105+
95106
where_clause = ""
96107
if sql_conditions:
97108
where_clause = "WHERE " + " AND ".join(sql_conditions)
@@ -171,6 +182,7 @@ async def list_jira_issues(
171182
"status": status,
172183
"priority": priority,
173184
"search_text": search_text,
185+
"timeframe": timeframe,
174186
"limit": limit
175187
}
176188
}

0 commit comments

Comments
 (0)