mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-10-04 13:46:30 +08:00
fix: add server name in desc
This commit is contained in:
parent
475dd0f286
commit
3e4e551613
@ -294,7 +294,7 @@ async def _setup_and_execute_agent_step(
|
|||||||
"""
|
"""
|
||||||
configurable = Configuration.from_runnable_config(config)
|
configurable = Configuration.from_runnable_config(config)
|
||||||
mcp_servers = {}
|
mcp_servers = {}
|
||||||
enabled_tools = set()
|
enabled_tools = {}
|
||||||
|
|
||||||
# Extract MCP server configuration for this agent type
|
# Extract MCP server configuration for this agent type
|
||||||
if configurable.mcp_settings:
|
if configurable.mcp_settings:
|
||||||
@ -308,14 +308,19 @@ async def _setup_and_execute_agent_step(
|
|||||||
for k, v in server_config.items()
|
for k, v in server_config.items()
|
||||||
if k in ("transport", "command", "args", "url", "env")
|
if k in ("transport", "command", "args", "url", "env")
|
||||||
}
|
}
|
||||||
enabled_tools.update(server_config["enabled_tools"])
|
for tool_name in server_config["enabled_tools"]:
|
||||||
|
enabled_tools[tool_name] = server_name
|
||||||
|
|
||||||
# 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:
|
async with MultiServerMCPClient(mcp_servers) as client:
|
||||||
loaded_tools = [
|
loaded_tools = default_tools[:]
|
||||||
tool for tool in client.get_tools() if tool.name in enabled_tools
|
for tool in client.get_tools():
|
||||||
] + default_tools
|
if tool.name in enabled_tools:
|
||||||
|
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)
|
agent = create_agent(agent_type, agent_type, loaded_tools, agent_type)
|
||||||
return await _execute_agent_step(state, agent, agent_type)
|
return await _execute_agent_step(state, agent, agent_type)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user