testmo_get_case
Retrieve detailed information about a test case, including custom fields and Gherkin scenarios, by providing project and case IDs.
Instructions
Get full details of a specific test case, including custom fields and Gherkin scenarios.
Args: project_id: The project ID. case_id: The test case ID.
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:56-75 (handler)The actual handler function for the 'testmo_get_case' tool. It fetches all pages of cases from the project and iterates to find the case matching the given case_id, then returns its full details including custom fields and Gherkin scenarios.
@mcp.tool() async def testmo_get_case(project_id: int, case_id: int) -> dict[str, Any]: """Get full details of a specific test case, including custom fields and Gherkin scenarios. Args: project_id: The project ID. case_id: The test case ID. """ page = 1 while True: params: dict[str, Any] = {"page": page, "per_page": 100} result = await _request("GET", f"/projects/{project_id}/cases", params=params) for case in result.get("result", []): if case["id"] == case_id: return case if result.get("next_page") is None: break page += 1 await asyncio.sleep(RATE_LIMIT_DELAY) raise RuntimeError(f"Case {case_id} not found in project {project_id}") - testmo/tools/cases.py:56-56 (registration)The tool is registered via the @mcp.tool() decorator (line 56) on the testmo_get_case async function. The 'mcp' instance is a FastMCP server (defined in testmo/server.py line 6) and tools are automatically registered when the decorator is applied.
@mcp.tool() - testmo/client.py:25-49 (helper)The _request helper function used by testmo_get_case to make HTTP requests to the Testmo API. It handles authentication, JSON serialization, error handling, and response parsing.
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/server.py:1-7 (schema)The FastMCP server instance used for tool registration. The @mcp.tool() decorator registers functions as MCP tools.
from dotenv import load_dotenv from mcp.server.fastmcp import FastMCP load_dotenv() mcp = FastMCP("testmo-mcp") - testmo-mcp.py:1-23 (registration)Entry point that imports testmo.tools.cases (which triggers the @mcp.tool() decorator registration). All tool modules are imported here to ensure tools are registered on the mcp instance before running.
""" Testmo MCP Server — FastMCP implementation. Provides tools for AI assistants to manage test cases, folders, projects, runs, automation runs, attachments, and more via the Testmo REST API. """ from testmo.server import mcp # Import tool modules to register all tools on the mcp instance import testmo.tools.projects # noqa: F401 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")