Skip to main content
Glama

feishu_im_user_get_messages

Retrieve historical messages from Feishu/Lark group chats or direct conversations using chat ID or user ID, with time filtering and pagination support.

Instructions

【以用户身份】获取群聊或单聊的历史消息。

用法:

  • 通过 chat_id 获取群聊/单聊消息

  • 通过 open_id 获取与指定用户的单聊消息(自动解析 chat_id)

  • 支持时间范围过滤:relative_time(如 today、last_3_days)或 start_time/end_time(ISO 8601 格式)

  • 支持分页:page_size + page_token

【参数约束】

  • open_id 和 chat_id 必须二选一,不能同时提供

  • relative_time 和 start_time/end_time 不能同时使用

  • page_size 范围 1-50,默认 50

返回消息列表,每条消息包含 message_id、msg_type、content(AI 可读文本)、sender、create_time 等字段。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
open_idNo用户 open_id(ou_xxx),获取与该用户的单聊消息。与 chat_id 互斥
chat_idNo会话 ID(oc_xxx),支持单聊和群聊。与 open_id 互斥
sort_ruleNo排序方式,默认 create_time_desc(最新消息在前)
page_sizeNo每页消息数(1-50),默认 50
page_tokenNo分页标记,用于获取下一页
relative_timeNo相对时间范围: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_timeNo起始时间(ISO 8601 格式,如 2026-02-27T00:00:00+08:00)。与 relative_time 互斥
end_timeNo结束时间(ISO 8601 格式,如 2026-02-27T23:59:59+08:00)。与 relative_time 互斥
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well. It discloses important behavioral traits: authentication context ('以用户身份'), pagination behavior, time filtering options, parameter constraints (mutual exclusivity rules), and return format details. It doesn't mention rate limits, permissions needed, or error conditions, but covers most essential operational aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (usage, parameter constraints, return format) and every sentence adds value. It's appropriately sized for an 8-parameter tool with complex constraints. The only minor issue is some redundancy with schema descriptions, but overall it's efficient and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex message retrieval tool with 8 parameters, no annotations, and no output schema, the description provides good coverage. It explains authentication context, parameter constraints, filtering options, pagination, and return format. It doesn't cover error cases or rate limits, but given the schema's 100% description coverage and the detailed behavioral context provided, it's mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds significant value beyond the schema by explaining the semantic relationships between parameters: 'open_id 和 chat_id 必须二选一' (must choose one), 'relative_time 和 start_time/end_time 不能同时使用' (cannot use together), and clarifying that open_id '自动解析 chat_id' (automatically resolves to chat_id). It also provides practical examples of relative_time formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取群聊或单聊的历史消息' (get historical messages from group or private chats). It specifies the verb ('获取' - get/retrieve) and resource ('历史消息' - historical messages), and distinguishes itself from siblings like 'feishu_im_user_search_messages' (search messages) by focusing on retrieval from specific chats rather than searching across chats.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: '以用户身份' (as a user identity) and explains how to use chat_id vs open_id for different chat types. However, it doesn't explicitly mention when to use this tool versus alternatives like 'feishu_im_user_search_messages' (search messages) or 'listMessagesFeishu', which appears to be a similar tool. The guidance is good but lacks sibling differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/WilliamMo101/lark-hermes-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server