mcp: fix typo in tool call response

This commit is contained in:
vipyne
2025-05-20 11:11:57 -05:00
parent 462aecea3e
commit 7655c432c2

View File

@@ -155,8 +155,7 @@ class MCPClient(BaseObject):
error_msg = f"Error calling mcp tool {function_name}: {str(e)}" error_msg = f"Error calling mcp tool {function_name}: {str(e)}"
logger.error(error_msg) logger.error(error_msg)
response = "Sorry, could not call the mcp tool" response = ""
image_url = None
if results: if results:
if hasattr(results, "content") and results.content: if hasattr(results, "content") and results.content:
for i, content in enumerate(results.content): for i, content in enumerate(results.content):
@@ -171,7 +170,8 @@ class MCPClient(BaseObject):
else: else:
logger.error(f"Error getting content from {function_name} results.") logger.error(f"Error getting content from {function_name} results.")
await result_callback(response) final_response = response if len(response) else "Sorry, could not call the mcp tool"
await result_callback(final_response)
async def _list_tools(self, session, mcp_tool_wrapper, llm): async def _list_tools(self, session, mcp_tool_wrapper, llm):
available_tools = await session.list_tools() available_tools = await session.list_tools()