Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNoMax results
statusNoFilter by statusactive

Implementation Reference

  • 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: [] };
      }
    }
  • 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 }
        }
      }
    },
  • 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)) }] };
  • 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}`
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ad19900913/mcp-rdms'

If you have feedback or need assistance with the MCP directory API, please join our Discord server