22
33import os
44import argparse
5+ import types
56from dotenv import load_dotenv
67from jira import JIRA
78from fastmcp import FastMCP
@@ -52,8 +53,8 @@ def to_markdown(obj):
5253 return '```json\n ' + json .dumps (obj , indent = 2 ) + '\n ```'
5354 elif hasattr (obj , 'raw' ):
5455 return '```json\n ' + json .dumps (obj .raw , indent = 2 ) + '\n ```'
55- elif isinstance (obj , list ):
56- return '\n ' .join ([ to_markdown (o ) for o in obj ] )
56+ elif isinstance (obj , list ) or isinstance ( obj , types . GeneratorType ) :
57+ return '\n ' .join (( to_markdown (o ) for o in obj ) )
5758 else :
5859 return str (obj )
5960
@@ -79,7 +80,7 @@ def simplify_issue(issue):
7980
8081 try :
8182 issues = jira_client .search_issues (jql , maxResults = max_results )
82- return to_markdown ([ simplify_issue (issue ) for issue in issues ] )
83+ return to_markdown (( simplify_issue (issue ) for issue in issues ) )
8384 except Exception as e :
8485 raise HTTPException (status_code = 400 , detail = f"JQL search failed: { e } " )
8586
@@ -306,7 +307,7 @@ def simplify_comment(comment):
306307 }
307308 try :
308309 issue = jira_client .issue (issue_key )
309- return to_markdown ([ simplify_comment (c ) for c in issue .fields .comment .comments ] )
310+ return to_markdown (( simplify_comment (c ) for c in issue .fields .comment .comments ) )
310311 except Exception as e :
311312 raise HTTPException (status_code = 400 , detail = f"Failed to get comments for { issue_key } : { e } " )
312313
0 commit comments