Commit 37d0890e authored by MD. SHAHIDUL ISLAM's avatar MD. SHAHIDUL ISLAM

feat: Add `create_issue_advanced` MCP tool and initial README documentation for…

feat: Add `create_issue_advanced` MCP tool and initial README documentation for the Jira MCP server.
parent 0f462894
...@@ -132,6 +132,64 @@ def create_issue(summary: str, description: str, project_key: str = None, issue_ ...@@ -132,6 +132,64 @@ def create_issue(summary: str, description: str, project_key: str = None, issue_
except Exception as e: except Exception as e:
return f"Error creating issue: {str(e)}" return f"Error creating issue: {str(e)}"
@mcp.tool()
def create_issue_advanced(
summary: str,
description: str,
issue_type: str = "Bug",
project_key: str = None,
priority: str = None,
assignee: str = None,
components: List[str] = None,
labels: List[str] = None,
environment: str = None,
due_date: str = None,
original_estimate: str = None
) -> str:
"""Creates a Jira issue with advanced fields matched to the web interface.
Use this when you need to specify assignee, labels, components, or estimations.
"""
global ACTIVE_PROJECT
jira = _get_jira()
target_project = project_key or ACTIVE_PROJECT
if not target_project:
return "Error: No project_key provided and no active project is set."
try:
issue_dict = {
'project': {'key': target_project},
'summary': summary,
'description': description,
'issuetype': {'name': issue_type},
}
if priority:
issue_dict['priority'] = {'name': priority}
if assignee and assignee.lower() != 'automatic':
issue_dict['assignee'] = {'name': assignee}
if components:
issue_dict['components'] = [{'name': c} for c in components]
if labels:
issue_dict['labels'] = labels
if environment:
issue_dict['environment'] = environment
if due_date: # Format: YYYY-MM-DD
issue_dict['duedate'] = due_date
if original_estimate: # Format: e.g. '3w 4d 12h'
issue_dict['timetracking'] = {'originalEstimate': original_estimate}
new_issue = jira.create_issue(fields=issue_dict)
return f"Successfully created {issue_type} {new_issue.key}. URL: {JIRA_SERVER}/browse/{new_issue.key}"
except Exception as e:
return f"Error creating advanced issue: {str(e)}"
@mcp.tool() @mcp.tool()
def create_issue_with_subtasks(summary: str, description: str, subtasks: List[str], project_key: str = None, parent_issue_type: str = "Story") -> str: 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.""" """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."""
......
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