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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"ticket_id": "<ticket_id>"
},
"name": "get_ticket"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticket_id | Yes | The Jira ticket ID or key (e.g., 'PROJ-123') |
Implementation Reference
- src/tools/get_ticket.py:14-40 (handler)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)] - src/tools/registry.py:14-31 (schema)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"] } - src/tools/registry.py:76-78 (registration)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, - src/mappers/ticket_mapper.py:14-22 (helper)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 - src/client/jira_client.py:21-129 (helper)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]: