Skip to main content
Glama

get_suite_hierarchy

Retrieve hierarchical test suite structures from Zebrunner Test Case Management with configurable depth and output formats for project organization.

Instructions

🌳 Get hierarchical test suite tree with configurable depth

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_keyYesProject key
root_suite_idNoStart from specific root suite
max_depthNoMaximum tree depth
formatNoOutput formatjson
include_clickable_linksNoInclude clickable links to Zebrunner web UI

Implementation Reference

  • Core handler function implementing the get_suite_hierarchy tool logic: fetches all suites, optionally filters descendants of a root suite, builds hierarchy tree using HierarchyProcessor, limits recursion depth, formats output, and handles errors.
    async getSuiteHierarchy(input: z.infer<typeof GetSuiteHierarchyInputSchema>) {
      const { projectKey, rootSuiteId, maxDepth, format } = input;
      
      try {
        const allSuites = await this.client.getAllTestSuites(projectKey);
        let suitesToProcess = allSuites;
    
        // Filter by root suite if specified
        if (rootSuiteId) {
          const descendants = HierarchyProcessor.getSuiteDescendants(rootSuiteId, allSuites);
          const rootSuite = allSuites.find(s => s.id === rootSuiteId);
          suitesToProcess = rootSuite ? [rootSuite, ...descendants] : descendants;
        }
    
        // Build hierarchical tree
        const hierarchyTree = HierarchyProcessor.buildSuiteTree(suitesToProcess);
        
        // Limit depth if specified
        const limitDepth = (suites: any[], currentDepth: number): any[] => {
          if (currentDepth >= maxDepth) {
            return suites.map(suite => ({ ...suite, children: [] }));
          }
          
          return suites.map(suite => ({
            ...suite,
            children: suite.children ? limitDepth(suite.children, currentDepth + 1) : []
          }));
        };
    
        const limitedTree = limitDepth(hierarchyTree, 0);
        const formattedData = FormatProcessor.format(limitedTree, format);
        
        return {
          content: [
            {
              type: "text" as const,
              text: typeof formattedData === 'string' ? formattedData : JSON.stringify(formattedData, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error retrieving suite hierarchy: ${error.message}`
            }
          ]
        };
      }
    }
  • Zod input schema defining parameters for the get_suite_hierarchy tool: projectKey (required), rootSuiteId (optional), maxDepth (default 5, max 10), format (default 'json').
    export const GetSuiteHierarchyInputSchema = z.object({
      projectKey: z.string().min(1),
      rootSuiteId: z.number().int().positive().optional(),
      maxDepth: z.number().int().positive().max(10).default(5),
      format: z.enum(['dto', 'json', 'string']).default('json')
    });
  • MCP server tool registration for 'get_suite_hierarchy', including inline schema validation and binding to ZebrunnerToolHandlers.getSuiteHierarchy method.
    server.tool(
      "get_suite_hierarchy",
      "Get hierarchical test suite tree with configurable depth",
      {
        projectKey: z.string().min(1),
        rootSuiteId: z.number().int().positive().optional(),
        maxDepth: z.number().int().positive().max(10).default(5),
        format: z.enum(['dto', 'json', 'string']).default('json')
      },
      async (args) => toolHandlers.getSuiteHierarchy(args)
    );
  • Key helper methods used by the handler: buildSuiteTree constructs the hierarchical tree from flat suite list, getSuiteDescendants retrieves all descendant suites for a given root suite ID.
    static buildSuiteTree(suites: ZebrunnerTestSuite[]): ZebrunnerTestSuite[] {
      const suiteMap = new Map<number, ZebrunnerTestSuite>();
      const rootSuites: ZebrunnerTestSuite[] = [];
    
      // First pass: create map and initialize children arrays
      suites.forEach(suite => {
        suiteMap.set(suite.id, { ...suite, children: [] });
      });
    
      // Second pass: build parent-child relationships
      suites.forEach(suite => {
        const suiteWithChildren = suiteMap.get(suite.id)!;
        
        // Handle self-referencing suites (treat them as root suites)
        if (suite.parentSuiteId === suite.id) {
          console.error(`⚠️  Self-referencing suite detected: ${suite.id} (${suite.title || suite.name})`);
          // Set parentSuiteId to null for self-referencing suites
          suiteWithChildren.parentSuiteId = null;
          rootSuites.push(suiteWithChildren);
        } else if (suite.parentSuiteId && suiteMap.has(suite.parentSuiteId)) {
          const parent = suiteMap.get(suite.parentSuiteId)!;
          parent.children = parent.children || [];
          parent.children.push(suiteWithChildren);
        } else {
          rootSuites.push(suiteWithChildren);
        }
      });
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'configurable depth' which hints at a behavioral trait, but doesn't disclose important aspects like whether this is a read-only operation, potential performance impacts with deep trees, authentication needs, rate limits, or what the hierarchical output looks like. The description is minimal and leaves key behavioral questions unanswered.

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 perfectly concise - a single sentence with an emoji that reinforces the tree concept. Every word earns its place: 'Get' (action), 'hierarchical test suite tree' (resource and structure), 'with configurable depth' (key capability). No wasted words or redundant information.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the hierarchical output looks like, how to interpret the tree structure, performance considerations with depth, or relationships with sibling tools. The 100% schema coverage helps, but the description should provide more context about the tool's behavior and output.

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 5 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain relationships between parameters (e.g., how root_suite_id interacts with project_key) or provide usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 action ('Get hierarchical test suite tree') and the resource ('test suite'), with the emoji reinforcing the tree concept. It distinguishes from siblings by specifying 'hierarchical' and 'tree', unlike other tools like 'get_all_subsuites' or 'list_test_suites' that might return flat lists.

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 for retrieving hierarchical structures with depth control, but doesn't explicitly state when to use this versus alternatives like 'get_all_subsuites' or 'get_root_suites'. It provides some context through 'configurable depth' but lacks explicit when/when-not guidance or named alternatives.

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/maksimsarychau/mcp-zebrunner'

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