Commit 6e579894 authored by MD. SHAHIDUL ISLAM's avatar MD. SHAHIDUL ISLAM

feat: Add `get_multiple_issues_details` tool to retrieve information for multiple Jira issues.

parent b69cd95b
...@@ -112,6 +112,45 @@ def get_issue_details(issue_key: str) -> str: ...@@ -112,6 +112,45 @@ def get_issue_details(issue_key: str) -> str:
except Exception as e: except Exception as e:
return f"Error fetching issue {issue_key}: {str(e)}" return f"Error fetching issue {issue_key}: {str(e)}"
@mcp.tool()
def get_multiple_issues_details(issue_keys: List[str]) -> str:
"""Retrieves details for multiple specific issue IDs (e.g. ['PCM-131', 'PCM-132']) at once."""
jira = _get_jira()
try:
if not issue_keys:
return "No issue keys provided."
keys_str = ", ".join([f'"{k}"' for k in issue_keys])
jql = f"issuekey in ({keys_str})"
issues = jira.search_issues(jql, maxResults=len(issue_keys))
if not issues:
return "No issues found matching the provided keys."
result = []
for issue in issues:
assignee = issue.fields.assignee.displayName if issue.fields.assignee else "Unassigned"
description = issue.fields.description or "No description provided."
# Truncate description if it's too long
if len(description) > 200:
description = description[:197] + "..."
priority = issue.fields.priority.name if getattr(issue.fields, 'priority', None) else 'None'
details = [
f"Issue: [{issue.key}]({BASE_URL}/browse/{issue.key})",
f"Summary: {issue.fields.summary}",
f"Type: {issue.fields.issuetype.name} | Status: {issue.fields.status.name} | Priority: {priority}",
f"Assignee: {assignee}",
f"Description snippet: {description}",
"---"
]
result.append("\n".join(details))
return "\n".join(result)
except Exception as e:
return f"Error fetching multiple issues details: {str(e)}"
@mcp.tool() @mcp.tool()
def create_issue(summary: str, description: str, project_key: str = None, issue_type: str = "Task") -> str: def create_issue(summary: str, description: str, project_key: str = None, issue_type: str = "Task") -> str:
"""Creates a new Jira issue. If project_key is not provided, uses the active project.""" """Creates a new Jira issue. If project_key is not provided, uses the active project."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment