Update agents/tools/mcp_tools.py
Browse files
agents/tools/mcp_tools.py
CHANGED
|
@@ -38,28 +38,21 @@ class MCPTools():
|
|
| 38 |
arguments={"fen": fen}
|
| 39 |
)
|
| 40 |
|
| 41 |
-
# Handle string representation of tuple/dict
|
| 42 |
if isinstance(raw_result, str):
|
| 43 |
-
# Use eval to parse string representation (e.g., "({'key': 'value'}, None)")
|
| 44 |
try:
|
| 45 |
raw_result = eval(raw_result)
|
| 46 |
-
print("Parsed string to:", type(raw_result))
|
| 47 |
except:
|
| 48 |
pass
|
| 49 |
|
| 50 |
-
# Extract from tuple if needed
|
| 51 |
if isinstance(raw_result, tuple) and len(raw_result) > 0:
|
| 52 |
raw_result = raw_result[0]
|
| 53 |
-
print("Extracted from tuple:", type(raw_result))
|
| 54 |
|
| 55 |
-
# Extract continuation from dict
|
| 56 |
result = None
|
|
|
|
| 57 |
if isinstance(raw_result, dict) and "continuation" in raw_result:
|
| 58 |
result = raw_result["continuation"]
|
| 59 |
-
print("Extracted continuation:", result)
|
| 60 |
else:
|
| 61 |
result = raw_result
|
| 62 |
-
print("Using raw result:", result)
|
| 63 |
|
| 64 |
print(f"🛠️ MCPTools: best_move_tool: result={result}")
|
| 65 |
|
|
|
|
| 38 |
arguments={"fen": fen}
|
| 39 |
)
|
| 40 |
|
|
|
|
| 41 |
if isinstance(raw_result, str):
|
|
|
|
| 42 |
try:
|
| 43 |
raw_result = eval(raw_result)
|
|
|
|
| 44 |
except:
|
| 45 |
pass
|
| 46 |
|
|
|
|
| 47 |
if isinstance(raw_result, tuple) and len(raw_result) > 0:
|
| 48 |
raw_result = raw_result[0]
|
|
|
|
| 49 |
|
|
|
|
| 50 |
result = None
|
| 51 |
+
|
| 52 |
if isinstance(raw_result, dict) and "continuation" in raw_result:
|
| 53 |
result = raw_result["continuation"]
|
|
|
|
| 54 |
else:
|
| 55 |
result = raw_result
|
|
|
|
| 56 |
|
| 57 |
print(f"🛠️ MCPTools: best_move_tool: result={result}")
|
| 58 |
|