feishu_im_user_search_messages
Search Feishu messages across conversations by keywords, sender, mentions, message type, or time range to find specific information within chat history.
Instructions
【以用户身份】跨会话搜索飞书消息。
用法:
按关键词搜索消息内容
按发送者、被@用户、消息类型过滤
按时间范围过滤:relative_time 或 start_time/end_time
限定在某个会话内搜索(chat_id)
支持分页:page_size + page_token
【参数约束】
所有参数均可选,但至少应提供一个过滤条件
relative_time 和 start_time/end_time 不能同时使用
page_size 范围 1-50,默认 50
返回消息列表,每条消息包含 message_id、msg_type、content、sender、create_time 等字段。 每条消息还包含 chat_id、chat_type(p2p/group)、chat_name(群名或单聊对方名字)。 单聊消息额外包含 chat_partner(对方 open_id 和名字)。 搜索结果中的 chat_id 和 thread_id 可配合 feishu_im_user_get_messages / feishu_im_user_get_thread_messages 查看上下文。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | 搜索关键词,匹配消息内容。可为空字符串表示不按内容过滤 | |
| sender_ids | No | 发送者 open_id 列表。如需根据用户名查找 open_id,请先使用 search_user 工具 | |
| chat_id | No | 限定搜索范围的会话 ID(oc_xxx) | |
| mention_ids | No | 被@用户的 open_id 列表 | |
| message_type | No | 消息类型过滤:file / image / media。为空则搜索所有类型 | |
| sender_type | No | 发送者类型:user / bot / all。默认 user | |
| chat_type | No | 会话类型:group(群聊)/ p2p(单聊) | |
| relative_time | No | 相对时间范围:today / yesterday / day_before_yesterday / this_week / last_week / this_month / last_month / last_{N}_{unit}(unit: minutes/hours/days)。与 start_time/end_time 互斥 | |
| start_time | No | 起始时间(ISO 8601 格式,如 2026-02-27T00:00:00+08:00)。与 relative_time 互斥 | |
| end_time | No | 结束时间(ISO 8601 格式,如 2026-02-27T23:59:59+08:00)。与 relative_time 互斥 | |
| page_size | No | 每页消息数(1-50),默认 50 | |
| page_token | No | 分页标记,用于获取下一页 |