Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -166,7 +166,11 @@ def call_mcp_tool(tool_name, arguments):
|
|
| 166 |
)
|
| 167 |
|
| 168 |
if response.status_code == 200:
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
else:
|
| 171 |
return {"error": f"HTTP {response.status_code}", "detail": response.text[:200]}
|
| 172 |
except Exception as e:
|
|
|
|
| 166 |
)
|
| 167 |
|
| 168 |
if response.status_code == 200:
|
| 169 |
+
data = response.json()
|
| 170 |
+
# 解包 JSON-RPC 响应,只返回 result 字段给模型
|
| 171 |
+
if isinstance(data, dict) and "result" in data:
|
| 172 |
+
return data["result"]
|
| 173 |
+
return data
|
| 174 |
else:
|
| 175 |
return {"error": f"HTTP {response.status_code}", "detail": response.text[:200]}
|
| 176 |
except Exception as e:
|