[PR #31607] feat(workflow): support RETRIEVER_RESOURCES message type in tool node… #33321

Open
opened 2026-02-21 20:53:04 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31607

State: open
Merged: No


Summary

Fixes #29832

This PR adds support for RETRIEVER_RESOURCES message type in the Tool Node, enabling custom plugins to inject retriever_resources into ChatFlow for citations and attributions.

Changes:

  1. Added import for RunRetrieverResourceEvent from core.workflow.node_events
  2. Added message handler for ToolInvokeMessage.MessageType.RETRIEVER_RESOURCES in _transform_message method

This allows third-party tool plugins to return retrieval source metadata (like the native Knowledge Retrieval node does), so the frontend can display which segments and documents were referenced.

Screenshots

Before After
N/A (Backend only change) N/A

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/31607 **State:** open **Merged:** No --- ## Summary Fixes #29832 This PR adds support for `RETRIEVER_RESOURCES` message type in the Tool Node, enabling custom plugins to inject `retriever_resources` into ChatFlow for citations and attributions. ### Changes: 1. Added import for `RunRetrieverResourceEvent` from `core.workflow.node_events` 2. Added message handler for `ToolInvokeMessage.MessageType.RETRIEVER_RESOURCES` in `_transform_message` method This allows third-party tool plugins to return retrieval source metadata (like the native Knowledge Retrieval node does), so the frontend can display which segments and documents were referenced. ## Screenshots | Before | After | |--------|-------| | N/A (Backend only change) | N/A | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [ ] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [ ] I've updated the documentation accordingly. - [ ] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:53:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33321