feat(feishu): add feishu_media tool for image/file download

Resolved 💬 2 comments Opened Mar 25, 2026 by cfzhang0130 Closed Mar 28, 2026

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:

  1. Interactive cards (消息卡片) containing <img> tags are NOT processed - agents only receive the JSON structure with image_key, not the actual image
  2. Agents have no way to manually download an image using an image_key or file_key
  3. The downloadImageFeishu and downloadMessageResourceFeishu functions exist in media.ts but 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-114
  • downloadMessageResourceFeishu() - lines 120-153

Just need to:

  1. Create registerFeishuMediaTools() function
  2. Register it in index.ts
  3. 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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗