testmo_list_cases
Retrieve test cases from a project or specific folder with pagination. Specify project ID, optional folder filter, and page parameters.
Instructions
List test cases in a project or folder. Supports pagination.
Args: project_id: The project ID. folder_id: Filter by folder ID (optional). page: Page number (default: 1). per_page: Results per page (default: 100). Valid: 25, 50, 100.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| folder_id | No | ||
| page | No | ||
| per_page | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/cases.py:9-27 (handler)The main handler function for testmo_list_cases tool. Registered via @mcp.tool() decorator. Makes a GET request to /projects/{project_id}/cases with optional folder_id filter and pagination support (page, per_page).
@mcp.tool() async def testmo_list_cases( project_id: int, folder_id: int | None = None, page: int = 1, per_page: int = 100, ) -> dict[str, Any]: """List test cases in a project or folder. Supports pagination. Args: project_id: The project ID. folder_id: Filter by folder ID (optional). page: Page number (default: 1). per_page: Results per page (default: 100). Valid: 25, 50, 100. """ params: dict[str, Any] = {"page": page, "per_page": per_page} if folder_id is not None: params["folder_id"] = folder_id return await _request("GET", f"/projects/{project_id}/cases", params=params) - testmo/server.py:6-6 (registration)The mcp FastMCP instance ('testmo-mcp') used by the @mcp.tool() decorator to register testmo_list_cases.
mcp = FastMCP("testmo-mcp") - testmo-mcp.py:14-14 (registration)Import of testmo.tools.cases module which triggers registration of testmo_list_cases via the @mcp.tool() decorator.
import testmo.tools.cases # noqa: F401 - testmo/client.py:25-49 (helper)The _request helper function used by testmo_list_cases to make HTTP requests to the Testmo API.
async def _request( method: str, endpoint: str, data: dict[str, Any] | None = None, params: dict[str, Any] | None = None, ) -> dict[str, Any]: async with _get_client() as client: response = await client.request( method=method, url=endpoint, json=data, params=params, ) if response.status_code == 204: return {"success": True} if response.status_code >= 400: try: error_body = response.json() except Exception: error_body = response.text raise RuntimeError( f"Testmo API error {response.status_code}: " f"{json.dumps(error_body) if isinstance(error_body, dict) else error_body}" ) return response.json() - testmo/config.py:1-9 (helper)Configuration constants (RATE_LIMIT_DELAY, MAX_CASES_PER_REQUEST) used by the cases module.
import os from typing import Any TESTMO_URL = os.environ.get("TESTMO_URL", "").rstrip("/") TESTMO_API_KEY = os.environ.get("TESTMO_API_KEY", "") REQUEST_TIMEOUT = 30.0 UPLOAD_TIMEOUT = 300.0 RATE_LIMIT_DELAY = 0.5 MAX_CASES_PER_REQUEST = 100