get_task_run
Retrieve detailed information about a specific Prefect task run using its unique identifier to monitor execution status and access run metadata.
Instructions
Get details of a specific task run by ID.
Args: task_run_id: The task run UUID
Returns: Task run details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_run_id | Yes |
Implementation Reference
- src/mcp_prefect/task_run.py:131-151 (handler)The handler function for the 'get_task_run' MCP tool. It retrieves details of a specific task run by its ID using the Prefect client, adds a UI URL, and returns the information as text content.@mcp.tool async def get_task_run( task_run_id: str, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: """ Get details of a specific task run by ID. Args: task_run_id: The task run UUID Returns: Task run details """ async with get_client() as client: task_run = await client.read_task_run(UUID(task_run_id)) # Add UI link task_run_dict = task_run.model_dump() task_run_dict["ui_url"] = get_task_run_url(task_run_id) return [types.TextContent(type="text", text=str(task_run_dict))]
- src/mcp_prefect/task_run.py:25-27 (helper)Helper function to generate the UI URL for a task run, used within the get_task_run handler and others.def get_task_run_url(task_run_id: str) -> str: base_url = PREFECT_API_URL.replace("/api", "") return f"{base_url}/task-runs/{task_run_id}"