Get Item Reviews
get_item_reviewsRetrieve all Review Hub reviews for a Codebeamer tracker item, including overall result, individual votes, and review configuration.
Instructions
Get all Review Hub reviews for a Codebeamer tracker item. Shows the overall review result (APPROVED/REJECTED/UNDECIDED), individual reviewer votes, and review configuration (required approvals/rejections).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | Numeric item ID |
Implementation Reference
- src/tools/item-details.ts:117-120 (handler)The actual handler function for the 'get_item_reviews' tool. It calls client.getItemReviews(itemId) and formats the result using formatReviews.
async ({ itemId }) => { const reviews = await client.getItemReviews(itemId); return { content: [{ type: "text", text: formatReviews(reviews) }] }; }, - src/tools/item-details.ts:101-116 (schema)Registration and input schema for the 'get_item_reviews' tool. Defines the tool name, title, description, and input schema (requires itemId as a positive integer).
server.registerTool( "get_item_reviews", { title: "Get Item Reviews", description: "Get all Review Hub reviews for a Codebeamer tracker item. " + "Shows the overall review result (APPROVED/REJECTED/UNDECIDED), " + "individual reviewer votes, and review configuration (required approvals/rejections).", inputSchema: { itemId: z .number() .int() .positive() .describe("Numeric item ID"), }, }, - src/tools/item-details.ts:101-121 (registration)The full server.registerTool call that registers the 'get_item_reviews' tool on the MCP server, including its schema and handler.
server.registerTool( "get_item_reviews", { title: "Get Item Reviews", description: "Get all Review Hub reviews for a Codebeamer tracker item. " + "Shows the overall review result (APPROVED/REJECTED/UNDECIDED), " + "individual reviewer votes, and review configuration (required approvals/rejections).", inputSchema: { itemId: z .number() .int() .positive() .describe("Numeric item ID"), }, }, async ({ itemId }) => { const reviews = await client.getItemReviews(itemId); return { content: [{ type: "text", text: formatReviews(reviews) }] }; }, ); - The formatReviews helper function that formats CbTrackerItemReview[] into a human-readable Markdown string, showing review results, config, and reviewer votes in a table.
export function formatReviews(reviews: CbTrackerItemReview[]): string { if (reviews.length === 0) return "_No reviews found for this item._"; const sections = reviews.map((review, idx) => { const result = review.result ?? "UNDECIDED"; const resultEmoji = result === "APPROVED" ? "✅" : result === "REJECTED" ? "❌" : "⏳"; const lines: string[] = [ `### Review ${idx + 1} — ${resultEmoji} ${result}`, "", ]; if (review.config) { const cfg = review.config; lines.push("**Config:**"); if (cfg.requiredApprovals !== undefined) lines.push(`- Required approvals: ${cfg.requiredApprovals}`); if (cfg.requiredRejections !== undefined) lines.push(`- Required rejections: ${cfg.requiredRejections}`); if (cfg.requiredSignature) lines.push(`- Signature required: ${cfg.requiredSignature}`); if (cfg.roleRequired !== undefined) lines.push(`- Role required: ${cfg.roleRequired}`); lines.push(""); } const reviewers = review.reviewers ?? []; if (reviewers.length > 0) { lines.push(`**Reviewers (${reviewers.length}):**`, ""); lines.push("| Reviewer | Role | Decision | Reviewed At |"); lines.push("|----------|------|----------|-------------|"); for (const r of reviewers) { const user = r.user?.name ?? "?"; const role = r.asRole?.name ?? "-"; const decision = r.decision ?? "UNDECIDED"; const at = r.reviewedAt ? r.reviewedAt.replace("T", " ").slice(0, 16) : "-"; lines.push(`| ${user} | ${role} | ${decision} | ${at} |`); } } else { lines.push("_No reviewers assigned._"); } return lines.join("\n"); }); return [`## Reviews (${reviews.length})`, "", ...sections].join("\n\n"); } - The getItemReviews client method that calls the Codebeamer API (GET /items/{id}/reviews) to fetch all reviews for a tracker item.
async getItemReviews(id: number): Promise<CbTrackerItemReview[]> { const raw = await this.http.get<unknown>(`/items/${id}/reviews`, { resource: `reviews for item ${id}`, }); return Array.isArray(raw) ? raw : []; }