In the agent, LLM may produce hallucination issues during multi-round calls to MCP #15444

Open
opened 2026-02-21 19:21:46 -05:00 by yindo · 11 comments
Owner

Originally created by @sunxiang0918 on GitHub (Jul 16, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.6.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In the new Dify 1.6.0 version, a new agent was created, and several MCP tools were added to the toolkit.

Prompt instructions were written to allow the LLM to autonomously select the appropriate tools to generate answers.

When a user inputs a question that requires the LLM to call tools multiple times and integrate the results, severe hallucination issues occur.

For example:
A user wants to query Jackson's negative events. According to the inference, Tool A should first be called to retrieve the user's ID, and then Tool B should be called with the user's ID to query their negative events. However, when Tool A returns an empty result (meaning the user does not exist), the agent does not stop the call to Tool B. Instead, it randomly generates an ID as a parameter to call Tool B. Tool B returns an empty result, yet the LLM still generates negative events for the user, even though none actually exist.

We conducted the same test using the same LLM and MCP service on Cherry Studio. The results showed no errors—it correctly stopped the subsequent call to Tool B after Tool A returned an empty result.

Therefore, we suspect there is an issue with the MCP client-related code in the agent. Problems may have occurred in the parameter or result transfer between multiple calls to MCP tools, leading to the loss of information about the tool calls by the LLM.

Image

✔️ Expected Behavior

Can correctly call and parse the results of the tool.

Image

Actual Behavior

No response

Originally created by @sunxiang0918 on GitHub (Jul 16, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.6.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce In the new Dify 1.6.0 version, a new agent was created, and several MCP tools were added to the toolkit. Prompt instructions were written to allow the LLM to autonomously select the appropriate tools to generate answers. When a user inputs a question that requires the LLM to call tools multiple times and integrate the results, severe hallucination issues occur. For example: A user wants to query Jackson's negative events. According to the inference, Tool A should first be called to retrieve the user's ID, and then Tool B should be called with the user's ID to query their negative events. However, when Tool A returns an empty result (meaning the user does not exist), the agent does not stop the call to Tool B. Instead, it randomly generates an ID as a parameter to call Tool B. Tool B returns an empty result, yet the LLM still generates negative events for the user, even though none actually exist. We conducted the same test using the same LLM and MCP service on Cherry Studio. The results showed no errors—it correctly stopped the subsequent call to Tool B after Tool A returned an empty result. Therefore, we suspect there is an issue with the MCP client-related code in the agent. Problems may have occurred in the parameter or result transfer between multiple calls to MCP tools, leading to the loss of information about the tool calls by the LLM. <img width="1832" height="855" alt="Image" src="https://github.com/user-attachments/assets/edcf69e3-f93d-4e0e-a88c-8122016cc258" /> ### ✔️ Expected Behavior Can correctly call and parse the results of the tool. <img width="1105" height="744" alt="Image" src="https://github.com/user-attachments/assets/d018c435-bef8-4fe4-aa7c-3dc43c2de480" /> ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤖 feat:agentstale labels 2026-02-21 19:21:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 24, 2025):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.6.0, the new agent using multiple MCP tools causes hallucinations during multi-round tool calls.
  • The problem occurs especially when an initial tool returns no result, leading the agent to fabricate parameters for subsequent calls.
  • This issue does not happen on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.
  • No further updates or comments have been provided since the initial report.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 24, 2025): Hi, @sunxiang0918. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.6.0, the new agent using multiple MCP tools causes hallucinations during multi-round tool calls. - The problem occurs especially when an initial tool returns no result, leading the agent to fabricate parameters for subsequent calls. - This issue does not happen on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code. - No further updates or comments have been provided since the initial report. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@sunxiang0918 commented on GitHub (Aug 24, 2025):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.嗨,我是 Dosu,正在帮助 Dify 团队管理他们的待办事项列表,并将此问题标记为过时。

Issue Summary:  问题摘要:

  • You reported that in Dify v1.6.0, the new agent using multiple MCP tools causes hallucinations during multi-round tool calls.您报告称,在 Dify v1.6.0 中,使用多个 MCP 工具的新代理在多轮工具调用期间会产生幻觉问题。
  • The problem occurs especially when an initial tool returns no result, leading the agent to fabricate parameters for subsequent calls.该问题尤其发生在初始工具返回无结果时,导致代理为后续调用编造参数。
  • This issue does not happen on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.这个问题在配置相同的 LLM 和 MCP 的 Cherry Studio 上不会发生,表明是 Dify 的代理 MCP 客户端代码中的 bug。
  • No further updates or comments have been provided since the initial report.自初次报告以来,未提供进一步的更新或评论。

Next Steps:  下一步:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.请通过在此处评论告知我,此问题在最新版本的 Dify 中是否仍然相关,以保持讨论的开放。
  • Otherwise, this issue will be automatically closed in 15 days.否则,此问题将在 15 天内自动关闭。

Thank you for your understanding and contribution!感谢您的理解和贡献!

Yes, the issue still exists in the latest v1.7.2

@sunxiang0918 commented on GitHub (Aug 24, 2025): > Hi, [@sunxiang0918](https://github.com/sunxiang0918). I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale.嗨,我是 Dosu,正在帮助 Dify 团队管理他们的待办事项列表,并将此问题标记为过时。 > > **Issue Summary:  问题摘要:** > > * You reported that in Dify v1.6.0, the new agent using multiple MCP tools causes hallucinations during multi-round tool calls.您报告称,在 Dify v1.6.0 中,使用多个 MCP 工具的新代理在多轮工具调用期间会产生幻觉问题。 > * The problem occurs especially when an initial tool returns no result, leading the agent to fabricate parameters for subsequent calls.该问题尤其发生在初始工具返回无结果时,导致代理为后续调用编造参数。 > * This issue does not happen on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.这个问题在配置相同的 LLM 和 MCP 的 Cherry Studio 上不会发生,表明是 Dify 的代理 MCP 客户端代码中的 bug。 > * No further updates or comments have been provided since the initial report.自初次报告以来,未提供进一步的更新或评论。 > > **Next Steps:  下一步:** > > * Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.请通过在此处评论告知我,此问题在最新版本的 Dify 中是否仍然相关,以保持讨论的开放。 > * Otherwise, this issue will be automatically closed in 15 days.否则,此问题将在 15 天内自动关闭。 > > Thank you for your understanding and contribution!感谢您的理解和贡献! Yes, the issue still exists in the latest v1.7.2
Author
Owner

@dosubot[bot] commented on GitHub (Aug 24, 2025):

@crazywoola The user confirmed that the hallucination issue with the new agent using multiple MCP tools still exists in the latest v1.7.2. Could you please assist with this?

@dosubot[bot] commented on GitHub (Aug 24, 2025): @crazywoola The user confirmed that the hallucination issue with the new agent using multiple MCP tools still exists in the latest v1.7.2. Could you please assist with this?
Author
Owner

@sunxiang0918 commented on GitHub (Sep 28, 2025):

Tried the latest v1.9.0 version. The issue still persists.

@sunxiang0918 commented on GitHub (Sep 28, 2025): Tried the latest v1.9.0 version. The issue still persists.
Author
Owner

@dosubot[bot] commented on GitHub (Oct 29, 2025):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a hallucination bug starting from v1.6.0 where the new agent fabricates parameters after an empty tool result in multi-round MCP tool calls.
  • You confirmed the issue persists in versions v1.7.2 and v1.9.0.
  • The problem causes false LLM outputs, impacting reliability.
  • I have escalated the issue to maintainer @crazywoola for investigation.
  • No fix or further updates have been provided yet.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here.
  • If I don’t hear back within 15 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Oct 29, 2025): Hi, @sunxiang0918. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a hallucination bug starting from v1.6.0 where the new agent fabricates parameters after an empty tool result in multi-round MCP tool calls. - You confirmed the issue persists in versions v1.7.2 and v1.9.0. - The problem causes false LLM outputs, impacting reliability. - I have escalated the issue to maintainer @crazywoola for investigation. - No fix or further updates have been provided yet. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here. - If I don’t hear back within 15 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Author
Owner

@sunxiang0918 commented on GitHub (Oct 29, 2025):

Tried the latest v1.9.2 version. The issue still persists.

@sunxiang0918 commented on GitHub (Oct 29, 2025): Tried the latest v1.9.2 version. The issue still persists.
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a hallucination bug starting from v1.6.0 where the agent fabricates parameters after an initial tool returns no result.
  • The issue does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.
  • You confirmed the problem persists in versions v1.7.2, v1.9.0, and v1.9.2.
  • The issue was escalated to @crazywoola for investigation but no fix or updates have been provided yet.

What's Next:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Dec 19, 2025): Hi, @sunxiang0918. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a hallucination bug starting from v1.6.0 where the agent fabricates parameters after an initial tool returns no result. - The issue does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code. - You confirmed the problem persists in versions v1.7.2, v1.9.0, and v1.9.2. - The issue was escalated to @crazywoola for investigation but no fix or updates have been provided yet. **What's Next:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@sunxiang0918 commented on GitHub (Dec 20, 2025):

Tried the latest v1.11.0 version. The issue still persists.

@sunxiang0918 commented on GitHub (Dec 20, 2025): Tried the latest v1.11.0 version. The issue still persists.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2026):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a hallucination issue starting from Dify v1.6.0 where the agent fabricates parameters after an initial tool returns no result.
  • The problem does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.
  • You confirmed the issue persists through multiple versions up to v1.11.0.
  • The issue has been acknowledged and is being tracked, but no fix or update has been provided yet.
  • Maintainer @crazywoola has been notified for investigation.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 20, 2026): Hi, @sunxiang0918. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a hallucination issue starting from Dify v1.6.0 where the agent fabricates parameters after an initial tool returns no result. - The problem does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code. - You confirmed the issue persists through multiple versions up to v1.11.0. - The issue has been acknowledged and is being tracked, but no fix or update has been provided yet. - Maintainer @crazywoola has been notified for investigation. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@sunxiang0918 commented on GitHub (Jan 20, 2026):

The issue still persists.

@sunxiang0918 commented on GitHub (Jan 20, 2026): The issue still persists.
Author
Owner

@dosubot[bot] commented on GitHub (Feb 21, 2026):

Hi, @sunxiang0918. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a hallucination bug starting from v1.6.0 where the agent fabricates parameters after an empty MCP tool call.
  • The issue does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code.
  • You have confirmed the problem persists through versions up to v1.11.0.
  • No fix or update has been provided yet, and the issue remains open awaiting investigation.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here.
  • If I do not hear back within 15 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Feb 21, 2026): Hi, @sunxiang0918. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a hallucination bug starting from v1.6.0 where the agent fabricates parameters after an empty MCP tool call. - The issue does not occur on Cherry Studio with the same LLM and MCP setup, suggesting a bug in Dify's agent MCP client code. - You have confirmed the problem persists through versions up to v1.11.0. - No fix or update has been provided yet, and the issue remains open awaiting investigation. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here. - If I do not hear back within 15 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15444