[Bug] BINARY_LINK type in ToolInvokeMessage not supported #83

Open
opened 2026-02-16 00:19:40 -05:00 by yindo · 0 comments
Owner

Originally created by @Exhen on GitHub (Apr 13, 2025).

In the transform_tool_invoke_message function of DIFY, when processing blob-type messages, it ultimately returns a ToolInvokeMessage with MessageType being either IMAGE_LINK or BINARY_LINK.

# https://github.com/langgenius/dify/blob/c9a594100bfd14c332651c78243f79f789de9640/api/core/tools/utils/message_transformer.py#L91
                if "image" in mimetype:
                    yield ToolInvokeMessage(
                        type=ToolInvokeMessage.MessageType.IMAGE_LINK,
                        message=ToolInvokeMessage.TextMessage(text=url),
                        meta=meta.copy() if meta is not None else {},
                    )
                else:
                    yield ToolInvokeMessage(
                        type=ToolInvokeMessage.MessageType.BINARY_LINK,
                        message=ToolInvokeMessage.TextMessage(text=url),
                        meta=meta.copy() if meta is not None else {},
                    )

However, in the IsValidToolResponseChunkType method of the dify_plugin_deamon project, only IMAGE_LINK type is supported, while BINARY_LINK type is not supported. This leads to a critical issue:

When Agent_strategy calls a tool that returns a blob file, if the file type is not an image (i.e., returns BINARY_LINK type), the system cannot properly process and return the file to the agent. This affects all non-image file processing functionality.

Steps to Reproduce:

  1. Call a tool in Agent_strategy that returns a non-image type file
  2. The tool returns blob data
  3. The system attempts to convert the blob into a BINARY_LINK type message
  4. Due to dify_plugin_deamon not supporting BINARY_LINK type, message processing fails

Proposed Solution:

  1. Add support for BINARY_LINK type in the IsValidToolResponseChunkType method of dify_plugin_deamon
  2. Ensure all related message processing logic can properly handle BINARY_LINK type
  3. Add corresponding test cases to verify the fix

Impact Scope:

  • All tool calls that need to process non-image type files
  • File processing functionality in Agent_strategy
  • Features involving binary file transmission
Originally created by @Exhen on GitHub (Apr 13, 2025). In the `transform_tool_invoke_message` function of DIFY, when processing blob-type messages, it ultimately returns a `ToolInvokeMessage` with `MessageType` being either `IMAGE_LINK` or `BINARY_LINK`. ``` python # https://github.com/langgenius/dify/blob/c9a594100bfd14c332651c78243f79f789de9640/api/core/tools/utils/message_transformer.py#L91 if "image" in mimetype: yield ToolInvokeMessage( type=ToolInvokeMessage.MessageType.IMAGE_LINK, message=ToolInvokeMessage.TextMessage(text=url), meta=meta.copy() if meta is not None else {}, ) else: yield ToolInvokeMessage( type=ToolInvokeMessage.MessageType.BINARY_LINK, message=ToolInvokeMessage.TextMessage(text=url), meta=meta.copy() if meta is not None else {}, ) ``` However, in the `IsValidToolResponseChunkType` method of the dify_plugin_deamon project, only `IMAGE_LINK` type is supported, while `BINARY_LINK` type is not supported. This leads to a critical issue: When Agent_strategy calls a tool that returns a blob file, if the file type is not an image (i.e., returns `BINARY_LINK` type), the system cannot properly process and return the file to the agent. This affects all non-image file processing functionality. Steps to Reproduce: 1. Call a tool in Agent_strategy that returns a non-image type file 2. The tool returns blob data 3. The system attempts to convert the blob into a `BINARY_LINK` type message 4. Due to dify_plugin_deamon not supporting `BINARY_LINK` type, message processing fails Proposed Solution: 1. Add support for `BINARY_LINK` type in the `IsValidToolResponseChunkType` method of dify_plugin_deamon 2. Ensure all related message processing logic can properly handle `BINARY_LINK` type 3. Add corresponding test cases to verify the fix Impact Scope: - All tool calls that need to process non-image type files - File processing functionality in Agent_strategy - Features involving binary file transmission
yindo added the plugin-daemon label 2026-02-16 00:19:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#83