Skip to main content
Glama
lm203688

feishu-mcp-server

by lm203688

list_chat_messages

Retrieve messages from a Feishu group chat using chat ID and optional message count.

Instructions

获取飞书群聊的消息列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYes群聊ID
countNo获取消息数量(默认20)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler: decorated with @mcp.tool(), defines list_chat_messages(chat_id, count). Checks if message feature is enabled, calls client.list_chat_messages, and returns JSON result.
    @mcp.tool()
    def list_chat_messages(chat_id: str, count: int = 20) -> str:
        """获取飞书群聊的消息列表
    
        Args:
            chat_id: 群聊ID
            count: 获取消息数量(默认20)
        """
        if not config.enable_message:
            return json.dumps({"error": "消息功能未启用"}, ensure_ascii=False)
        try:
            result = client.list_chat_messages(chat_id, count)
            return json.dumps(result, ensure_ascii=False, indent=2, default=str)
        except Exception as e:
            return json.dumps({"error": str(e)}, ensure_ascii=False)
  • Registration: the @mcp.tool() decorator registers list_chat_messages as a FastMCP tool.
    @mcp.tool()
    def list_chat_messages(chat_id: str, count: int = 20) -> str:
  • Client helper method: calls the Feishu API (GET /im/v1/messages) with container_id_type=chat, container_id and page_size params to list chat messages.
    def list_chat_messages(self, chat_id: str, count: int = 20) -> dict[str, Any]:
        """获取群聊消息列表"""
        return self._request(
            "GET", f"/im/v1/messages",
            params={"container_id_type": "chat", "container_id": chat_id, "page_size": count},
        )
  • Input schema: the function signature defines parameters chat_id (str) and count (int, default 20) which FastMCP uses for input validation.
    def list_chat_messages(chat_id: str, count: int = 20) -> str:
        """获取飞书群聊的消息列表
    
        Args:
            chat_id: 群聊ID
            count: 获取消息数量(默认20)
        """
Behavior1/5

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

No annotations are provided, and the description does not disclose any behavioral traits such as read-only nature, pagination, rate limits, or ordering. It fails to convey essential operational context.

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 a single concise sentence with no wasted words, appropriate for a simple tool with two parameters. It is front-loaded and efficient.

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

Completeness2/5

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

Despite having an output schema, the description does not mention return format, pagination, or any other completion detail. Given the tool's simplicity, more context (e.g., message ordering, limits) would be beneficial.

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

Parameters3/5

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

Input schema coverage is 100%, so parameters are already described. The description adds no extra semantic value beyond what the schema provides, meeting the baseline for high coverage.

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

Purpose4/5

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

The description states the verb '获取' (get) and resource '飞书群聊的消息列表' (Feishu group chat message list), clearly indicating the tool retrieves messages. However, it does not differentiate from sibling tools like 'send_message' or specify the scope (e.g., whether it gets all messages or recent ones).

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description implies it should be used to retrieve messages, but lacks explicit context, prerequisites, or exclusions.

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/lm203688/feishu-mcp-server'

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