get_recently_updated_defect_list
Retrieve recently updated defect lists from Feishu by specifying status and date range to monitor and manage development issues.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| startDate | Yes | ||
| endDate | Yes |
Implementation Reference
- src/services/mcpServer.ts:54-69 (registration)Registration of the 'get_recently_updated_defect_list' tool, including Zod input schema for status, startDate, endDate and the inline async handler that fetches records via feishuService and returns JSON-formatted response."get_recently_updated_defect_list", { status: z.string(), startDate: z.number(), endDate: z.number(), }, async ({ status, startDate, endDate }) => { const records = await feishuService.getRecordsByStatus(status, startDate, endDate); return { content: [{ type: "text", text: JSON.stringify({ records }, null, 2) }] }; } );
- Core implementation in FeishuService.getRecordsByStatus: authenticates with Feishu, constructs a search query filter for status and recent update time range, sorts by update time descending, and returns the matching records.async getRecordsByStatus(status: string, startDate: number, endDate: number): Promise<any[]> { const tenantAccessToken = await this.getTenantAccessToken(); // 构造请求体 const requestBody = { filter: { conjunction: "and", conditions: [ { field_name: "状态", operator: "is", value: [status], // 筛选状态字段为指定值(如“已修复”) }, { field_name: "最近更新时间", operator: "isGreaterEqual", value: [startDate], // 开始日期 }, { field_name: "最近更新时间", operator: "isLessEqual", value: [endDate], // 结束日期 }, ], }, sort: [ { field_name: "最近更新时间", desc: true, // 按最近更新时间倒序排序 }, ], field_names: ["状态", "最近更新时间"], // 返回字段 }; // 调用查询记录 API const { data } = await axios.post( `https://open.feishu.cn/open-apis/bitable/v1/apps/${this.APP_TOKEN}/tables/${this.TABLE_ID}/records/search`, requestBody, { headers: { Authorization: `Bearer ${tenantAccessToken}`, "Content-Type": "application/json", }, } ); if (data.code !== 0) { throw new Error(`Failed to get records: ${data.msg}`); } return data.data.items; // 返回记录列表 }