Skip to main content
Glama

get_ticket

Fetch full details of a Jira ticket using its ID or key, including summary, description, status, issue type, assignee, and comments.

Instructions

Fetch full details of a Jira ticket by its ID or key. Returns comprehensive ticket information including summary, description, status, issue type, priority, assignee, reporter, comments, and custom fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYesThe Jira ticket ID or key (e.g., 'PROJ-123')

Implementation Reference

  • The main handler function for the 'get_ticket' tool. It validates the ticket_id argument, fetches the issue from Jira via the JiraClient, wraps it in a JiraIssueResponse adapter, maps it to a Ticket domain model via TicketMapper, serializes to JSON, and returns the result.
    async def get_ticket_tool(arguments: dict) -> list[TextContent]:
        """Fetch full details of a Jira ticket.
        
        Args:
            arguments: Dict containing 'ticket_id'
            
        Returns:
            list[TextContent]: Ticket details in JSON format or error message
        """
        ticket_id = validate_required_argument(arguments, "ticket_id")
        if not ticket_id:
            return [TextContent(type="text", text="Error: ticket_id is required")]
        
        jira_client = get_jira_client()
        raw_issue = jira_client.get_issue(ticket_id)
        
        # Wrap raw response in our adapter
        issue = JiraIssueResponse(raw_issue)
        
        # Map to domain model
        ticket = TicketMapper.to_ticket(issue)
        
        # Serialize to JSON
        result = to_json(ticket.to_dict())
        
        logger.info(f"Successfully fetched ticket {ticket_id}")
        return [TextContent(type="text", text=result)]
  • Input schema definition for the 'get_ticket' tool. Defined as a Tool object with name='get_ticket', description, and inputSchema requiring a 'ticket_id' string property.
    TOOL_DEFINITIONS = [
        Tool(
            name="get_ticket",
            description=(
                "Fetch full details of a Jira ticket by its ID or key. "
                "Returns comprehensive ticket information including summary, description, "
                "status, issue type, priority, assignee, reporter, comments, and custom fields."
            ),
            inputSchema={
                "type": "object",
                "properties": {
                    "ticket_id": {
                        "type": "string",
                        "description": "The Jira ticket ID or key (e.g., 'PROJ-123')"
                    }
                },
                "required": ["ticket_id"]
            }
  • Registration of the get_ticket_tool handler in the TOOL_HANDLERS dictionary, mapping the string 'get_ticket' to the actual handler function.
    # Tool function mapping
    TOOL_HANDLERS = {
        "get_ticket": get_ticket_tool,
  • TicketMapper.to_ticket() helper that converts a JiraIssueResponse object into a Ticket domain model, extracting fields like key, summary, description, status, issue_type, priority, assignee, reporter, timestamps, comments, and custom fields.
    @staticmethod
    def to_ticket(issue: "JiraIssueResponse") -> Ticket:
        """Convert a Jira Issue to a Ticket model.
        
        Args:
            issue: Jira Issue object
            
        Returns:
            Ticket domain model
  • JiraClient.get_issue() helper method that fetches a Jira issue by key from the /rest/api/2/issue/{issue_key} endpoint, called by the get_ticket handler.
    """
    
    def __init__(self, settings: Settings):
        """Initialize Jira client with settings.
        
        Args:
            settings: Application settings with Jira configuration
        """
        self._settings = settings
        self._client: Optional[httpx.Client] = None
        
    @property
    def client(self) -> httpx.Client:
        """Get the HTTP client instance, creating it if necessary.
        
        Returns:
            Configured HTTP client
        """
        if self._client is None:
            self._client = httpx.Client(
                base_url=self._settings.jira_url,
                timeout=30.0,
                follow_redirects=True
            )
        return self._client
    
    def _get_auth_headers(self) -> Dict[str, str]:
        """Build authentication headers based on configured auth type.
        
        Returns:
            Dictionary of HTTP headers for authentication
        """
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json"
        }
        
        # Cookie authentication (highest priority)
        if self._settings.jira_cookie:
            headers["Cookie"] = self._settings.jira_cookie
            logger.debug("Using cookie authentication")
        
        # Bearer token authentication (for Kantega SSO PAT)
        elif self._settings.jira_auth_type == "bearer" and self._settings.jira_api_token:
            headers["Authorization"] = f"Bearer {self._settings.jira_api_token}"
            logger.debug("Using Bearer token authentication")
        
        # Basic authentication (username + token)
        elif self._settings.jira_username and self._settings.jira_api_token:
            credentials = f"{self._settings.jira_username}:{self._settings.jira_api_token}"
            encoded = base64.b64encode(credentials.encode()).decode()
            headers["Authorization"] = f"Basic {encoded}"
            logger.debug("Using Basic authentication")
        
        return headers
    
    def _get(self, endpoint: str, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        """Make a GET request to Jira API.
        
        Args:
            endpoint: API endpoint path (e.g., "/rest/api/2/issue/PROJ-123")
            params: Optional query parameters
            
        Returns:
            JSON response as dictionary
            
        Raises:
            httpx.HTTPStatusError: If request fails
        """
        url = endpoint if endpoint.startswith("/") else f"/{endpoint}"
        headers = self._get_auth_headers()
        
        logger.debug(f"GET {url}")
        response = self.client.get(url, headers=headers, params=params)
        response.raise_for_status()
        
        return response.json()
    
    def _post(
        self,
        endpoint: str,
        json: Optional[Dict[str, Any]] = None,
        params: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """Make a POST request to Jira API.
        
        Args:
            endpoint: API endpoint path
            json: Optional JSON body
            params: Optional query parameters
            
        Returns:
            JSON response as dictionary
            
        Raises:
            httpx.HTTPStatusError: If request fails
        """
        url = endpoint if endpoint.startswith("/") else f"/{endpoint}"
        headers = self._get_auth_headers()
        
        logger.debug(f"POST {url}")
        response = self.client.post(url, headers=headers, json=json, params=params)
        response.raise_for_status()
        
        return response.json()
    
    # Public API methods
    
    def get_issue(self, issue_key: str) -> Dict[str, Any]:
Behavior3/5

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

No annotations provided. Description discloses that the tool fetches (read operation) and lists returned fields, but does not mention rate limits, required permissions, error cases, or side effects. It adds value over schema by specifying return contents but lacks full behavioral context.

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?

Two sentences: first states action and input, second lists outputs. No extraneous words, front-loaded, and efficient.

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

Completeness4/5

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

For a simple one-parameter tool with no output schema, the description provides a good overview of return content (summary, description, status, etc.). Minor gap: custom fields are vague and exact structure not detailed, but sufficient for basic understanding.

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 coverage is 100% with a description for ticket_id. The description reiterates 'by its ID or key' without adding new meaning beyond the schema's example. Hence, baseline score of 3.

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 it fetches full details of a Jira ticket by ID or key and lists returned information (summary, status, etc.). It distinguishes from sibling tools ('get_linked_tickets', 'update_ticket_status') implicitly by resource and verb, but does not explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use (when you need ticket details) but does not explicitly state when not to use or suggest alternatives like get_linked_tickets for linked issues.

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

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