Skip to main content
Glama

search_jira_issues

Search for Jira issues using JQL queries to find specific tickets, track project status, or monitor team progress within JIRA projects.

Instructions

Search for Jira issues using JQL (Jira Query Language) syntax

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
site_aliasNo
basic_onlyNo

Implementation Reference

  • Registration of the MCP tool 'search_jira_issues' using the @mcp_server.tool decorator, specifying name and description.
    @mcp_server.tool(
        name="search_jira_issues",
        description="Search for Jira issues using JQL (Jira Query Language) syntax",
    )
  • Main handler function for the 'search_jira_issues' tool. Prepares search parameters, instantiates JiraClient based on site config, performs the search, formats the results (basic or detailed view), and returns formatted text content. Handles errors gracefully.
    def search_jira_issues_tool(
        query: str,
        site_alias: str = None,
        basic_only: bool = False
    ) -> types.TextContent:
        """
        Search for JIRA issues using JQL syntax.
        
        Args:
            query: JQL query string (e.g., "project = ABC AND status = 'In Progress'")
            site_alias: Optional site alias for multi-site configurations
            basic_only: If True, return only key, summary, and description for each issue (default: False)
        """
        logger.debug(
            f"search_jira_issues_tool received: query='{query}', site_alias={site_alias}, basic_only={basic_only}"
        )
        try:
            # 1. Get the prepared search data (using default max_results)
            search_data = jira_tools.search_jira_issues_implementation(
                query=query,
                site_alias=site_alias,
                max_results=50,  # Default value similar to conduit
                basic_only=basic_only
            )
            logger.debug(f"Search data prepared by implementation: {search_data}")
    
            # 2. Get active JIRA site configuration
            active_site_config_dict = get_active_jira_config(alias=site_alias, server_config=config)
            logger.debug(f"Using JIRA site config for alias '{site_alias}'")
    
            # 3. Instantiate JiraClient with the specific site config
            jira_client = JiraClient(site_config=active_site_config_dict)
            logger.debug("JiraClient instantiated.")
    
            # 4. Call the JiraClient to search for issues
            search_results = jira_client.search(
                jql_query=search_data["jql_query"],
                max_results=search_data["max_results"],
                basic_only=search_data["basic_only"]
            )
            logger.info(f"JIRA search found {len(search_results)} issues")
    
            # Format results based on basic_only mode
            if not search_results:
                response_text = f"No issues found for query: {query}"
            else:
                formatted_results = []
                for issue in search_results:
                    if search_data["basic_only"]:
                        # Basic mode: show only key, summary, and description
                        issue_lines = [
                            f"**{issue['key']}**: {issue['summary']}"
                        ]
                        
                        # Include description if available
                        if issue.get('description'):
                            issue_lines.append(f"  - **Description**: {issue['description']}")
                    else:
                        # Full mode: show all available information
                        issue_lines = [
                            f"**{issue['key']}**: {issue['summary']}",
                            f"  - **Project**: {issue['project'] or 'N/A'}",
                            f"  - **Type**: {issue['issue_type'] or 'N/A'}",
                            f"  - **Status**: {issue['status'] or 'N/A'}",
                            f"  - **Priority**: {issue['priority'] or 'N/A'}",
                            f"  - **Assignee**: {issue['assignee'] or 'Unassigned'}",
                            f"  - **Created**: {issue['created'] or 'N/A'}",
                            f"  - **Updated**: {issue['updated'] or 'N/A'}",
                            f"  - **URL**: {issue['url']}"
                        ]
                        
                        # Include description if available
                        if issue.get('description'):
                            issue_lines.append(f"  - **Description**: {issue['description']}")
                        
                        # Include issue links (links to other JIRA issues)
                        if issue.get('issue_links'):
                            issue_lines.append(f"  - **Issue Links**:")
                            for link in issue['issue_links']:
                                if link.get('direction') == 'inward':
                                    issue_lines.append(f"    - {link['inward']}: {link['issue_key']} - {link['issue_summary']} ({link['issue_status']})")
                                else:
                                    issue_lines.append(f"    - {link['outward']}: {link['issue_key']} - {link['issue_summary']} ({link['issue_status']})")
                        
                        # Include remote links if available
                        if issue.get('remote_links'):
                            issue_lines.append(f"  - **Remote Links**:")
                            for link in issue['remote_links']:
                                if link.get('url') and link.get('title'):
                                    issue_lines.append(f"    - [{link['title']}]({link['url']})")
                        
                        # Include comments if available
                        if issue.get('comments'):
                            issue_lines.append(f"  - **Comments** ({len(issue['comments'])} total):")
                            # Show first 3 comments to avoid too much output
                            for comment in issue['comments'][:3]:
                                issue_lines.append(f"    - **{comment['author']}** ({comment['created']}):")
                                # Truncate long comments
                                body = comment['body'][:200] + "..." if len(comment['body']) > 200 else comment['body']
                                issue_lines.append(f"      {body}")
                            if len(issue['comments']) > 3:
                                issue_lines.append(f"    - ... and {len(issue['comments']) - 3} more comments")
                        
                        # Include worklogs if available
                        if issue.get('worklogs'):
                            total_seconds = sum(w.get('timeSpentSeconds', 0) for w in issue['worklogs'])
                            total_hours = total_seconds / 3600
                            issue_lines.append(f"  - **Worklogs** ({len(issue['worklogs'])} entries, {total_hours:.1f} hours total)")
                    
                    formatted_results.append("\n".join(issue_lines))
                
                response_text = f"Found {len(search_results)} issues:\n\n" + "\n\n".join(formatted_results)
    
            return types.TextContent(
                type="text",
                text=response_text,
                format="text/plain"
            )
        except JiraServiceError as e:
            logger.error(f"JiraServiceError in search_jira_issues_tool: {e}", exc_info=True)
            return types.TextContent(
                type="text",
                text=f"Error searching JIRA issues: {e}",
                format="text/plain"
            )
        except Exception as e:
            logger.error(f"Unexpected error in search_jira_issues_tool: {e}", exc_info=True)
            return types.TextContent(
                type="text",
                text=f"An unexpected error occurred: {e}",
                format="text/plain"
            )
  • Helper function that prepares the search parameters (JQL query, max_results, basic_only) as a dictionary for use by the JiraClient.search method. Does not perform the actual search.
    def search_jira_issues_implementation(
        query: str,
        site_alias: Optional[str] = None,
        max_results: int = 50,
        basic_only: bool = False
    ) -> Dict[str, Any]:
        """
        Implementation for searching JIRA issues using JQL.
        Returns the query and parameters for the JiraClient.search call.
        The site_alias is used by the calling layer for configuration resolution.
        
        Args:
            query: JQL query string
            site_alias: Optional site alias for multi-site configurations
            max_results: Maximum number of results to return (default: 50)
            basic_only: If True, return only key, summary, and description for each issue (default: False)
        """
        try:
            # Prepare search parameters for the client
            search_data = {
                "jql_query": query,
                "max_results": max_results,
                "basic_only": basic_only
            }
            
            # Note: site_alias is used by the MCP server layer for configuration resolution
            # and doesn't need to be included in the returned data
            
            return search_data
    
        except JiraServiceError as e:
            # Re-raise JiraServiceError to be handled by the MCP framework
            raise
        except Exception as e:
            # Catch any other unexpected errors and wrap them in JiraServiceError
            raise JiraServiceError(f"Unexpected error occurred in search_jira_issues_implementation: {e}") 
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions JQL syntax but doesn't cover critical aspects like authentication needs, rate limits, pagination behavior, or error handling. For a search tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration. Every word earns its place, making it highly concise.

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 of a Jira search tool with 3 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on parameter meanings, behavioral traits, and return values, making it inadequate for the agent to use the tool effectively without additional context.

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 for undocumented parameters. It only mentions the 'query' parameter indirectly via JQL, leaving 'site_alias' and 'basic_only' completely unexplained. The description adds minimal value beyond the schema, failing to adequately address the coverage gap.

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

Purpose4/5

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

The description clearly states the verb ('Search for') and resource ('Jira issues'), specifying the method ('using JQL syntax'). It distinguishes from siblings like create_jira_issue and update_jira_issue by focusing on retrieval rather than modification. However, it doesn't explicitly differentiate from potential other search tools, keeping it at 4 instead of 5.

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. It doesn't mention prerequisites, context for JQL usage, or comparisons to other tools like echo. This leaves the agent without explicit usage instructions, scoring a 2 for minimal guidance.

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/codingthefuturewithai/mcp_jira'

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