testmo_create_cases
Create up to 100 test cases in a batch by specifying required fields like name, folder, priority, type, and creator. Streamline test case generation for your Testmo projects.
Instructions
Create multiple test cases in a batch (max 100 per call).
Each case object MUST include these fields or the API will silently reject it:
name: Test case title
folder_id: Target folder ID (0 for root)
custom_priority: Priority ID (52=Critical, 1=High, 2=Medium, 3=Low)
custom_type: Type ID (59=Functional, 64=Acceptance, 55=Security)
custom_creator: Creator ID (51=AI Generated)
Optional: template_id, state_id, tags, issues, configurations, custom_feature, etc.
Args: project_id: The project ID. cases: Array of test case objects (max 100).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| cases | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/cases.py:108-135 (handler)Handler function for the testmo_create_cases tool. Creates multiple test cases in a batch (max 100 per call) via POST to /projects/{project_id}/cases. Validates that the number of cases does not exceed MAX_CASES_PER_REQUEST (100).
@mcp.tool() async def testmo_create_cases( project_id: int, cases: list[dict[str, Any]], ) -> dict[str, Any]: """Create multiple test cases in a batch (max 100 per call). Each case object MUST include these fields or the API will silently reject it: - name: Test case title - folder_id: Target folder ID (0 for root) - custom_priority: Priority ID (52=Critical, 1=High, 2=Medium, 3=Low) - custom_type: Type ID (59=Functional, 64=Acceptance, 55=Security) - custom_creator: Creator ID (51=AI Generated) Optional: template_id, state_id, tags, issues, configurations, custom_feature, etc. Args: project_id: The project ID. cases: Array of test case objects (max 100). """ if len(cases) > MAX_CASES_PER_REQUEST: raise ValueError( f"Too many cases: {len(cases)}. Max is {MAX_CASES_PER_REQUEST}. " "Use testmo_batch_create_cases for larger batches." ) return await _request( "POST", f"/projects/{project_id}/cases", data={"cases": cases} ) - testmo/tools/cases.py:108-108 (registration)Registration of testmo_create_cases as an MCP tool via the @mcp.tool() decorator. The 'mcp' instance is a FastMCP server defined in testmo/server.py.
@mcp.tool() - testmo/tools/cases.py:109-112 (schema)Input schema: accepts project_id (int) and cases (list of dicts, max 100). Output is a dict[str, Any].
async def testmo_create_cases( project_id: int, cases: list[dict[str, Any]], ) -> dict[str, Any]: - testmo/client.py:25-49 (helper)The _request helper function used by testmo_create_cases to make the actual HTTP POST request 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:9-9 (helper)Configuration constant MAX_CASES_PER_REQUEST = 100, used by testmo_create_cases to validate the maximum batch size.
MAX_CASES_PER_REQUEST = 100