Skip to main content
Glama
kornbed

Jira MCP Server for Cursor

get_ticket

Retrieve details for a specific Jira ticket by entering its ID to view status, description, and other information directly within your editor.

Instructions

Get details of a specific Jira ticket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticketIdYesThe Jira ticket ID (e.g., PROJECT-123)

Implementation Reference

  • The main handler function for the 'get_ticket' tool. It validates configuration, fetches the ticket details from Jira API including summary, status, type, description (parsed from ADF), parent, and linked issues, then formats and returns them.
    async ({ ticketId }: { ticketId: string }) => {
      const configError = validateJiraConfig();
      if (configError) {
        return {
          content: [{ type: "text", text: `Configuration error: ${configError}` }],
        };
      }
    
      try {
        const ticket = await jira.issues.getIssue({
          issueIdOrKey: ticketId,
          fields: ['summary', 'status', 'issuetype', 'description', 'parent', 'issuelinks'],
        });
    
        const formattedTicket = [
          `Key: ${ticket.key}`,
          `Summary: ${ticket.fields?.summary || 'No summary'}`,
          `Status: ${ticket.fields?.status?.name || 'Unknown status'}`,
          `Type: ${ticket.fields?.issuetype?.name || 'Unknown type'}`,
          `Description:\n${extractTextFromADF(ticket.fields?.description) || 'No description'}`,
          `Parent: ${ticket.fields?.parent?.key || 'No parent'}`
        ];
    
        // Linked Issues Section
        const links = ticket.fields?.issuelinks || [];
        if (Array.isArray(links) && links.length > 0) {
          formattedTicket.push('\nLinked Issues:');
          for (const link of links) {
            // Outward (this issue is the source)
            if (link.outwardIssue) {
              const key = link.outwardIssue.key;
              const summary = link.outwardIssue.fields?.summary || 'No summary';
              const type = link.type?.outward || link.type?.name || 'Related';
              formattedTicket.push(`- [${type}] ${key}: ${summary}`);
            }
            // Inward (this issue is the target)
            if (link.inwardIssue) {
              const key = link.inwardIssue.key;
              const summary = link.inwardIssue.fields?.summary || 'No summary';
              const type = link.type?.inward || link.type?.name || 'Related';
              formattedTicket.push(`- [${type}] ${key}: ${summary}`);
            }
          }
        } else {
          formattedTicket.push('\nLinked Issues: None');
        }
    
        return {
          content: [{ type: "text", text: formattedTicket.join('\n') }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to fetch ticket: ${(error as Error).message}` }],
        };
      }
    }
  • Input schema for the 'get_ticket' tool, using Zod to validate the 'ticketId' parameter.
    {
      ticketId: z.string().describe("The Jira ticket ID (e.g., PROJECT-123)"),
    },
  • src/server.ts:159-221 (registration)
    Registration of the 'get_ticket' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      "get_ticket",
      "Get details of a specific Jira ticket",
      {
        ticketId: z.string().describe("The Jira ticket ID (e.g., PROJECT-123)"),
      },
      async ({ ticketId }: { ticketId: string }) => {
        const configError = validateJiraConfig();
        if (configError) {
          return {
            content: [{ type: "text", text: `Configuration error: ${configError}` }],
          };
        }
    
        try {
          const ticket = await jira.issues.getIssue({
            issueIdOrKey: ticketId,
            fields: ['summary', 'status', 'issuetype', 'description', 'parent', 'issuelinks'],
          });
    
          const formattedTicket = [
            `Key: ${ticket.key}`,
            `Summary: ${ticket.fields?.summary || 'No summary'}`,
            `Status: ${ticket.fields?.status?.name || 'Unknown status'}`,
            `Type: ${ticket.fields?.issuetype?.name || 'Unknown type'}`,
            `Description:\n${extractTextFromADF(ticket.fields?.description) || 'No description'}`,
            `Parent: ${ticket.fields?.parent?.key || 'No parent'}`
          ];
    
          // Linked Issues Section
          const links = ticket.fields?.issuelinks || [];
          if (Array.isArray(links) && links.length > 0) {
            formattedTicket.push('\nLinked Issues:');
            for (const link of links) {
              // Outward (this issue is the source)
              if (link.outwardIssue) {
                const key = link.outwardIssue.key;
                const summary = link.outwardIssue.fields?.summary || 'No summary';
                const type = link.type?.outward || link.type?.name || 'Related';
                formattedTicket.push(`- [${type}] ${key}: ${summary}`);
              }
              // Inward (this issue is the target)
              if (link.inwardIssue) {
                const key = link.inwardIssue.key;
                const summary = link.inwardIssue.fields?.summary || 'No summary';
                const type = link.type?.inward || link.type?.name || 'Related';
                formattedTicket.push(`- [${type}] ${key}: ${summary}`);
              }
            }
          } else {
            formattedTicket.push('\nLinked Issues: None');
          }
    
          return {
            content: [{ type: "text", text: formattedTicket.join('\n') }],
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Failed to fetch ticket: ${(error as Error).message}` }],
          };
        }
      }
    );
  • Helper function to recursively extract plain text from Jira's ADF (Atlassian Document Format) used in 'get_ticket' to parse ticket description and linked issue summaries.
    function extractTextFromADF(node: any): string {
      if (!node) {
        return '';
      }
    
      // Handle text nodes directly
      if (node.type === 'text' && node.text) {
        return node.text;
      }
    
      let text = '';
      // Handle block nodes like paragraph, heading, etc.
      if (node.content && Array.isArray(node.content)) {
        text = node.content.map(extractTextFromADF).join('');
        // Add a newline after paragraphs for better formatting
        if (node.type === 'paragraph') {
          text += '\n';
        }
      }
    
      return text;
    }
  • Helper function to validate required Jira environment variables, called at the start of the 'get_ticket' 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;
    }
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 states it 'gets details' but doesn't specify what details are returned, if authentication is required, or if there are rate limits. This leaves significant gaps for a tool that likely interacts with an external system like Jira.

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 that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what details are returned, potential error conditions, or how it differs from sibling tools. For a tool with no structured output information, more context is needed to be fully helpful.

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 input schema has 100% description coverage, with the 'ticketId' parameter clearly documented. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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 ('Get details') and resource ('a specific Jira ticket'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_comments' or 'list_tickets', which prevents a perfect score.

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 'list_tickets' for multiple tickets or 'get_comments' for comment details. It lacks any context about prerequisites, such as needing a specific ticket ID, which is only implied by the parameter.

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/kornbed/jira-mcp-server'

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