Skip to main content
Glama

getNextBug

Retrieve the next active bug assigned to you in a ZenTao product. Filter by keyword or status to prioritize bug resolution in project management workflows.

Instructions

Get the next active bug assigned to me under a product (first match).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdYesProduct ID (required)
keywordNoKeyword filter on bug title
statusNoStatus filter (e.g., active)

Implementation Reference

  • Handler implementation for 'getNextBug' tool: Paginates through up to 10 pages of bugs assigned to the current account in the specified product, filters by keyword and status, returns the first matching bug's details including extracted images from steps.
    if (name === "getNextBug") {
      const { productId, keyword, status } = args;
      let page = 1;
      const pageSize = 20;
      while (page <= 10) {
        const { bugs } = await fetchBugsByProduct({
          productId,
          keyword,
          status,
          limit: pageSize,
          page,
        });
        if (bugs.length) {
          const bugDetail = await getBugWithImages(bugs[0].id || bugs[0].bugId);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({ bug: bugDetail }, null, 2),
              },
            ],
          };
        }
        page += 1;
      }
      return {
        content: [
          {
            type: "text",
            text: `No active bugs assigned to ${account || "me"} found under product ${productId}`,
          },
        ],
      };
    }
  • Tool registration in the MCP tools list, including name, description, and input schema definition.
    {
      name: "getNextBug",
      description:
        "Get the next active bug assigned to me under a product (first match).",
      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)" },
        },
        required: ["productId"],
        additionalProperties: false,
      },
    },
  • Core helper function used by getNextBug to fetch and filter bugs assigned to the current user from ZenTao API, applying assignee, keyword, and status filters.
    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 };
    }
  • Helper to fetch bug details and extract image URLs from steps HTML.
    async function getBugWithImages(bugId) {
      const res = await callZenTao({ path: `bugs/${bugId}` });
      const bug = res.data || {};
      const stepsHtml = bug.steps || bug.stepsHtml || "";
      const stepsImages = parseImageSources(stepsHtml);
      return { ...bug, stepsHtml, stepsImages };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'next active bug' and 'first match', which hints at ordering and filtering behavior, but does not disclose critical details like how 'next' is determined (e.g., by priority, creation date), whether it's read-only or has side effects, or what happens if no bugs match. This leaves significant gaps for a tool with mutation potential (e.g., marking bugs as viewed).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get the next active bug assigned to me under a product') and adds clarifying detail ('first match') without any wasted words. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely returns bug data. It does not explain what 'next' means operationally, what data is returned, or error handling (e.g., if no bugs exist). For a tool with potential behavioral complexity, this leaves the agent under-informed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the three parameters (productId, keyword, status). The description adds no additional parameter semantics beyond implying that productId is used for 'under a product' and status might default to 'active'. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get'), resource ('next active bug'), and scope ('assigned to me under a product (first match)'). It distinguishes from siblings like getBugDetail (detailed view), getMyBug (specific bug), and getMyBugs (multiple bugs) by emphasizing the 'next' and 'first match' aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('assigned to me', 'under a product') but does not explicitly state when to use this tool versus alternatives like getMyBugs (for multiple bugs) or searchProducts (for product discovery). No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Valiant-Cat/zentao-mcp-server'

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