Get Item Comments
get_item_commentsRetrieve all comments in the discussion thread for a specific Codebeamer item by its numeric ID. Access the full conversation history to review collaboration and feedback.
Instructions
Get all comments (discussion thread) for a Codebeamer item.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | Numeric item ID |
Implementation Reference
- src/tools/item-details.ts:81-99 (handler)The tool handler for 'get_item_comments'. It calls client.getItemComments(itemId) and formats the result with formatComments().
server.registerTool( "get_item_comments", { title: "Get Item Comments", description: "Get all comments (discussion thread) for a Codebeamer item.", inputSchema: { itemId: z .number() .int() .positive() .describe("Numeric item ID"), }, }, async ({ itemId }) => { const comments = await client.getItemComments(itemId); return { content: [{ type: "text", text: formatComments(comments) }] }; }, ); - src/tools/item-details.ts:82-94 (schema)Input schema for 'get_item_comments' — requires a positive integer itemId.
"get_item_comments", { title: "Get Item Comments", description: "Get all comments (discussion thread) for a Codebeamer item.", inputSchema: { itemId: z .number() .int() .positive() .describe("Numeric item ID"), }, }, - src/tools/item-details.ts:81-99 (registration)Tool registration via server.registerTool('get_item_comments', ...) inside registerItemDetailTools().
server.registerTool( "get_item_comments", { title: "Get Item Comments", description: "Get all comments (discussion thread) for a Codebeamer item.", inputSchema: { itemId: z .number() .int() .positive() .describe("Numeric item ID"), }, }, async ({ itemId }) => { const comments = await client.getItemComments(itemId); return { content: [{ type: "text", text: formatComments(comments) }] }; }, ); - The getItemComments() method on CodebeamerClient — fetches /items/{id}/comments and normalizes the response using toArray().
async getItemComments(id: number): Promise<CbComment[]> { const raw = await this.http.get<unknown>(`/items/${id}/comments`, { resource: `comments for item ${id}`, }); return toArray(raw); } - The formatComments() helper — formats CbComment[] into a Markdown string with author, date, and comment body.
export function formatComments(comments: CbComment[]): string { if (comments.length === 0) return "_No comments found._"; const formatted = comments.map( (c) => `### ${c.createdBy?.name ?? "?"} — ${c.createdAt ?? ""}\n\n${c.comment ?? "_empty_"}`, ); return [`## Comments (${comments.length})`, "", ...formatted].join("\n\n"); }