testmo_delete_case
Delete a test case by specifying the project ID and case ID to remove it from your Testmo project.
Instructions
Delete a test case.
Args: project_id: The project ID. case_id: The test case ID to delete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| case_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/cases.py:261-271 (handler)The handler function for the 'testmo_delete_case' tool. It calls the Testmo API with a DELETE request to /projects/{project_id}/cases with the case_id wrapped in an 'ids' array.
@mcp.tool() async def testmo_delete_case(project_id: int, case_id: int) -> dict[str, Any]: """Delete a test case. Args: project_id: The project ID. case_id: The test case ID to delete. """ return await _request( "DELETE", f"/projects/{project_id}/cases", data={"ids": [case_id]} ) - testmo/tools/cases.py:1-6 (helper)Imports for the handler: mcp from server, _request from client, and configuration constants.
import asyncio from typing import Any from ..server import mcp from ..client import _request from ..config import RATE_LIMIT_DELAY, MAX_CASES_PER_REQUEST - testmo/server.py:1-6 (registration)The mcp instance is created here via FastMCP and is used as the decorator @mcp.tool() to register the tool.
from dotenv import load_dotenv from mcp.server.fastmcp import FastMCP load_dotenv() mcp = FastMCP("testmo-mcp") - testmo-mcp.py:14-14 (registration)Entry point that imports testmo.tools.cases, which triggers registration of the testmo_delete_case tool on the mcp instance.
import testmo.tools.cases # noqa: F401 - testmo/client.py:25-49 (helper)The _request helper function that executes the HTTP DELETE request to the Testmo API endpoint.
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()