Spaces:
Runtime error
Runtime error
Update server/mcp_use_mock.py
Browse files- server/mcp_use_mock.py +18 -1
server/mcp_use_mock.py
CHANGED
|
@@ -138,4 +138,21 @@ class MCPAgent:
|
|
| 138 |
def clear_conversation_history(self):
|
| 139 |
"""Clear history"""
|
| 140 |
self.conversation_history = []
|
| 141 |
-
print("Conversation history cleared")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
def clear_conversation_history(self):
|
| 139 |
"""Clear history"""
|
| 140 |
self.conversation_history = []
|
| 141 |
+
print("Conversation history cleared")
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
async def call_tool(self, tool_name: str, arguments: Dict) -> str:
|
| 145 |
+
"""Mock tool calling with demo responses"""
|
| 146 |
+
try:
|
| 147 |
+
if tool_name == "get_forecast":
|
| 148 |
+
location = "Amberg" # Extract from arguments if available
|
| 149 |
+
return f"🌤️ [Demo] Weather forecast for {location}: 72°F, Sunny, Light winds"
|
| 150 |
+
|
| 151 |
+
elif tool_name == "get_alerts":
|
| 152 |
+
state = arguments.get("state", "CA")
|
| 153 |
+
return f"⚠️ [Demo] Weather alerts for {state}: No active alerts"
|
| 154 |
+
|
| 155 |
+
return f"Tool {tool_name} not available in demo mode"
|
| 156 |
+
|
| 157 |
+
except Exception as e:
|
| 158 |
+
return f"Error in demo mode: {str(e)}"
|