ticket_get
Retrieve ticket information and associated task details from the tpm-mcp project management server, with adjustable detail levels from minimal to comprehensive.
Instructions
PROJECT MANAGEMENT: Get info about a ticket and its tasks.
IMPORTANT: Do NOT pass detail='full' unless explicitly asked for full/all details. The default 'summary' is sufficient for most queries. Only use 'full' when user specifically asks for implementation details, metadata, or complete task information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticket_id | Yes | Ticket ID (e.g., FEAT-001) | |
| detail | No | OMIT this param for most requests (defaults to 'summary'). Only use 'full' if user explicitly asks for all details/metadata. | summary |
Implementation Reference
- src/tpm_mcp/server.py:595-650 (handler)Main handler logic for the 'ticket_get' tool. Fetches ticket details and associated tasks from database, formats output based on 'detail' level: minimal (basic stats), summary (truncated description + task summaries), full (complete data).if name == "ticket_get": ticket = db.get_ticket(args["ticket_id"]) if not ticket: return f"Ticket {args['ticket_id']} not found" detail = args.get("detail", "summary") tasks = db.list_tasks(args["ticket_id"]) if detail == "minimal": # Just the essentials - very small response return _json( { "ticket": { "id": ticket.id, "title": ticket.title, "status": ticket.status.value, "priority": ticket.priority.value, "task_count": len(tasks), "tasks_done": sum( 1 for t in tasks if t.status.value in ("done", "completed") ), } } ) elif detail == "full": # Everything - can be large return _json({"ticket": ticket.model_dump(), "tasks": [t.model_dump() for t in tasks]}) else: # summary (default) - balanced response desc = ticket.description if desc and len(desc) > 300: desc = desc[:300] + "..." return _json( { "ticket": { "id": ticket.id, "title": ticket.title, "description": desc, "status": ticket.status.value, "priority": ticket.priority.value, "tags": ticket.tags, "assignees": ticket.assignees, "acceptance_criteria": ticket.acceptance_criteria, }, "tasks": [ { "id": t.id, "title": t.title, "status": t.status.value, "priority": t.priority.value, } for t in tasks ], } )
- src/tpm_mcp/server.py:256-274 (registration)Registration of the 'ticket_get' tool in the MCP server's list_tools() function, including name, description, and input schema definition.Tool( name="ticket_get", description="""PROJECT MANAGEMENT: Get info about a ticket and its tasks. IMPORTANT: Do NOT pass detail='full' unless explicitly asked for full/all details. The default 'summary' is sufficient for most queries. Only use 'full' when user specifically asks for implementation details, metadata, or complete task information.""", inputSchema={ "type": "object", "properties": { "ticket_id": {"type": "string", "description": "Ticket ID (e.g., FEAT-001)"}, "detail": { "type": "string", "enum": ["minimal", "summary", "full"], "description": "OMIT this param for most requests (defaults to 'summary'). Only use 'full' if user explicitly asks for all details/metadata.", "default": "summary", }, }, "required": ["ticket_id"], }, ),
- src/tpm_mcp/db.py:394-421 (helper)Database helper: Retrieves a single ticket by ID from the SQLite database and converts the row to a Ticket model instance.def get_ticket(self, ticket_id: str) -> Ticket | None: row = self.conn.execute("SELECT * FROM tickets WHERE id = ?", (ticket_id,)).fetchone() if row: return self._row_to_ticket(row) return None def _row_to_ticket(self, row) -> Ticket: status = _normalize_ticket_status(row["status"]) return Ticket( id=row["id"], project_id=row["project_id"], title=row["title"], description=row["description"], status=TicketStatus(status), priority=Priority(row["priority"]), created_at=datetime.fromisoformat(row["created_at"]), started_at=datetime.fromisoformat(row["started_at"]) if row["started_at"] else None, completed_at=datetime.fromisoformat(row["completed_at"]) if row["completed_at"] else None, assignees=_from_json(row["assignees"]), tags=_from_json(row["tags"]), related_repos=_from_json(row["related_repos"]), acceptance_criteria=_from_json(row["acceptance_criteria"]), blockers=_from_json(row["blockers"]), metadata=_from_json(row["metadata"]), )
- src/tpm_mcp/db.py:684-698 (helper)Database helper: Lists all tasks for a given ticket_id (or filtered by status), used by ticket_get to fetch associated tasks.def list_tasks( self, ticket_id: str | None = None, status: TaskStatus | None = None ) -> list[Task]: query = "SELECT * FROM tasks WHERE 1=1" params = [] if ticket_id: query += " AND ticket_id = ?" params.append(ticket_id) if status: query += " AND status = ?" params.append(status.value) query += " ORDER BY created_at" rows = self.conn.execute(query, params).fetchall() return [self._row_to_task(r) for r in rows]