fix: ai chat node mcp (#3531)

This commit is contained in:
shaohuzhang1 2025-07-09 16:14:44 +08:00 committed by GitHub
parent 2ba043e801
commit c4293c34d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,8 +104,9 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
async def _yield_mcp_response(chat_model, message_list, mcp_servers):
async with MultiServerMCPClient(json.loads(mcp_servers)) as client:
agent = create_react_agent(chat_model, client.get_tools())
client = MultiServerMCPClient(json.loads(mcp_servers))
tools = await client.get_tools()
agent = create_react_agent(chat_model, tools)
response = agent.astream({"messages": message_list}, stream_mode='messages')
async for chunk in response:
if isinstance(chunk[0], ToolMessage):