Skip to main content
Glama

jira_get_issue

Retrieve specific Jira issue details by key to access ticket information, status, and project data for tracking and management.

Instructions

Retrieves details of a specific Jira issue by key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jiraHostNoThe Jira host URL (e.g., 'your-domain.atlassian.net')
emailNoEmail address associated with the Jira account
apiTokenNoAPI token for Jira authentication
issueKeyYesThe Jira issue key (e.g., 'PROJECT-123')

Implementation Reference

  • Core handler function that validates inputs, authenticates with Jira, fetches issue details via REST API, formats comprehensive markdown response including tables for status, comments, attachments, worklogs, and changelog, and handles errors.
    export async function getIssue(args: any) {
        const validatedArgs = await JiraIssueRequestSchema.validate(args);
    
        const jiraHost = validatedArgs.jiraHost || process.env.JIRA_HOST;
        const email = validatedArgs.email || process.env.JIRA_EMAIL;
        const apiToken = validatedArgs.apiToken || process.env.JIRA_API_TOKEN;
        const issueKey = validatedArgs.issueKey;
    
        if (!jiraHost || !email || !apiToken) {
            throw new Error('Missing required authentication credentials. Please provide jiraHost, email, and apiToken.');
        }
    
        validateCredentials(jiraHost, email, apiToken);
    
        const authHeader = createAuthHeader(email, apiToken);
    
        try {
            const response = await axios.get(`https://${jiraHost}/rest/api/3/issue/${issueKey}`, {
                params: {
                    expand: 'renderedFields,names,changelog,operations',
                    fields: 'summary,status,assignee,issuetype,priority,created,creator,reporter,description,comment,attachment,worklog,updated,labels,fixVersions,components,duedate'
                },
                headers: {
                    'Authorization': authHeader,
                    'Accept': 'application/json',
                },
            });
    
            const issue = response.data;
            const formattedDate = new Date(issue.fields.created).toLocaleString();
            const updatedDate = issue.fields.updated ? new Date(issue.fields.updated).toLocaleString() : 'Not updated';
    
            let formattedResponse = `# Issue: ${issue.key} - ${issue.fields.summary}\n\n`;
    
            formattedResponse += `## Basic Information\n\n`;
            formattedResponse += `| Field | Value |\n`;
            formattedResponse += `|-------|-------|\n`;
            formattedResponse += `| Status | ${issue.fields.status?.name || 'Unknown'} |\n`;
            formattedResponse += `| Type | ${issue.fields.issuetype?.name || 'Unknown'} |\n`;
            formattedResponse += `| Priority | ${issue.fields.priority?.name || 'Not set'} |\n`;
            formattedResponse += `| Assignee | ${issue.fields.assignee?.displayName || 'Unassigned'} |\n`;
            formattedResponse += `| Reporter | ${issue.fields.reporter?.displayName || 'Unknown'} |\n`;
            formattedResponse += `| Created | ${formattedDate} |\n`;
            formattedResponse += `| Updated | ${updatedDate} |\n`;
    
            if (issue.fields.duedate) {
                const dueDate = new Date(issue.fields.duedate).toLocaleString();
                formattedResponse += `| Due Date | ${dueDate} |\n`;
            }
    
            if (issue.fields.labels && issue.fields.labels.length > 0) {
                formattedResponse += `| Labels | ${issue.fields.labels.join(', ')} |\n`;
            }
    
            if (issue.fields.components && issue.fields.components.length > 0) {
                const componentNames = issue.fields.components.map((comp: any) => comp.name).join(', ');
                formattedResponse += `| Components | ${componentNames} |\n`;
            }
    
            if (issue.fields.fixVersions && issue.fields.fixVersions.length > 0) {
                const fixVersionNames = issue.fields.fixVersions.map((ver: any) => ver.name).join(', ');
                formattedResponse += `| Fix Versions | ${fixVersionNames} |\n`;
            }
    
            if (issue.fields.description) {
                formattedResponse += `\n## Description\n\n${issue.renderedFields?.description || issue.fields.description}\n`;
            }
    
            if (issue.fields.comment && issue.fields.comment.comments && issue.fields.comment.comments.length > 0) {
                formattedResponse += `\n## Comments (${issue.fields.comment.comments.length})\n\n`;
    
                issue.fields.comment.comments.forEach((comment: any, index: number) => {
                    const commentDate = new Date(comment.created).toLocaleString();
                    formattedResponse += `### Comment ${index + 1} - ${comment.author.displayName} (${commentDate})\n\n`;
                    formattedResponse += `${comment.body}\n\n`;
                });
            }
    
            if (issue.fields.attachment && issue.fields.attachment.length > 0) {
                formattedResponse += `\n## Attachments (${issue.fields.attachment.length})\n\n`;
                formattedResponse += `| Filename | Size | Uploaded by | Date |\n`;
                formattedResponse += `|----------|------|-------------|------|\n`;
    
                issue.fields.attachment.forEach((attachment: any) => {
                    const attachmentDate = new Date(attachment.created).toLocaleString();
                    const sizeInKb = Math.round(attachment.size / 1024);
                    formattedResponse += `| ${attachment.filename} | ${sizeInKb} KB | ${attachment.author.displayName} | ${attachmentDate} |\n`;
                });
            }
    
            if (issue.fields.worklog && issue.fields.worklog.worklogs && issue.fields.worklog.worklogs.length > 0) {
                formattedResponse += `\n## Work Log (${issue.fields.worklog.worklogs.length})\n\n`;
                formattedResponse += `| User | Time Spent | Date | Comment |\n`;
                formattedResponse += `|------|------------|------|--------|\n`;
    
                issue.fields.worklog.worklogs.forEach((worklog: any) => {
                    const worklogDate = new Date(worklog.started).toLocaleString();
                    formattedResponse += `| ${worklog.author.displayName} | ${worklog.timeSpent} | ${worklogDate} | ${worklog.comment || 'No comment'} |\n`;
                });
            }
    
            if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
                formattedResponse += `\n## Change History\n\n`;
                formattedResponse += `| Date | User | Changes |\n`;
                formattedResponse += `|------|------|--------|\n`;
    
                issue.changelog.histories.forEach((history: any) => {
                    const historyDate = new Date(history.created).toLocaleString();
                    const changes = history.items.map((item: any) => {
                        return `${item.field} changed from "${item.fromString || 'none'}" to "${item.toString || 'none'}"`;
                    }).join('; ');
    
                    formattedResponse += `| ${historyDate} | ${history.author.displayName} | ${changes} |\n`;
                });
            }
    
            return {
                content: [{ type: "text", text: formattedResponse }],
                isError: false,
            };
        } catch (error: any) {
            let errorMsg = "An error occurred while retrieving the issue.";
    
            if (error.response) {
                if (error.response.status === 404) {
                    errorMsg = `Issue ${issueKey} not found or you don't have permission to view it.`;
                } else {
                    errorMsg = `Error ${error.response.status}: ${error.response.data?.errorMessages?.join(', ') || error.message}`;
                }
            } else if (error.message) {
                errorMsg = error.message;
            }
    
            return {
                content: [{ type: "text", text: `# Error\n\n${errorMsg}` }],
                isError: true,
            };
        }
    }
  • Yup validation schema for jira_get_issue inputs, extending base JiraApiRequestSchema with required issueKey validation (format PROJECT-123).
    export const JiraIssueRequestSchema = JiraApiRequestSchema.shape({
        issueKey: yup.string()
            .required("Issue key is required")
            .matches(/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/, "Invalid issue key format. The correct format is PROJECT-123"),
    });
  • Registers the 'jira_get_issue' tool by mapping its name to the validation schema and handler function in the toolConfigs object used by handleCallTool.
    jira_get_issue: {
        schema: JiraIssueRequestSchema,
        handler: getIssue
    },
  • Registers the tool description, including name, description, and inputSchema, for the MCP listTools endpoint.
    {
        name: "jira_get_issue",
        description: "Retrieves details of a specific Jira issue by key",
        inputSchema: {
            type: "object",
            properties: {
                ...getCommonJiraProperties(),
                issueKey: {
                    type: "string",
                    description: "The Jira issue key (e.g., 'PROJECT-123')",
                },
            },
            required: ["issueKey"],
        },
    },
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 'retrieves details' but doesn't specify what details are returned, whether it's a read-only operation, authentication requirements beyond the schema, or potential rate limits. This is inadequate for a tool with authentication parameters and no output schema.

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 front-loads the core purpose without unnecessary words. Every part of the sentence ('retrieves details', 'specific Jira issue', 'by key') contributes essential information, making it optimally concise and well-structured.

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 tool's complexity (involving authentication and issue retrieval), lack of annotations, and no output schema, the description is insufficient. It doesn't explain what 'details' are returned, error conditions, or how authentication parameters interact, leaving significant gaps for an agent to use the tool effectively.

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 schema description coverage is 100%, so the schema fully documents all four parameters. The description doesn't add any parameter-specific information beyond what's in the schema, such as clarifying the format of 'issueKey' or explaining the relationship between authentication parameters. This meets the baseline for high schema 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 ('retrieves details') and resource ('specific Jira issue by key'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'jira_search_issues' or 'jira_check_user_issues', which might also retrieve issue information but with different scopes or filters.

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 that this is for single-issue lookup by key, as opposed to 'jira_search_issues' for broader queries or 'jira_check_user_issues' for user-specific issues, leaving the agent to infer usage from the name alone.

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

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