Skip to main content
Glama
kornbed

Jira MCP Server for Cursor

by kornbed

list_tickets

Retrieve Jira tickets assigned to you using optional JQL queries to filter results directly within your editor.

Instructions

List Jira tickets assigned to you

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jqlNoOptional JQL query to filter tickets

Implementation Reference

  • The handler function for the 'list_tickets' tool. It validates Jira configuration, executes a JQL query (defaulting to tickets assigned to current user), fetches issues via Jira API, formats them as key: summary (status), and returns as text content.
    async ({ jql }: { jql?: string }) => {
      const configError = validateJiraConfig();
      if (configError) {
        return {
          content: [{ type: "text", text: `Configuration error: ${configError}` }],
        };
      }
    
      try {
        const query = jql || 'assignee = currentUser() ORDER BY updated DESC';
        const tickets = await jira.issueSearch.searchForIssuesUsingJql({ jql: query });
        
        if (!tickets.issues || tickets.issues.length === 0) {
          return {
            content: [{ type: "text", text: "No tickets found" }],
          };
        }
    
        const formattedTickets = tickets.issues.map((issue) => {
          const summary = issue.fields?.summary || 'No summary';
          const status = issue.fields?.status?.name || 'Unknown status';
          return `${issue.key}: ${summary} (${status})`;
        }).join('\n');
    
        return {
          content: [{ type: "text", text: formattedTickets }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to fetch tickets: ${(error as Error).message}` }],
        };
      }
    }
  • Input schema for the 'list_tickets' tool, defining an optional 'jql' parameter using Zod for validation.
      jql: z.string().optional().describe("Optional JQL query to filter tickets"),
    },
  • src/server.ts:118-157 (registration)
    Registration of the 'list_tickets' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "list_tickets",
      "List Jira tickets assigned to you",
      {
        jql: z.string().optional().describe("Optional JQL query to filter tickets"),
      },
      async ({ jql }: { jql?: string }) => {
        const configError = validateJiraConfig();
        if (configError) {
          return {
            content: [{ type: "text", text: `Configuration error: ${configError}` }],
          };
        }
    
        try {
          const query = jql || 'assignee = currentUser() ORDER BY updated DESC';
          const tickets = await jira.issueSearch.searchForIssuesUsingJql({ jql: query });
          
          if (!tickets.issues || tickets.issues.length === 0) {
            return {
              content: [{ type: "text", text: "No tickets found" }],
            };
          }
    
          const formattedTickets = tickets.issues.map((issue) => {
            const summary = issue.fields?.summary || 'No summary';
            const status = issue.fields?.status?.name || 'Unknown status';
            return `${issue.key}: ${summary} (${status})`;
          }).join('\n');
    
          return {
            content: [{ type: "text", text: formattedTickets }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Failed to fetch tickets: ${(error as Error).message}` }],
          };
        }
      }
    );
  • Helper function to validate Jira configuration environment variables, called at the start of the list_tickets handler.
    function validateJiraConfig(): string | null {
      if (!process.env.JIRA_HOST) return "JIRA_HOST environment variable is not set";
      if (!process.env.JIRA_EMAIL) return "JIRA_EMAIL environment variable is not set";
      if (!process.env.JIRA_API_TOKEN) return "JIRA_API_TOKEN environment variable is not set";
      return null;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations provided, so description must bear the burden. It only mentions listing assigned tickets, omitting details such as pagination, sorting, or behavior when no tickets exist. The 'list' nature suggests read-only, but this is implicit.

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?

Single concise sentence with no extraneous information. Every word serves its purpose.

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

Completeness3/5

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

Given the simple nature (one optional parameter, no output schema), the description is minimally adequate. However, it lacks completeness in terms of expected behavior and differentiation from similar tools.

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

Parameters3/5

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

The only parameter 'jql' is already fully described in the schema (coverage 100%). The description adds no additional meaning or context beyond what the schema provides.

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?

Description clearly states it lists tickets assigned to the user, implying a default filter. However, it does not distinguish from sibling tools like search_tickets or get_board_issues, which may have overlapping functionality.

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?

No guidance on when to use this tool versus alternatives like search_tickets or get_project_issues. The description simply states what it does without context for selection.

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