Skip to main content
Glama
yuezheng2006

Personal JIRA MCP

by yuezheng2006

create_issue

Create JIRA issues directly from AI assistants by specifying project key, summary, and optional details like description, issue type, and assignee.

Instructions

创建JIRA问题

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_keyYes
summaryYes
descriptionNo
issue_typeNoTask
priorityNo
assigneeNo
labelsNo

Implementation Reference

  • The create_issue tool handler, registered via @mcp.tool decorator. Constructs JIRA issue fields based on input parameters and uses the JIRA client to create the issue, then formats and returns the result.
    @mcp.tool(
        description="创建JIRA问题",
    )
    def create_issue(
        project_key: str,
        summary: str,
        description: str = "",
        issue_type: str = "Task",
        priority: Optional[str] = None,
        assignee: Optional[str] = None,
        labels: Optional[List[str]] = None,
    ) -> Dict[str, Any]:
        """创建JIRA问题.
        
        Args:
            project_key: 项目键
            summary: 问题概要
            description: 问题描述
            issue_type: 问题类型
            priority: 优先级
            assignee: 经办人
            labels: 标签列表
        
        Returns:
            Dict[str, Any]: 创建的问题详情
        """
        logger.info(f"创建问题: project={project_key}, summary={summary}")
        
        try:
            # 构建问题字段
            fields = {
                "project": {"key": project_key},
                "summary": summary,
                "issuetype": {"name": issue_type},
            }
            
            if description:
                fields["description"] = description
                
            if priority:
                fields["priority"] = {"name": priority}
                
            if assignee:
                fields["assignee"] = {"name": assignee}
                
            if labels:
                fields["labels"] = labels
            
            # 创建问题
            client = get_jira_client()
            issue = client.create_issue(fields=fields)
            return format_issue(issue)
        except Exception as e:
            logger.error(f"创建问题失败: {str(e)}")
            return {"error": str(e)}
  • Helper function used by create_issue to format the created JIRA issue into a JSON-friendly dictionary, including various fields like status, project, assignee, attachments, etc.
    def format_issue(issue) -> Dict[str, Any]:
        """格式化JIRA问题为JSON友好格式."""
        fields = issue.fields
        
        result = {
            "id": issue.id,
            "key": issue.key,
            "self": issue.self,
            "summary": fields.summary,
            "description": fields.description or "",
            "status": {
                "id": fields.status.id,
                "name": fields.status.name,
                "description": fields.status.description,
            },
            "project": {
                "id": fields.project.id,
                "key": fields.project.key,
                "name": fields.project.name,
            },
            "created": fields.created,
            "updated": fields.updated,
        }
        
        # 添加可选字段
        if hasattr(fields, "assignee") and fields.assignee:
            result["assignee"] = {
                "name": fields.assignee.name,
                "display_name": fields.assignee.displayName,
                "email": getattr(fields.assignee, "emailAddress", ""),
            }
        
        if hasattr(fields, "reporter") and fields.reporter:
            result["reporter"] = {
                "name": fields.reporter.name,
                "display_name": fields.reporter.displayName,
                "email": getattr(fields.reporter, "emailAddress", ""),
            }
        
        if hasattr(fields, "issuetype") and fields.issuetype:
            result["issue_type"] = {
                "id": fields.issuetype.id,
                "name": fields.issuetype.name,
                "description": fields.issuetype.description,
            }
        
        if hasattr(fields, "priority") and fields.priority:
            result["priority"] = {
                "id": fields.priority.id,
                "name": fields.priority.name,
            }
        
        if hasattr(fields, "components") and fields.components:
            result["components"] = [
                {"id": c.id, "name": c.name} for c in fields.components
            ]
        
        if hasattr(fields, "labels") and fields.labels:
            result["labels"] = fields.labels
        
        # 处理附件 - JIRA API 使用 "attachment" 字段
        if hasattr(fields, "attachment") and fields.attachment:
            result["attachments"] = [
                {
                    "id": attachment.id,
                    "filename": attachment.filename,
                    "size": attachment.size,
                    "content_type": attachment.mimeType,
                    "created": attachment.created,
                    "url": attachment.content
                }
                for attachment in fields.attachment
            ]
        
        # 获取自定义字段
        for field_name in dir(fields):
            if field_name.startswith("customfield_"):
                value = getattr(fields, field_name)
                if value is not None:
                    result[field_name] = value
        
        return result
  • Helper function to lazily initialize and return the JIRA client instance, used in create_issue.
    def get_jira_client() -> JIRA:
        """获取JIRA客户端实例."""
        global jira_client
        if jira_client is None:
            auth = get_jira_auth()
            jira_client = JIRA(server=jira_settings.server_url, basic_auth=auth)
        return jira_client
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. '创建JIRA问题' implies a write operation but doesn't disclose behavioral traits like whether this requires authentication, what happens on success/failure, rate limits, or side effects. It mentions nothing about the creation process, validation rules, or what the tool returns. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single phrase. While this is efficient, it's arguably under-specified rather than appropriately concise. Every word earns its place, but the description lacks necessary detail. It's front-loaded with the core action but doesn't provide needed context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a mutation tool with 7 parameters, 0% schema description coverage, no annotations, and no output schema. The description is completely inadequate - it doesn't explain what the tool does beyond the name, provides no parameter guidance, no behavioral context, and no usage guidelines. For a complex creation tool, this leaves the agent guessing about everything from required fields to expected outcomes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The description provides no information about any of the 7 parameters. It doesn't explain what 'project_key', 'summary', or other fields mean, their formats, or constraints. The description adds zero value beyond what the bare schema provides, failing to compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '创建JIRA问题' (Create JIRA issue) states the basic action but is tautological with the tool name 'create_issue'. It doesn't specify what kind of issue is created or differentiate from siblings like 'update_issue' beyond the obvious verb difference. The purpose is clear but lacks specificity about the resource being created.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'create_issue' over 'update_issue' or 'search_issues', nor does it specify prerequisites like needing a valid project key or appropriate permissions. There's no context about appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuezheng2006/mcp-server-jira'

If you have feedback or need assistance with the MCP directory API, please join our Discord server