mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 12:24:46 +08:00
fix: langchain-mcp-adapters version conflict (#500)
* fix: langchain-mcp-adapters version conflict * fix the lint error
This commit is contained in:
@@ -458,16 +458,17 @@ async def _setup_and_execute_agent_step(
|
|||||||
|
|
||||||
# Create and execute agent with MCP tools if available
|
# Create and execute agent with MCP tools if available
|
||||||
if mcp_servers:
|
if mcp_servers:
|
||||||
async with MultiServerMCPClient(mcp_servers) as client:
|
client = MultiServerMCPClient(mcp_servers)
|
||||||
loaded_tools = default_tools[:]
|
loaded_tools = default_tools[:]
|
||||||
for tool in client.get_tools():
|
all_tools = await client.get_tools()
|
||||||
if tool.name in enabled_tools:
|
for tool in all_tools:
|
||||||
tool.description = (
|
if tool.name in enabled_tools:
|
||||||
f"Powered by '{enabled_tools[tool.name]}'.\n{tool.description}"
|
tool.description = (
|
||||||
)
|
f"Powered by '{enabled_tools[tool.name]}'.\n{tool.description}"
|
||||||
loaded_tools.append(tool)
|
)
|
||||||
agent = create_agent(agent_type, agent_type, loaded_tools, agent_type)
|
loaded_tools.append(tool)
|
||||||
return await _execute_agent_step(state, agent, agent_type)
|
agent = create_agent(agent_type, agent_type, loaded_tools, agent_type)
|
||||||
|
return await _execute_agent_step(state, agent, agent_type)
|
||||||
else:
|
else:
|
||||||
# Use default tools if no MCP servers are configured
|
# Use default tools if no MCP servers are configured
|
||||||
agent = create_agent(agent_type, agent_type, default_tools, agent_type)
|
agent = create_agent(agent_type, agent_type, default_tools, agent_type)
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ def patch_multiserver_mcp_client():
|
|||||||
async def __aexit__(self, exc_type, exc, tb):
|
async def __aexit__(self, exc_type, exc, tb):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_tools(self):
|
async def get_tools(self):
|
||||||
return [
|
return [
|
||||||
FakeTool("toolA", "descA"),
|
FakeTool("toolA", "descA"),
|
||||||
FakeTool("toolB", "descB"),
|
FakeTool("toolB", "descB"),
|
||||||
@@ -1244,7 +1244,7 @@ async def test_setup_and_execute_agent_step_with_mcp_tools_description_update(
|
|||||||
async def __aexit__(self, exc_type, exc, tb):
|
async def __aexit__(self, exc_type, exc, tb):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_tools(self):
|
async def get_tools(self):
|
||||||
return [FakeTool("toolA", "descA")]
|
return [FakeTool("toolA", "descA")]
|
||||||
|
|
||||||
with patch("src.graph.nodes.MultiServerMCPClient", return_value=FakeClient()):
|
with patch("src.graph.nodes.MultiServerMCPClient", return_value=FakeClient()):
|
||||||
|
|||||||
Reference in New Issue
Block a user