Skip to main content
Glama
yuezheng2006

Personal JIRA MCP

by yuezheng2006

search_issues

Search JIRA issues using JQL queries to find specific work items, filter results, and retrieve detailed information for project management.

Instructions

搜索JIRA问题列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jqlYes
max_resultsNo
start_atNo

Implementation Reference

  • The primary handler for the 'search_issues' MCP tool. Registered via @mcp.tool decorator with description. Takes JQL query, max_results, and start_at parameters. Uses JIRA client to search issues, formats them with format_issue helper, and returns a dictionary with total count and list of issues.
    @mcp.tool(
        description="搜索JIRA问题列表",
    )
    def search_issues(
        jql: str,
        max_results: int = 50,
        start_at: int = 0
    ) -> Dict[str, Any]:
        """搜索JIRA问题.
        
        Args:
            jql: JQL查询字符串
            max_results: 最大返回结果数
            start_at: 起始索引
        
        Returns:
            Dict[str, Any]: 搜索结果
        """
        logger.info(f"搜索问题: JQL={jql}, max_results={max_results}, start_at={start_at}")
        try:
            client = get_jira_client()
            issues = client.search_issues(jql_str=jql, maxResults=max_results, startAt=start_at)
            
            return {
                "total": issues.total,
                "issues": [format_issue(issue) for issue in issues],
                "start_at": start_at,
                "max_results": max_results,
            }
        except Exception as e:
            logger.error(f"搜索问题失败: {str(e)}")
            return {"error": str(e)}
  • Helper function used by search_issues to convert raw JIRA issue objects into structured JSON-friendly dictionaries, including fields like summary, status, project, assignee, attachments, and custom fields.
    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 for lazy initialization and retrieval of the global JIRA client instance, used by search_issues to perform the actual API calls.
    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 the full burden of behavioral disclosure. It mentions searching but doesn't describe key behaviors: whether this is a read-only operation, how results are returned (e.g., pagination via start_at and max_results), rate limits, authentication needs, or error handling. This is a significant gap for a search tool with no 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 a single, efficient phrase in Chinese ('搜索JIRA问题列表'), which is appropriately concise and front-loaded. There's no wasted verbiage, though it could benefit from slightly more detail given the lack of annotations and schema descriptions.

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

Completeness2/5

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

Given the complexity (a search tool with 3 parameters, no annotations, and no output schema), the description is incomplete. It doesn't explain the return format, error conditions, or how to interpret parameters like 'jql', leaving the agent with insufficient context to use the tool effectively beyond basic inference.

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 schema provides no parameter descriptions. The tool description adds no information about parameters beyond what's implied by the tool name (e.g., it doesn't explain what 'jql' is, how 'max_results' works, or what 'start_at' means). With 3 parameters and no compensation in the description, this is inadequate.

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

Purpose3/5

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

The description '搜索JIRA问题列表' (Search JIRA issue list) states a clear verb ('搜索' - search) and resource ('JIRA问题列表' - JIRA issue list), providing basic purpose. However, it doesn't distinguish this tool from sibling tools like 'getIssues' or 'get_issue', making it somewhat vague about its specific scope compared to alternatives.

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

Usage Guidelines2/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 like 'getIssues' or 'get_issue'. It lacks any context about prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name and parameters alone.

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