Skip to main content
Glama

getMyBug

Retrieve your first active bug assigned in a ZenTao product to address issues promptly. Filter by product name, keyword, or status for targeted bug management.

Instructions

Get the first active bug assigned to me in a product (by productName). Returns full bug detail.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productNameYesProduct name to match (required)
keywordNoKeyword filter on bug title
statusNoStatus filter (e.g., active)
allStatusesNoInclude non-active bugs

Implementation Reference

  • Handler function for the 'getMyBug' tool. Finds a product by name, retrieves the first active bug assigned to the current account in that product, fetches detailed bug information including extracted image URLs from steps HTML, and returns JSON with product and bug details.
    if (name === "getMyBug") {
      const { productName, keyword, status, allStatuses = false } = args;
      const { product, matches } = await findProductByName(productName);
      if (!product) {
        const names = matches.map((p) => `${p.id}:${p.name}`).join(", ");
        throw new Error(
          matches.length === 0
            ? `No product matched "${productName}"`
            : `Multiple products matched "${productName}", please specify one of: ${names}`
        );
      }
      const { bugs } = await fetchBugsByProduct({
        productId: product.id,
        keyword,
        status,
        allStatuses,
        limit: 1,
      });
      if (!bugs.length) {
        return {
          content: [
            {
              type: "text",
              text: `No active bugs assigned to ${account || "me"} in product "${product.name}"`,
            },
          ],
        };
      }
      const bugDetail = await getBugWithImages(bugs[0].id || bugs[0].bugId);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              { product: { id: product.id, name: product.name }, bug: bugDetail },
              null,
              2
            ),
          },
        ],
      };
    }
  • Schema definition for the 'getMyBug' tool, including input schema with required 'productName' and optional parameters for filtering bugs.
    {
      name: "getMyBug",
      description:
        "Get the first active bug assigned to me in a product (by productName). Returns full bug detail.",
      inputSchema: {
        type: "object",
        properties: {
          productName: { type: "string", description: "Product name to match (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,
          },
        },
        required: ["productName"],
        additionalProperties: false,
      },
    },
  • Registration of the 'getMyBug' tool in the list of available tools returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "get_token",
          description: "Fetch a token via POST /tokens using env ZENTAO_ACCOUNT/PASSWORD. Caches in-memory.",
          inputSchema: {
            type: "object",
            properties: {
              forceRefresh: { type: "boolean", description: "Ignore cached token" },
            },
            required: [],
            additionalProperties: false,
          },
        },
        {
          name: "call",
          description:
            "Call any ZenTao RESTful API endpoint (api.php/v1). Automatically injects Token header. Paths accept leading slash or relative.",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Relative path, e.g. /projects or projects/1" },
              method: {
                type: "string",
                description: "HTTP verb",
                enum: ["GET", "POST", "PUT", "PATCH", "DELETE"],
                default: "GET",
              },
              query: { type: "object", description: "Query params object", additionalProperties: true },
              body: { type: "object", description: "JSON body", additionalProperties: true },
              forceTokenRefresh: {
                type: "boolean",
                description: "Refresh token before request",
              },
            },
            required: ["path"],
            additionalProperties: false,
          },
        },
        {
          name: "listMyProjects",
          description: "List projects related to the current account (PM/PO/QD/RD/assigned/team).",
          inputSchema: {
            type: "object",
            properties: {
              keyword: { type: "string", description: "Filter by project name keyword" },
              limit: { type: "number", description: "Max items", default: 50 },
            },
            required: [],
            additionalProperties: false,
          },
        },
        {
          name: "searchProducts",
          description: "Search products by keyword; returns a short list of products.",
          inputSchema: {
            type: "object",
            properties: {
              keyword: { type: "string", description: "Keyword to match product name" },
              limit: { type: "number", description: "Max items", default: 20 },
            },
            required: [],
            additionalProperties: false,
          },
        },
        {
          name: "getMyBug",
          description:
            "Get the first active bug assigned to me in a product (by productName). Returns full bug detail.",
          inputSchema: {
            type: "object",
            properties: {
              productName: { type: "string", description: "Product name to match (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,
              },
            },
            required: ["productName"],
            additionalProperties: false,
          },
        },
        {
          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,
          },
        },
        {
          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,
          },
        },
        {
          name: "getBugStats",
          description:
            "Get counts of bugs assigned to me under a product (total and active).",
          inputSchema: {
            type: "object",
            properties: {
              productId: { type: "number", description: "Product ID (required)" },
              activeOnly: {
                type: "boolean",
                description: "If true, only active count is returned",
                default: false,
              },
            },
            required: ["productId"],
            additionalProperties: false,
          },
        },
        {
          name: "getBugDetail",
          description:
            "Get bug detail by ID; also extracts image URLs from steps HTML into stepsImages.",
          inputSchema: {
            type: "object",
            properties: {
              bugId: { type: "number", description: "Bug ID (required)" },
            },
            required: ["bugId"],
            additionalProperties: false,
          },
        },
        {
          name: "markBugResolved",
          description: "Mark a bug as resolved (resolution=fixed).",
          inputSchema: {
            type: "object",
            properties: {
              bugId: { type: "number", description: "Bug ID (required)" },
              comment: { type: "string", description: "Resolution comment" },
            },
            required: ["bugId"],
            additionalProperties: false,
          },
        },
      ],
    }));
  • Helper function to fetch bug details and extract image URLs from steps HTML, used in getMyBug handler.
    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 };
    }
  • Core helper to fetch and filter bugs assigned to the current account in a product, used by getMyBug.
    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 };
    }
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 of behavioral disclosure. It mentions that it returns 'full bug detail,' which adds some context about the output. However, it doesn't describe key behaviors such as what 'active' means (e.g., status definitions), how 'first' is determined (e.g., by creation date, priority), authentication requirements, error handling, or rate limits. For a read operation with no annotation coverage, this leaves significant gaps in transparency.

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

Conciseness4/5

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

The description is concise and front-loaded, consisting of a single sentence that states the core purpose and output. It avoids unnecessary words and gets straight to the point. However, it could be slightly more structured by separating usage notes or behavioral details, but as is, it's efficient with minimal waste.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is partially complete. It covers the basic purpose and output but lacks details on behavioral traits, parameter interactions, and comparison to siblings. Without annotations or output schema, more context on how the tool behaves and what it returns would improve completeness, making it adequate but with clear gaps.

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 already documents all 4 parameters thoroughly. The description adds minimal value beyond the schema: it mentions 'productName' as required and implies filtering by 'active' status, but doesn't explain parameter interactions (e.g., how 'status' and 'allStatuses' relate) or provide additional semantics. With high schema coverage, the baseline is 3, and the description doesn't significantly enhance understanding.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get the first active bug assigned to me in a product (by productName). Returns full bug detail.' It specifies the verb ('Get'), resource ('bug'), and scope ('assigned to me', 'first active', 'in a product'). However, it doesn't explicitly differentiate from siblings like 'getMyBugs' (plural) or 'getBugDetail', which might retrieve multiple bugs or any bug respectively, leaving some ambiguity.

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: it's for retrieving a single active bug assigned to the user in a specific product. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'getMyBugs' (for multiple bugs) or 'getBugDetail' (for a specific bug by ID), nor does it mention prerequisites or exclusions. The usage is clear but lacks comparative direction.

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