get_async_run_result
Retrieve the result of an asynchronous run by specifying a run ID, enabling integration between ACP-based AI agents and MCP-compatible systems.
Instructions
Get the result of an asynchronous run
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | Yes |
Implementation Reference
- The @mcp.tool()-decorated handler function that implements the core logic of get_async_run_result. It queries the run status, processes the output messages, and returns a formatted JSON result.@mcp.tool() async def get_async_run_result(run_id: str) -> str: """Get the result of an asynchronous run""" try: run = await orchestrator.get_run_status(run_id) result = { "run_id": run.run_id, "agent_name": run.agent_name, "status": run.status, "has_output": len(run.output) > 0, "error": run.error } if run.status == RunStatus.COMPLETED and run.output: # Convert output to readable format output_text = "" for message in run.output: if isinstance(message, dict) and "parts" in message: for part in message["parts"]: if isinstance(part, dict) and "content" in part: output_text += part["content"] + "\n" result["output"] = output_text.strip() if output_text else "No text content" return json.dumps(result, indent=2) except Exception as e: return f"Error: {e}"
- acp_mcp_server/server.py:87-87 (registration)Invocation of register_orchestrator_tools which defines and registers the get_async_run_result tool (along with related tools) with the FastMCP server instance.register_orchestrator_tools(self.mcp, self.orchestrator)