testmo_delete_folder
Delete a folder and all its test cases from a Testmo project. Provide project ID and folder ID to permanently remove the folder.
Instructions
Delete a folder from a project. WARNING: This also deletes all test cases in the folder.
Args: project_id: The project ID. folder_id: The folder ID to delete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| folder_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/folders.py:125-135 (handler)The handler function for testmo_delete_folder tool. It sends a DELETE request to the Testmo API to delete a folder (and all its test cases) by project_id and folder_id.
@mcp.tool() async def testmo_delete_folder(project_id: int, folder_id: int) -> dict[str, Any]: """Delete a folder from a project. WARNING: This also deletes all test cases in the folder. Args: project_id: The project ID. folder_id: The folder ID to delete. """ return await _request( "DELETE", f"/projects/{project_id}/folders", data={"ids": [folder_id]} ) - testmo/tools/folders.py:125-125 (registration)The @mcp.tool() decorator registers testmo_delete_folder as an MCP tool on the FastMCP instance imported from testmo.server.
@mcp.tool() - testmo-mcp.py:12-23 (registration)The tools.folders module (containing testmo_delete_folder) is imported in testmo-mcp.py, which triggers registration of all @mcp.tool() decorated functions.
import testmo.tools.folders # noqa: F401 import testmo.tools.milestones # noqa: F401 import testmo.tools.cases # noqa: F401 import testmo.tools.runs # noqa: F401 import testmo.tools.attachments # noqa: F401 import testmo.tools.automation # noqa: F401 import testmo.tools.issues # noqa: F401 import testmo.tools.composite # noqa: F401 import testmo.tools.utility # noqa: F401 if __name__ == "__main__": mcp.run(transport="stdio") - testmo/client.py:25-49 (helper)The _request helper function used by testmo_delete_folder to execute the HTTP DELETE 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/tools/folders.py:129-132 (schema)Input schema documentation for the tool: expects project_id (int) and folder_id (int).
Args: project_id: The project ID. folder_id: The folder ID to delete. """