Spaces:
Sleeping
Sleeping
Update orchestrator/client.py
Browse files- orchestrator/client.py +11 -12
orchestrator/client.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# MCPClient implementation
|
| 2 |
# File: orchestrator/client.py
|
| 3 |
import requests
|
| 4 |
import uuid
|
|
@@ -12,15 +11,15 @@ class MCPClient:
|
|
| 12 |
|
| 13 |
def call(self, method: str, params: dict = None):
|
| 14 |
payload = {
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
}
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
data =
|
| 23 |
-
if
|
| 24 |
-
err = data[
|
| 25 |
-
raise RuntimeError(err.get(
|
| 26 |
-
return data.get(
|
|
|
|
|
|
|
| 1 |
# File: orchestrator/client.py
|
| 2 |
import requests
|
| 3 |
import uuid
|
|
|
|
| 11 |
|
| 12 |
def call(self, method: str, params: dict = None):
|
| 13 |
payload = {
|
| 14 |
+
'jsonrpc': '2.0',
|
| 15 |
+
'id': str(uuid.uuid4()),
|
| 16 |
+
'method': method,
|
| 17 |
+
'params': params or {}
|
| 18 |
}
|
| 19 |
+
response = requests.post(f"{self.base_url}/rpc", json=payload, timeout=30)
|
| 20 |
+
response.raise_for_status()
|
| 21 |
+
data = response.json()
|
| 22 |
+
if 'error' in data:
|
| 23 |
+
err = data['error']
|
| 24 |
+
raise RuntimeError(err.get('message', str(err)))
|
| 25 |
+
return data.get('result')
|