Skip to main content
Glama
imrnbeg

Jira MCP Server

by imrnbeg

Get Jira Issue

get_jira_issue

Retrieve detailed Jira issue information by entering its key. Access status, assignee, priority, and descriptions in structured formats for project tracking.

Instructions

Get detailed information about a Jira issue by its key (e.g., PROJ-123)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYesThe Jira issue key (e.g., PROJ-123, TASK-456)

Implementation Reference

  • The handler function for the 'get_jira_issue' tool. Fetches the Jira issue using the REST API, parses key fields (summary, status, assignee, etc.), cleans the description, and returns formatted text content along with structured data including a URL to the issue.
      async (args: { issueKey: string }) => {
        try {
          const url = `${JIRA_URL}/rest/api/3/issue/${args.issueKey}`;
          const response = await fetch(url, {
            method: "GET",
            headers: getJiraHeaders(),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            return {
              content: [
                {
                  type: "text",
                  text: `Failed to fetch Jira issue ${args.issueKey}: ${response.status} ${response.statusText}\n${errorText}`,
                },
              ],
              isError: true,
            };
          }
    
          const issueData = await response.json() as any;
          
          // Extract key information from the issue
          const issue = issueData;
          const fields = issue.fields;
          
          const summary = fields.summary || 'No summary';
          const description = fields.description || 'No description';
          const status = fields.status?.name || 'Unknown status';
          const assignee = fields.assignee?.displayName || 'Unassigned';
          const reporter = fields.reporter?.displayName || 'Unknown reporter';
          const priority = fields.priority?.name || 'No priority';
          const issueType = fields.issuetype?.name || 'Unknown type';
          const created = fields.created ? new Date(fields.created).toLocaleDateString() : 'Unknown';
          const updated = fields.updated ? new Date(fields.updated).toLocaleDateString() : 'Unknown';
          
          // Format description (remove HTML tags if present)
          const cleanDescription = typeof description === 'string' 
            ? description.replace(/<[^>]*>/g, '').trim()
            : JSON.stringify(description);
    
          return {
            content: [
              {
                type: "text",
                text: `**${issue.key}: ${summary}**
    
    **Status:** ${status}
    **Type:** ${issueType}
    **Priority:** ${priority}
    **Assignee:** ${assignee}
    **Reporter:** ${reporter}
    **Created:** ${created}
    **Updated:** ${updated}
    
    **Description:**
    ${cleanDescription}
    
    **Full Issue Data:** Available in structured content below.`,
              },
            ],
            structuredContent: {
              issueKey: issue.key,
              summary,
              description: cleanDescription,
              status,
              issueType,
              priority,
              assignee,
              reporter,
              created,
              updated,
              url: `${JIRA_URL}/browse/${issue.key}`,
              fullData: issueData,
            },
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error fetching Jira issue ${args.issueKey}: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
  • Schema definition for the 'get_jira_issue' tool, including title, description, and input schema requiring 'issueKey' as a string.
    {
      title: "Get Jira Issue",
      description: "Get detailed information about a Jira issue by its key (e.g., PROJ-123)",
      inputSchema: {
        issueKey: z.string().describe("The Jira issue key (e.g., PROJ-123, TASK-456)"),
      },
  • src/server.ts:47-145 (registration)
    Registration of the 'get_jira_issue' tool with the MCP server using mcp.registerTool, passing the tool name, schema, and inline handler function.
    mcp.registerTool(
      "get_jira_issue",
      {
        title: "Get Jira Issue",
        description: "Get detailed information about a Jira issue by its key (e.g., PROJ-123)",
        inputSchema: {
          issueKey: z.string().describe("The Jira issue key (e.g., PROJ-123, TASK-456)"),
        },
      },
      async (args: { issueKey: string }) => {
        try {
          const url = `${JIRA_URL}/rest/api/3/issue/${args.issueKey}`;
          const response = await fetch(url, {
            method: "GET",
            headers: getJiraHeaders(),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            return {
              content: [
                {
                  type: "text",
                  text: `Failed to fetch Jira issue ${args.issueKey}: ${response.status} ${response.statusText}\n${errorText}`,
                },
              ],
              isError: true,
            };
          }
    
          const issueData = await response.json() as any;
          
          // Extract key information from the issue
          const issue = issueData;
          const fields = issue.fields;
          
          const summary = fields.summary || 'No summary';
          const description = fields.description || 'No description';
          const status = fields.status?.name || 'Unknown status';
          const assignee = fields.assignee?.displayName || 'Unassigned';
          const reporter = fields.reporter?.displayName || 'Unknown reporter';
          const priority = fields.priority?.name || 'No priority';
          const issueType = fields.issuetype?.name || 'Unknown type';
          const created = fields.created ? new Date(fields.created).toLocaleDateString() : 'Unknown';
          const updated = fields.updated ? new Date(fields.updated).toLocaleDateString() : 'Unknown';
          
          // Format description (remove HTML tags if present)
          const cleanDescription = typeof description === 'string' 
            ? description.replace(/<[^>]*>/g, '').trim()
            : JSON.stringify(description);
    
          return {
            content: [
              {
                type: "text",
                text: `**${issue.key}: ${summary}**
    
    **Status:** ${status}
    **Type:** ${issueType}
    **Priority:** ${priority}
    **Assignee:** ${assignee}
    **Reporter:** ${reporter}
    **Created:** ${created}
    **Updated:** ${updated}
    
    **Description:**
    ${cleanDescription}
    
    **Full Issue Data:** Available in structured content below.`,
              },
            ],
            structuredContent: {
              issueKey: issue.key,
              summary,
              description: cleanDescription,
              status,
              issueType,
              priority,
              assignee,
              reporter,
              created,
              updated,
              url: `${JIRA_URL}/browse/${issue.key}`,
              fullData: issueData,
            },
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error fetching Jira issue ${args.issueKey}: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function getJiraHeaders() that creates authentication headers for Jira API requests, used in the get_jira_issue handler and other tools.
    function getJiraHeaders(): Record<string, string> {
      const auth = Buffer.from(`${JIRA_EMAIL}:${JIRA_API_TOKEN}`).toString('base64');
      return {
        'Authorization': `Basic ${auth}`,
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      };
    }
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. It states it gets 'detailed information' but doesn't disclose what details are included, whether it's read-only, requires authentication, has rate limits, or error behaviors. This is a significant gap for a 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.

Conciseness5/5

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

Single sentence, front-loaded with the core purpose, includes a helpful example, and has zero wasted words. Every element earns its place efficiently.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'detailed information' includes, return format, or error handling. For a tool with rich sibling context and no structured output, more detail 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?

Schema description coverage is 100%, with the schema fully documenting the issueKey parameter. The description adds an example (PROJ-123) which provides context, but doesn't add substantial meaning beyond what the schema already provides, meeting the baseline for high coverage.

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' and resource 'detailed information about a Jira issue', specifying it's by issue key. It distinguishes from siblings like list_project_issues or search_jira_issues by focusing on a single issue, but doesn't explicitly name 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?

No guidance on when to use this tool versus alternatives like get_jira_issue_comments or search_jira_issues. The description implies usage for detailed info on a specific issue key, but lacks explicit when/when-not instructions or named alternatives.

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

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