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.
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": {
"itemId": "<itemId>"
},
"name": "get_item_comments"
}
}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 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"); }