Skip to main content
Glama

getBugStats

Retrieve bug statistics for a specific product in ZenTao, showing total and active bug counts assigned to you.

Instructions

Get counts of bugs assigned to me under a product (total and active).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdYesProduct ID (required)
activeOnlyNoIf true, only active count is returned

Implementation Reference

  • Main execution logic for the getBugStats tool: fetches bugs via helper, computes total and active counts, returns structured JSON.
    if (name === "getBugStats") {
      const { productId, activeOnly = false } = args;
      const { bugs } = await fetchBugsByProduct({
        productId,
        allStatuses: !activeOnly,
        limit: 200,
      });
      const total = bugs.length;
      const active = bugs.filter((b) => (b.status || b.state || "").toLowerCase() === "active")
        .length;
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ productId, total, active }, null, 2),
          },
        ],
      };
    }
  • Tool registration in the MCP server's ListTools response, defining name, description, and input schema.
    {
      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,
      },
    },
  • Input schema for validating getBugStats tool arguments: requires productId, optional activeOnly boolean.
    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,
    },
  • Core helper function to fetch and filter bugs by product, assignee (current account), keyword, and status. Critical for getBugStats implementation.
    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 states the tool returns counts (total and active), which is useful, but lacks details on permissions (e.g., if it requires authentication), rate limits, error handling, or response format. For a tool with no annotations, this is a significant gap, earning a 2 as it provides basic output info but misses critical behavioral traits.

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 key information ('Get counts of bugs assigned to me under a product') and adds necessary detail ('total and active'). There is no wasted text, making it appropriately sized and well-structured for quick understanding, earning a 5 for conciseness.

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 (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and output types (counts), but lacks details on return values, error cases, or integration with siblings. Without annotations or output schema, more context on behavior would improve completeness, resulting in a 3 for being functional but incomplete.

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%, with clear documentation for both parameters (productId as required number, activeOnly as optional boolean with default). The description adds marginal value by implying the product context and active/total counts, but doesn't explain parameter interactions or semantics beyond what the schema provides. Baseline is 3 when schema does the heavy lifting.

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 with a specific verb ('Get counts') and resource ('bugs assigned to me under a product'), including scope details ('total and active'). It distinguishes from siblings like getBugDetail (detailed info) or getMyBugs (list bugs), but doesn't explicitly name alternatives. This earns a 4 for clear purpose without explicit sibling differentiation.

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 by specifying 'bugs assigned to me under a product,' suggesting it's for personal bug statistics in a product context. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like getMyBugs (which might list bugs rather than count them) or markBugResolved (for updates). No exclusions or prerequisites are mentioned, resulting in a 3 for implied usage.

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