Skip to main content
Glama
aahl

MCP Server for notify to weixin / telegram / bark / lark

by aahl

飞书/Lark机器人-发送文本消息

lark_send_text

Send text or Markdown messages to Feishu or Lark group robots for notifications.

Instructions

飞书/Lark群机器人发送文本或Markdown消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes消息内容
msgtypeNo内容类型,仅支持: text/markdownmarkdown
bot_keyNo飞书/Lark机器人key,uuid格式,默认从环境变量获取
is_larkNo根据用户描述识别 0:飞书 1:Lark

Implementation Reference

  • The actual handler function for the lark_send_text tool. It sends text/markdown messages to Feishu/Lark bot via their webhook API. Supports both Feishu (飞书) and Lark (Larksuite) platforms with different environment variable keys and base URLs.
    def lark_send_text(
        text: str = Field(description="消息内容"),
        msgtype: str = Field("markdown", description="内容类型,仅支持: text/markdown"),
        bot_key: str = Field("", description="飞书/Lark机器人key,uuid格式,默认从环境变量获取"),
        is_lark: int = Field(0, description="根据用户描述识别 0:飞书 1:Lark"),
    ):
        """
        https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN
        https://open.larksuite.com/document/client-docs/bot-v3/add-custom-bot
        """
        if msgtype == "markdown":
            body = {
                "msg_type": "interactive",
                "card": {"elements": [{"tag": msgtype, "content": text}]},
            }
        else:
            body = {"msg_type": msgtype, "content": {"text": text}}
        if not bot_key:
            bot_key = os.getenv("LARK_BOT_KEY" if is_lark else "FEISHU_BOT_KEY", "")
        if is_lark:
            base = os.getenv("LARK_BASE_URL") or "https://open.larksuite.com"
        else:
            base = os.getenv("FEISHU_BASE_URL") or "https://open.feishu.cn"
        res = requests.post(
            f"{base}/open-apis/bot/v2/hook/{bot_key}",
            json=body,
        )
        return res.json()
  • Input schema/parameters for lark_send_text defined via pydantic Field annotations: text (required), msgtype (default 'markdown'), bot_key (optional, from env), is_lark (0=Feishu, 1=Lark).
    def lark_send_text(
        text: str = Field(description="消息内容"),
        msgtype: str = Field("markdown", description="内容类型,仅支持: text/markdown"),
        bot_key: str = Field("", description="飞书/Lark机器人key,uuid格式,默认从环境变量获取"),
        is_lark: int = Field(0, description="根据用户描述识别 0:飞书 1:Lark"),
    ):
  • Tool registration using @mcp.tool decorator with title and description. Registered inside add_tools() which is called from __init__.py.
    @mcp.tool(
        title="飞书/Lark机器人-发送文本消息",
        description="飞书/Lark群机器人发送文本或Markdown消息",
    )
  • Top-level registration: other.add_tools(mcp) is called to register all tools in other.py including lark_send_text.
    other.add_tools(mcp)
    hass.add_tools(mcp)
    util.add_tools(mcp)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states the basic function and does not mention authentication requirements, failure modes, or any side effects. The bot_key parameter hints at a key but is not elaborated.

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 sentence, concise and front-loaded. It is appropriate for a simple tool, though it could be slightly more informative without becoming verbose.

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?

Given no output schema and no annotations, the description lacks completeness. It does not explain return values, error handling, or behavior when parameters are missing. For a sending tool with 4 parameters, more context is needed.

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?

Schema description coverage is 100%, so the schema already explains all parameters. The description adds no further meaning, meeting the baseline of 3.

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 sends text or Markdown messages to Lark group robots. The verb '发送' and resource '文本或Markdown消息' are specific, and it distinguishes from sibling tools that target different platforms.

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 and context of sibling tools make it clear when to use this tool (for sending to Lark). However, there is no explicit statement of when not to use it or alternatives, but the platform context is strong.

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