fix: mcp tool call error because of erroneous await()

Rafael Uzarowski committed May 1, 2025 at 19:53 UTC 9a8097a4f80aceb7c1053fcb357504fceb0e10c6
1 file changed +6 -6
python/helpers/mcp.py
+6 -6
@@ -66,7 +66,7 @@ class MCPTool(Tool):
66 else:
67 text = response.message.strip()
68
69 - await self.agent.hist_add_tool_result(self.name, text)
69 + self.agent.hist_add_tool_result(self.name, text)
70 (
71 PrintStyle(font_color="#1B4F72", background_color="white", padding=True, bold=True)
72 .print(f"{self.agent.agent_name}: Response from tool '{self.name}'")
@@ -258,7 +258,7 @@ class MCPConfig(BaseModel):
258 with self.__lock:
259 return self.__initialized
260
261 - def get_tools(self) -> List[dict[str, str | dict[str, Any] | None]]:
261 + def get_tools(self) -> List[dict[str, dict[str, Any]]]:
262 """Get all tools from all servers"""
263 with self.__lock:
264 tools = []
@@ -398,10 +398,10 @@ class MCPClientBase(ABC):
398 with self.__lock:
399 response: ListToolsResult = await self.session.list_tools()
400 available_tools = [{
401 - "name": tool.name,
402 - "description": tool.description,
403 - "input_schema": tool.inputSchema
404 - } for tool in response.tools]
401 + "name": tool.name,
402 + "description": tool.description,
403 + "input_schema": tool.inputSchema
404 + } for tool in response.tools]
405
406 self.tools = available_tools
407 await self.exit_stack.aclose()