Skip to main content
Glama
cosmix

JIRA MCP Server

by cosmix

get_issue

Retrieve detailed JIRA issue information including comments by providing the issue ID or key to access specific project data.

Instructions

Get detailed information about a specific JIRA issue including comments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueIdYesThe ID or key of the JIRA issue

Implementation Reference

  • src/index.ts:115-130 (registration)
    Registration of the get_issue MCP tool, including its name, description, and input schema requiring an issueId string.
    {
      name: "get_issue",
      description:
        "Get detailed information about a specific JIRA issue including comments",
      inputSchema: {
        type: "object",
        properties: {
          issueId: {
            type: "string",
            description: "The ID or key of the JIRA issue",
          },
        },
        required: ["issueId"],
        additionalProperties: false,
      },
    },
  • MCP tool handler for get_issue: validates the issueId argument and calls the JiraApiService to fetch the issue with comments, then returns JSON stringified response.
    case "get_issue": {
      if (!args.issueId || typeof args.issueId !== "string") {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Issue ID is required",
        );
      }
      const response = await this.jiraApi.getIssueWithComments(
        args.issueId,
      );
      return {
        content: [
          { type: "text", text: JSON.stringify(response, null, 2) },
        ],
      };
    }
  • Core helper function implementing the logic to retrieve a JIRA issue with comments: fetches issue and comments via API, cleans data, extracts mentions from ADF content, enriches with epic details.
    async getIssueWithComments(issueId: string): Promise<CleanJiraIssue> {
      const params = new URLSearchParams({
        fields: [
          "id",
          "key",
          "summary",
          "description",
          "status",
          "created",
          "updated",
          "parent",
          "subtasks",
          "customfield_10014",
          "issuelinks",
        ].join(","),
        expand: "names,renderedFields",
      });
    
      let issueData, commentsData;
      try {
        [issueData, commentsData] = await Promise.all([
          this.fetchJson<any>(`/rest/api/3/issue/${issueId}?${params}`),
          this.fetchJson<any>(`/rest/api/3/issue/${issueId}/comment`),
        ]);
      } catch (error: any) {
        if (error instanceof Error && error.message.includes("(Status: 404)")) {
          throw new Error(`Issue not found: ${issueId}`);
        }
    
        throw error;
      }
    
      const issue = this.cleanIssue(issueData);
      const comments = commentsData.comments.map((comment: any) =>
        this.cleanComment(comment)
      );
    
      const commentMentions = comments.flatMap(
        (comment: CleanComment) => comment.mentions
      );
      issue.relatedIssues = [...issue.relatedIssues, ...commentMentions];
    
      issue.comments = comments;
    
      if (issue.epicLink) {
        try {
          const epicData = await this.fetchJson<any>(
            `/rest/api/3/issue/${issue.epicLink.key}?fields=summary`
          );
          issue.epicLink.summary = epicData.fields?.summary;
        } catch (error) {
          console.error("Failed to fetch epic details:", error);
        }
      }
    
      return issue;
    }

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

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