wit_list_work_item_comments
Fetch comments for a specific work item by ID from Azure DevOps projects. Specify project and work item details to retrieve up to a defined number of comments.
Instructions
Retrieve list of comments for a work item by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | The name or ID of the Azure DevOps project. | |
| top | No | Optional number of comments to retrieve. Defaults to all comments. | |
| workItemId | Yes | The ID of the work item to retrieve comments for. |
Implementation Reference
- src/tools/workitems.ts:211-219 (handler)The main handler function that executes the tool logic: connects to Azure DevOps, retrieves the WorkItemTrackingApi, calls getComments with project, workItemId, and top parameters, and returns the JSON-stringified comments.async ({ project, workItemId, top }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); const comments = await workItemApi.getComments(project, workItemId, top); return { content: [{ type: "text", text: JSON.stringify(comments, null, 2) }], }; }
- src/tools/workitems.ts:207-210 (schema)Zod schema defining the input parameters for the tool: project (string), workItemId (number), top (number, default 50).project: z.string().describe("The name or ID of the Azure DevOps project."), workItemId: z.number().describe("The ID of the work item to retrieve comments for."), top: z.number().default(50).describe("Optional number of comments to retrieve. Defaults to all comments."), },
- src/tools/workitems.ts:204-220 (registration)The server.tool registration call that registers the tool with name WORKITEM_TOOLS.list_work_item_comments ("wit_list_work_item_comments"), description, schema, and handler function.WORKITEM_TOOLS.list_work_item_comments, "Retrieve list of comments for a work item by ID.", { project: z.string().describe("The name or ID of the Azure DevOps project."), workItemId: z.number().describe("The ID of the work item to retrieve comments for."), top: z.number().default(50).describe("Optional number of comments to retrieve. Defaults to all comments."), }, async ({ project, workItemId, top }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); const comments = await workItemApi.getComments(project, workItemId, top); return { content: [{ type: "text", text: JSON.stringify(comments, null, 2) }], }; } );
- src/tools/workitems.ts:20-20 (registration)Mapping in WORKITEM_TOOLS constant that associates the internal key 'list_work_item_comments' with the tool name 'wit_list_work_item_comments'.list_work_item_comments: "wit_list_work_item_comments",