testmo_get_milestone
Retrieve details of a milestone by its ID. Optionally expand related entities for more context.
Instructions
Get details of a specific milestone by ID.
Args: milestone_id: The milestone ID. expands: Related entities to include.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| milestone_id | Yes | ||
| expands | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/milestones.py:32-49 (handler)The tool handler function that executes the testmo_get_milestone logic. Decorated with @mcp.tool(), it takes milestone_id and optional expands, makes a GET request to /milestones/{milestone_id}, and returns the result.
@mcp.tool() async def testmo_get_milestone( milestone_id: int, expands: list[str] | None = None, ) -> dict[str, Any]: """Get details of a specific milestone by ID. Args: milestone_id: The milestone ID. expands: Related entities to include. """ params: dict[str, Any] = {} if expands: params["expands"] = ",".join(expands) result = await _request( "GET", f"/milestones/{milestone_id}", params=params if params else None ) return result.get("result", result) - testmo/tools/milestones.py:32-33 (registration)The tool is registered via the @mcp.tool() decorator on the async function, which binds it to the FastMCP server instance.
@mcp.tool() async def testmo_get_milestone( - testmo-mcp.py:13-13 (registration)The import of testmo.tools.milestones in the main entrypoint triggers the @mcp.tool() decorator, registering the tool on the MCP server.
import testmo.tools.milestones # noqa: F401 - testmo/client.py:25-49 (helper)The _request helper function used by the handler 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/tools/milestones.py:33-36 (schema)The function signature defines the input schema: milestone_id (int, required) and expands (optional list of strings). Returns a dict.
async def testmo_get_milestone( milestone_id: int, expands: list[str] | None = None, ) -> dict[str, Any]: