rdms_get_my_bugs
Retrieve bugs assigned to you from Zentao bug tracking systems. Filter by status and set a result limit to streamline bug management.
Instructions
Get bugs assigned to current user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results | |
| status | No | Filter by status | active |
Implementation Reference
- index.js:766-775 (handler)The primary handler function that executes the rdms_get_my_bugs tool. It ensures login, fetches the user's assigned bugs from the RDMS 'my bugs' page, and parses the HTML response using parseBugList.async getMyBugs(status = 'active', limit = 20) { await this.ensureLoggedIn(); try { const myBugsUrl = `${this.baseUrl}/index.php?m=my&f=work&mode=bug&type=assignedTo`; const response = await this.client.get(myBugsUrl); return this.parseBugList(response.data, limit, '我的BUG'); } catch (error) { return { success: false, error: error.message, bugs: [] }; } }
- index.js:105-111 (schema)Input schema for the rdms_get_my_bugs tool defining optional status and limit parameters.inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Filter by status', default: 'active' }, limit: { type: 'number', description: 'Max results', default: 20 } } }
- index.js:102-112 (registration)Tool registration object defining name, description, and schema, added to the MCP server's tools list.{ name: 'rdms_get_my_bugs', description: 'Get bugs assigned to current user', inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Filter by status', default: 'active' }, limit: { type: 'number', description: 'Max results', default: 20 } } } },
- index.js:148-149 (handler)Dispatch case in the MCP request handler that invokes the getMyBugs function for this tool.case 'rdms_get_my_bugs': return { content: [{ type: 'text', text: JSON.stringify(await this.getMyBugs(args.status, args.limit)) }] };
- index.js:789-865 (helper)Shared helper method that parses RDMS HTML bug list pages into structured JSON, extracting bug IDs, titles, priorities, etc. Called by getMyBugs.parseBugList(html, limit = 20, type = 'BUG') { const $ = cheerio.load(html); const bugs = []; // 查找Bug链接 - 修正选择器 const bugLinks = $('a[href*="m=bug&f=view&bugID="]'); bugLinks.each((index, link) => { if (index >= limit) return false; const $link = $(link); const href = $link.attr('href'); const title = $link.text().trim(); // 提取Bug ID - 修正正则表达式 const match = href.match(/bugID=(\d+)/); const bugId = match ? match[1] : ''; // 获取当前行的其他信息 const $row = $link.closest('tr'); const severity = $row.find('.label-severity-custom').text().trim() || $row.find('[title*="严重程度"]').text().trim(); const priority = $row.find('.label-pri').text().trim(); const reporter = $row.find('td').eq(6).text().trim(); // 创建者列 const resolver = $row.find('td').eq(8).text().trim(); // 解决者列 const resolution = $row.find('td').eq(9).text().trim(); // 方案列 // 只处理有效的Bug if (bugId && parseInt(bugId) > 0 && title && title.length > 0) { bugs.push({ id: bugId, title: title, status: '', // 状态信息在这个页面中不直接显示 priority: priority, severity: severity, assignedTo: '', // 当前用户就是被指派人 reporter: reporter, resolver: resolver, resolution: resolution, created: '', url: href.startsWith('http') ? href : `${this.baseUrl}${href.replace(/^\.\//, '')}` }); } }); // 如果找到Bug,返回结果 if (bugs.length > 0) { return { success: true, total: bugs.length, bugs: bugs, type: type, message: `找到 ${bugs.length} 个${type}` }; } // 检查是否显示"暂时没有Bug" const emptyTip = $('.table-empty-tip').text().trim(); if (emptyTip.includes('暂时没有Bug')) { return { success: true, total: 0, bugs: [], type: type, message: `暂无${type}` }; } // 默认返回空结果 return { success: true, total: 0, bugs: [], type: type, message: `暂无${type}` }; }