Commit 36b31d3a authored by MD. SHAHIDUL ISLAM's avatar MD. SHAHIDUL ISLAM

feat: Add `assign_issue` tool and include `JIRA_QA_TESTER` in the context.

parent 65093f9d
...@@ -33,6 +33,7 @@ JIRA_SERVER = os.environ.get("JIRA_SERVER") ...@@ -33,6 +33,7 @@ JIRA_SERVER = os.environ.get("JIRA_SERVER")
JIRA_USERNAME = os.environ.get("JIRA_USERNAME") JIRA_USERNAME = os.environ.get("JIRA_USERNAME")
JIRA_PASSWORD = os.environ.get("JIRA_PASSWORD") JIRA_PASSWORD = os.environ.get("JIRA_PASSWORD")
ACTIVE_PROJECT = os.environ.get("JIRA_DEFAULT_PROJECT") ACTIVE_PROJECT = os.environ.get("JIRA_DEFAULT_PROJECT")
JIRA_QA_TESTER = os.environ.get("JIRA_QA_TESTER")
BASE_URL = JIRA_SERVER.rstrip("/") if JIRA_SERVER else "" BASE_URL = JIRA_SERVER.rstrip("/") if JIRA_SERVER else ""
...@@ -339,6 +340,18 @@ def assign_issue_to_me(issue_key: str) -> str: ...@@ -339,6 +340,18 @@ def assign_issue_to_me(issue_key: str) -> str:
except Exception as e: except Exception as e:
return f"Error assigning issue {issue_key}: {str(e)}" return f"Error assigning issue {issue_key}: {str(e)}"
@mcp.tool()
def assign_issue(issue_key: str, assignee_username: str) -> str:
"""Assigns the specified issue to the given username (e.g. 'samia').
IMPORTANT: You must explicitly ask the user for confirmation before executing this tool.
"""
jira = _get_jira()
try:
jira.assign_issue(issue_key, assignee_username)
return f"Successfully assigned issue [{issue_key}]({BASE_URL}/browse/{issue_key}) to {assignee_username}."
except Exception as e:
return f"Error assigning issue {issue_key}: {str(e)}"
@mcp.tool() @mcp.tool()
def transition_issue(issue_key: str, transition_name: str) -> str: def transition_issue(issue_key: str, transition_name: str) -> str:
"""Transitions an issue to a new status by name (e.g., 'Ready for QA'). """Transitions an issue to a new status by name (e.g., 'Ready for QA').
...@@ -453,7 +466,7 @@ def get_jira_context() -> str: ...@@ -453,7 +466,7 @@ def get_jira_context() -> str:
"""Returns a hardcoded list of known Project Names -> Project Keys, and known User Names. """Returns a hardcoded list of known Project Names -> Project Keys, and known User Names.
Use this to look up a project key if the user only provides the project name, or to see the correct spellings of active users. Use this to look up a project key if the user only provides the project name, or to see the correct spellings of active users.
""" """
return """ context_str = """
Known Projects: Known Projects:
- e-GP Bhutan Phase III (Key: EGPBIII) - e-GP Bhutan Phase III (Key: EGPBIII)
- eGPBhutan-RnD (Key: RND) - eGPBhutan-RnD (Key: RND)
...@@ -473,6 +486,10 @@ Active Users: ...@@ -473,6 +486,10 @@ Active Users:
- Asif Anam - Asif Anam
- Ayasha Hossain Jui - Ayasha Hossain Jui
""" """
if JIRA_QA_TESTER:
context_str += f"\nConfigured QA Tester for this environment: {JIRA_QA_TESTER}\n"
return context_str
if __name__ == "__main__": if __name__ == "__main__":
# Start the FastMCP server # Start the FastMCP server
......
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