Bug Description
The check_trust method in joy_trust_tool.py reads trust fields from the top-level API response instead of from the agent object inside the agents array.
Current Code (Line ~166)
data = response.json()
trust_score = data.get("trust_score", 0.0) # ❌ Wrong - reads from top level
Actual API Response Format
{
"agents": [
{
"id": "ag_xxx",
"name": "AgentName",
"trust_score": 2.3,
"verified": true,
...
}
],
"count": 1
}
Fix
data = response.json()
agents = data.get("agents", [])
# Find matching agent by name
agent = None
for a in agents:
if a.get("name", "").lower() == agent_name.lower():
agent = a
break
# Fallback to first agent if exact match not found
if not agent and agents:
agent = agents[0]
if not agent:
return {
"agent_name": agent_name,
"trust_score": 0.0,
"verified": False,
"meets_threshold": False,
"error": f"Agent '{agent_name}' not found on Joy Trust Network"
}
trust_score = agent.get("trust_score", 0.0)
Impact
Without this fix, check_trust_score() always returns trust_score: 0.0 because it's reading from the wrong location in the response.
Related
Bug Description
The
check_trustmethod injoy_trust_tool.pyreads trust fields from the top-level API response instead of from the agent object inside theagentsarray.Current Code (Line ~166)
Actual API Response Format
{ "agents": [ { "id": "ag_xxx", "name": "AgentName", "trust_score": 2.3, "verified": true, ... } ], "count": 1 }Fix
Impact
Without this fix,
check_trust_score()always returnstrust_score: 0.0because it's reading from the wrong location in the response.Related