get_recently_updated_defect_list
Retrieve a list of recently updated defects filtered by status and date range to monitor and manage issue resolution effectively within the MCP-FEISHU server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | Yes | ||
| startDate | Yes | ||
| status | Yes |
Implementation Reference
- src/services/mcpServer.ts:60-68 (handler)Handler function for the 'get_recently_updated_defect_list' tool, which fetches records using feishuService and returns them as JSON text.async ({ status, startDate, endDate }) => { const records = await feishuService.getRecordsByStatus(status, startDate, endDate); return { content: [{ type: "text", text: JSON.stringify({ records }, null, 2) }] }; }
- src/services/mcpServer.ts:55-59 (schema)Input schema for the tool using Zod validation: status (string), startDate (number), endDate (number).{ status: z.string(), startDate: z.number(), endDate: z.number(), },
- src/services/mcpServer.ts:53-69 (registration)Registration of the 'get_recently_updated_defect_list' tool on the MCP server with schema and handler.this.server.tool( "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) }] }; } );
- Helper method that queries the Feishu Bitable API for records updated in a date range with specific status, using filters and sorting.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; // 返回记录列表 }