list_work_item_comments
Retrieve comments for a specific work item in Alibaba Cloud DevOps to track discussions, review feedback, and monitor progress updates.
Instructions
[Project Management] List comments for a specific work item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | 企业ID,可在组织管理后台的基本信息页面获取 | |
| workItemId | Yes | 工作项ID | |
| page | No | 页码 | |
| perPage | No | 每页条数 |
Implementation Reference
- Main tool handler implementing the tool logic: parses arguments using the schema, calls the helper function to fetch comments, and returns formatted JSON response.case "list_work_item_comments": { const args = types.ListWorkItemCommentsSchema.parse(request.params.arguments); const comments = await workitem.listWorkItemCommentsFunc( args.organizationId, args.workItemId, args.page, args.perPage ); return { content: [{ type: "text", text: JSON.stringify(comments, null, 2) }], }; }
- operations/projex/types.ts:355-360 (schema)Zod schema defining input parameters: organizationId, workItemId, page, perPage.export const ListWorkItemCommentsSchema = z.object({ organizationId: z.string().describe("企业ID,可在组织管理后台的基本信息页面获取"), workItemId: z.string().describe("工作项ID"), page: z.number().int().optional().default(1).describe("页码"), perPage: z.number().int().optional().default(20).describe("每页条数"), });
- tool-registry/project-management.ts:102-106 (registration)Tool registration entry specifying name, description, and input schema reference.{ name: "list_work_item_comments", description: "[Project Management] List comments for a specific work item", inputSchema: zodToJsonSchema(types.ListWorkItemCommentsSchema), },
- Helper function that performs the actual API call to retrieve work item comments using yunxiaoRequest.export async function listWorkItemCommentsFunc( organizationId: string, workItemId: string, page: number = 1, perPage: number = 20 ): Promise<any[]> { const url = `/oapi/v1/projex/organizations/${organizationId}/workitems/${workItemId}/comments?page=${page}&perPage=${perPage}`; const response = await yunxiaoRequest(url, { method: "GET", }); // 确保返回的是数组格式 if (Array.isArray(response)) { return response; } // 如果响应中包含result字段,则返回result中的数据 if (response && typeof response === 'object' && 'result' in response && Array.isArray(response.result)) { return response.result; } // 其他情况返回空数组 return []; }