getMyBugs
Retrieve bugs assigned to you in a ZenTao product. Filter by status or keyword to manage bug tracking and resolution.
Instructions
List bugs assigned to me under a product. Defaults to active bugs only.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | Product ID (required) | |
| keyword | No | Keyword filter on bug title | |
| status | No | Status filter (e.g., active) | |
| allStatuses | No | Include non-active bugs | |
| limit | No | Max items |
Implementation Reference
- src/zentao-mcp-server.js:646-663 (handler)Handler implementation for the 'getMyBugs' tool within the CallToolRequestSchema handler. Extracts arguments, invokes fetchBugsByProduct helper, and formats the response as JSON.if (name === "getMyBugs") { const { productId, keyword, status, allStatuses = false, limit = 20 } = args; const { bugs, raw } = await fetchBugsByProduct({ productId, keyword, allStatuses, status, limit, }); return { content: [ { type: "text", text: JSON.stringify({ bugs, raw }, null, 2), }, ], }; }
- src/zentao-mcp-server.js:460-480 (registration)Registration of the 'getMyBugs' tool in the ListToolsRequestSchema response, including name, description, and input schema.{ name: "getMyBugs", description: "List bugs assigned to me under a product. Defaults to active bugs only.", inputSchema: { type: "object", properties: { productId: { type: "number", description: "Product ID (required)" }, keyword: { type: "string", description: "Keyword filter on bug title" }, status: { type: "string", description: "Status filter (e.g., active)" }, allStatuses: { type: "boolean", description: "Include non-active bugs", default: false, }, limit: { type: "number", description: "Max items", default: 20 }, }, required: ["productId"], additionalProperties: false, }, },
- src/zentao-mcp-server.js:235-280 (helper)Core helper function fetchBugsByProduct that queries ZenTao API for bugs in a product, filters by assignee matching current account, keyword, and status.async function fetchBugsByProduct({ productId, keyword, allStatuses = false, status, limit = 20, page = 1, }) { const res = await callZenTao({ // Use /bugs with product filter; works better for assignedTo filtering. path: "bugs", query: { page, limit, product: productId, keywords: keyword, }, }); const bugs = extractArray(res.data, ["bugs"]); const accountLower = (account || "").trim().toLowerCase(); const statusLower = status ? String(status).trim().toLowerCase() : null; const filtered = bugs.filter((bug) => { const assignedCandidates = [ ...normalizeAccount(bug.assignedTo), ...normalizeAccount(bug.assignedToName), ...normalizeAccount(bug.assignedToRealname), ]; const matchAssignee = accountLower ? assignedCandidates.includes(accountLower) : true; const matchKeyword = keyword ? `${bug.title || bug.name || ""}` .toLowerCase() .includes(keyword.toLowerCase()) : true; const matchStatus = allStatuses ? true : statusLower ? String(bug.status || bug.state || "") .trim() .toLowerCase() === statusLower : true; return matchAssignee && matchKeyword && matchStatus; }); return { bugs: filtered, raw: res.data }; }