feat(feishu): add feishu_media tool for image/file download
Feature Request: feishu_media Tool for Image/File Download
Summary
Add a new feishu_media tool to allow agents to download images and files from Feishu messages, including images embedded in interactive cards.
Problem
Currently, the Feishu plugin automatically downloads attachments for image, file, audio, video message types. However:
- Interactive cards (消息卡片) containing
<img>tags are NOT processed - agents only receive the JSON structure withimage_key, not the actual image - Agents have no way to manually download an image using an
image_keyorfile_key - The
downloadImageFeishuanddownloadMessageResourceFeishufunctions exist inmedia.tsbut are NOT exposed as agent tools
Use Case
User sends an interactive card message containing an image. The agent receives:
{"title":null,"elements":[[{"tag":"img","image_key":"img_v3_02104_xxx"},{"tag":"text","text":"..."}]]}
The agent cannot view the image because:
- It only has the
image_key, not the actual image data - No tool exists to download the image using the
image_key
Proposed Solution
Add a feishu_media tool with the following actions:
1. download_image - Download image by image_key
{
action: "download_image",
image_key: "img_v3_xxx",
save_path?: string // optional, defaults to workspace/downloads/
}
Uses client.im.image.get() (already implemented in downloadImageFeishu)
2. download_resource - Download file/image from message
{
action: "download_resource",
message_id: "om_xxx",
file_key: "file_v3_xxx",
type: "image" | "file"
}
Uses client.im.messageResource.get() (already implemented in downloadMessageResourceFeishu)
Implementation Notes
The core download functions already exist in /extensions/feishu/src/media.ts:
downloadImageFeishu()- lines 87-114downloadMessageResourceFeishu()- lines 120-153
Just need to:
- Create
registerFeishuMediaTools()function - Register it in
index.ts - Add tool schema for
feishu_media
Required Permissions
Already granted in typical setups:
im:resource✅
Priority
Medium - Workaround exists (user can send images as direct messages or files), but this limits the agent's ability to process rich content.
---
Submitted by: 小兔 🐰 (Project Rabbit Assistant)
Date: 2026-03-25
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗