MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / performHealthCheck

Method performHealthCheck

server/src/health.ts:28–47  ·  view source on GitHub ↗
(agent: Agent)

Source from the content-addressed store, hash-verified

26 }
27
28 private async performHealthCheck(agent: Agent): Promise<AgentHealth> {
29 const startTime = Date.now();
30 const protocol = agent.protocol || "mcp";
31
32 // Only try the protocol the agent declares
33 const health = protocol === "a2a"
34 ? await this.tryA2A(agent, startTime)
35 : await this.tryMCP(agent, startTime);
36
37 logOutboundRequest({
38 agent_url: agent.url,
39 request_type: 'health_check',
40 user_agent: AAO_UA_HEALTH_CHECK,
41 response_time_ms: health.response_time_ms ?? (Date.now() - startTime),
42 success: health.online,
43 error_message: health.error,
44 });
45
46 return health;
47 }
48
49 private async tryMCP(agent: Agent, startTime: number): Promise<AgentHealth> {
50 try {

Callers 1

checkHealthMethod · 0.95

Calls 4

tryA2AMethod · 0.95
tryMCPMethod · 0.95
logOutboundRequestFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected