Commit 0f462894 authored by MD. SHAHIDUL ISLAM's avatar MD. SHAHIDUL ISLAM

feat: Add comprehensive README documentation and enhance…

feat: Add comprehensive README documentation and enhance `create_issue_with_subtasks` to support both Story and Task parent types.
parent a66fca11
......@@ -133,8 +133,8 @@ def create_issue(summary: str, description: str, project_key: str = None, issue_
return f"Error creating issue: {str(e)}"
@mcp.tool()
def create_story_with_subtasks(summary: str, description: str, subtasks: List[str], project_key: str = None) -> str:
"""Creates a new Jira Story along with a list of Sub-tasks. If project_key is not provided, uses the active project."""
def create_issue_with_subtasks(summary: str, description: str, subtasks: List[str], project_key: str = None, parent_issue_type: str = "Story") -> str:
"""Creates a new Jira Issue (Story or Task) along with a list of Sub-tasks. If project_key is not provided, uses the active project."""
global ACTIVE_PROJECT
jira = _get_jira()
......@@ -143,31 +143,31 @@ def create_story_with_subtasks(summary: str, description: str, subtasks: List[st
return "Error: No project_key provided and no active project is set."
try:
# 1. Create the parent Story
story_dict = {
# 1. Create the parent issue (Story or Task)
parent_dict = {
'project': {'key': target_project},
'summary': summary,
'description': description,
'issuetype': {'name': 'Story'},
'issuetype': {'name': parent_issue_type},
}
story_issue = jira.create_issue(fields=story_dict)
parent_issue = jira.create_issue(fields=parent_dict)
# 2. Create the subtasks linked to the parent Story
# 2. Create the subtasks linked to the parent issue
created_subtasks = []
for st_summary in subtasks:
subtask_dict = {
'project': {'key': target_project},
'summary': st_summary,
'issuetype': {'name': 'Sub-task'},
'parent': {'id': story_issue.key}
'parent': {'id': parent_issue.key}
}
st_issue = jira.create_issue(fields=subtask_dict)
created_subtasks.append(st_issue.key)
subtasks_str = ", ".join(created_subtasks)
return f"Successfully created Story {story_issue.key} with subtasks: {subtasks_str}. URL: {JIRA_SERVER}/browse/{story_issue.key}"
return f"Successfully created {parent_issue_type} {parent_issue.key} with subtasks: {subtasks_str}. URL: {JIRA_SERVER}/browse/{parent_issue.key}"
except Exception as e:
return f"Error creating story with subtasks: {str(e)}"
return f"Error creating {parent_issue_type} with subtasks: {str(e)}"
@mcp.tool()
def assign_issue_to_me(issue_key: str) -> str:
......
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