testmo_get_automation_source
Retrieve details of an automation source by providing its ID. Optionally include related entities.
Instructions
Get details of a specific automation source.
Args: automation_source_id: The automation source ID. expands: Related entities to include.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| automation_source_id | Yes | ||
| expands | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- testmo/tools/automation.py:34-53 (handler)The tool handler function for 'testmo_get_automation_source'. It sends a GET request to /automation/sources/{automation_source_id} with optional expands parameter, and returns the 'result' sub-object from the response if present.
@mcp.tool() async def testmo_get_automation_source( automation_source_id: int, expands: list[str] | None = None, ) -> dict[str, Any]: """Get details of a specific automation source. Args: automation_source_id: The automation source ID. expands: Related entities to include. """ params: dict[str, Any] = {} if expands: params["expands"] = ",".join(expands) result = await _request( "GET", f"/automation/sources/{automation_source_id}", params=params if params else None, ) return result.get("result", result) - testmo/tools/automation.py:34-34 (registration)The @mcp.tool() decorator registers this function as an MCP tool on the FastMCP server instance.
@mcp.tool() - testmo/server.py:1-7 (registration)The MCP server instance (FastMCP) on which tools are registered via the @mcp.tool() decorator.
from dotenv import load_dotenv from mcp.server.fastmcp import FastMCP load_dotenv() mcp = FastMCP("testmo-mcp") - testmo-mcp.py:17-17 (registration)The import that triggers tool registration by importing the automation module.
import testmo.tools.automation # noqa: F401 - testmo/client.py:25-49 (helper)The _request helper function used by the tool handler to execute the HTTP 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()