Skip to main content
Glama

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
NameRequiredDescriptionDefault
run_idYes

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}"
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GongRzhe/ACP-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server