Skip to main content
Glama

testmo_get_cases_recursive

Recursively retrieve all test cases from a folder and its subfolders, returning a flat list with folder path and per-folder counts.

Instructions

Get all test cases from a folder and all subfolders in a single call.

Returns a flat list of cases annotated with folder name/path, plus per-folder counts.

Args: project_id: The project ID. folder_id: The root folder ID to collect cases from recursively. include_folder_path: Include folder path on each case (default: true).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
folder_idYes
include_folder_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'testmo_get_cases_recursive' tool. Decorated with @mcp.tool(), it fetches all folders, collects the subtree of folders under the given folder_id, then paginates through each folder's test cases. Returns a flat list of cases annotated with folder name/path, plus per-folder summary counts.
    @mcp.tool()
    async def testmo_get_cases_recursive(
        project_id: int,
        folder_id: int,
        include_folder_path: bool = True,
    ) -> dict[str, Any]:
        """Get all test cases from a folder and all subfolders in a single call.
    
        Returns a flat list of cases annotated with folder name/path, plus per-folder counts.
    
        Args:
            project_id: The project ID.
            folder_id: The root folder ID to collect cases from recursively.
            include_folder_path: Include folder path on each case (default: true).
        """
        all_folders = await _get_all_folders(project_id)
        folder_map = _build_folder_map(all_folders)
        if folder_id not in folder_map:
            return {"error": f"Folder {folder_id} not found in project {project_id}"}
    
        subtree_ids = _collect_subtree(all_folders, folder_id)
        all_cases: list[dict[str, Any]] = []
        folder_summary: list[dict[str, Any]] = []
    
        for fid in sorted(subtree_ids):
            cases_page: list[dict[str, Any]] = []
            page = 1
            while True:
                params: dict[str, Any] = {"page": page, "per_page": 100, "folder_id": fid}
                result = await _request(
                    "GET", f"/projects/{project_id}/cases", params=params
                )
                cases_page.extend(result.get("result", []))
                if result.get("next_page") is None:
                    break
                page += 1
                await asyncio.sleep(RATE_LIMIT_DELAY)
    
            folder_name = folder_map[fid]["name"] if fid in folder_map else str(fid)
            folder_path = _get_folder_path(fid, folder_map) if include_folder_path else None
    
            if cases_page:
                folder_summary.append({
                    "folder_id": fid,
                    "folder_name": folder_name,
                    "folder_path": folder_path,
                    "case_count": len(cases_page),
                })
    
            for case in cases_page:
                case["_folder_name"] = folder_name
                if include_folder_path:
                    case["_folder_path"] = folder_path
                all_cases.append(case)
    
            if len(subtree_ids) > 1:
                await asyncio.sleep(RATE_LIMIT_DELAY)
    
        return {
            "total_cases": len(all_cases),
            "total_folders_searched": len(subtree_ids),
            "folder_summary": folder_summary,
            "cases": all_cases,
        }
  • Tool registration via the @mcp.tool() decorator on the testmo_get_cases_recursive function.
    @mcp.tool()
  • Helper function '_collect_subtree' that returns a set of folder IDs in the subtree rooted at root_id (inclusive), used to find all folders to recurse into.
    def _collect_subtree(all_folders: list[dict[str, Any]], root_id: int) -> set[int]:
        """Return set of folder IDs in the subtree rooted at root_id (inclusive)."""
        children_map: dict[int, list[int]] = defaultdict(list)
        for f in all_folders:
            children_map[f.get("parent_id") or 0].append(f["id"])
        result = {root_id}
        stack = [root_id]
        while stack:
            current = stack.pop()
            for child_id in children_map.get(current, []):
                result.add(child_id)
                stack.append(child_id)
        return result
  • Helper function '_build_folder_map' that builds a folder_id-to-folder mapping dictionary.
    def _build_folder_map(all_folders: list[dict[str, Any]]) -> dict[int, dict[str, Any]]:
        return {f["id"]: f for f in all_folders}
  • Helper function '_get_folder_path' that constructs the full folder path string (e.g. 'Parent / Child') used to annotate cases.
    def _get_folder_path(folder_id: int, folder_map: dict[int, dict[str, Any]]) -> str:
        if folder_id not in folder_map:
            return ""
        folder = folder_map[folder_id]
        path_parts = [folder["name"]]
        parent_id = folder.get("parent_id")
        while parent_id and parent_id in folder_map:
            parent = folder_map[parent_id]
            path_parts.insert(0, parent["name"])
            parent_id = parent.get("parent_id")
        return " / ".join(path_parts)
Behavior4/5

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

With no annotations, the description bears full responsibility. It discloses the output format (flat list annotated with folder path, per-folder counts) and lists parameter purposes. It implies a read operation but does not explicitly state it is non-destructive.

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 short paragraph followed by a concise args list, front-loaded with the main action. Every sentence adds value without redundancy.

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

Completeness4/5

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

The tool has 3 parameters, an output schema, and a recursive retrieval function. The description covers the key behavioral aspects and return structure, though it could mention that it is a safe read operation.

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

Parameters4/5

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

The schema has no descriptions and 0% coverage, but the description provides meaningful context for each parameter (e.g., 'folder_id: The root folder ID to collect cases from recursively'). This compensates for the schema's lack of details.

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 tool retrieves all test cases from a folder recursively, distinguishing it from non-recursive and search-based siblings like testmo_list_cases and testmo_search_cases_recursive.

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 recursive retrieval but does not explicitly guide when to use this tool versus alternatives such as testmo_list_cases (non-recursive) or testmo_search_cases_recursive (filtered search).

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/strelec00/testmo-mcp'

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