import json def tool_result(http_status, envelope): # Minimal disclosure: do not forward raw wallet metadata or errors. if (http_status != 200 or not isinstance(envelope, dict) or envelope.get("ok") is not True or not isinstance(envelope.get("result"), dict)): return {"content": [{"type": "text", "text": "Balance query failed or unavailable."}], "isError": True} return {"content": [{"type": "text", "text": "Balance query succeeded; inspect authorized result locally."}], "isError": False} if __name__ == "__main__": # Synthetic response, not a live engine result. print(json.dumps(tool_result(200, {"ok": True, "result": {}}), indent=2))