rdms_get_my_market_bugs
Retrieve market bug reports assigned to your user from the Zentao bug tracking system. Specify result limits to streamline bug management and prioritize tasks efficiently.
Instructions
Get market bugs assigned to current user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results |
Implementation Reference
- index.js:113-122 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'rdms_get_my_market_bugs', description: 'Get market bugs assigned to current user', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Max results', default: 20 } } } },
- index.js:150-151 (registration)Tool dispatch case in CallToolRequestSchema switch statement.case 'rdms_get_my_market_bugs': return { content: [{ type: 'text', text: JSON.stringify(await this.getMyMarketBugs(args.limit)) }] };
- index.js:777-786 (handler)Core handler function that performs HTTP request to fetch user's market bugs and delegates parsing.async getMyMarketBugs(limit = 20) { await this.ensureLoggedIn(); try { const marketBugsUrl = `${this.baseUrl}/index.php?m=bugmarket&f=browse&productid=0&branch=0&browseType=assigntome`; const response = await this.client.get(marketBugsUrl); return this.parseBugList(response.data, limit, '市场Bug'); } catch (error) { return { success: false, error: error.message, bugs: [] }; } }
- index.js:789-865 (helper)Helper function that parses the HTML response from RDMS into a structured list of bugs.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}` }; }