Skip to main content
Glama
aahl

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

by aahl

企业微信应用号-发送文本消息

wework_app_send_text

Send text or Markdown messages through WeChat Work app to specific users or all members, with support for @all and individual IDs.

Instructions

通过企业微信应用号发送文本或Markdown消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes消息内容,最长不超过2048个字节
msgtypeNo内容类型,仅支持: text/markdowntext
touserNo接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取

Implementation Reference

  • The `wework_app_send_text` function is the handler for sending text/markdown messages via WeWork app (应用号). It POSTs to the WeChat Work API with the message content, type, and recipient.
    def wework_app_send_text(
        text: str = Field(description="消息内容,最长不超过2048个字节"),
        msgtype: str = Field("text", description="内容类型,仅支持: text/markdown"),
        touser: str = FIELD_TO_USER,
    ):
        res = requests.post(
            f"{WEWORK_BASE_URL}/cgi-bin/message/send?access_token={get_access_token()}",
            json={
                "touser": touser or WEWORK_APP_TOUSER,
                "agentid": WEWORK_APP_AGENTID,
                "msgtype": msgtype,
                msgtype: {"content": text},
                "enable_duplicate_check": 1,
                "duplicate_check_interval": 60,
            },
        )
        return res.json() or {}
  • Input schema for `wework_app_send_text`: `text` (message content), `msgtype` (text/markdown), `touser` (recipient user IDs).
    text: str = Field(description="消息内容,最长不超过2048个字节"),
    msgtype: str = Field("text", description="内容类型,仅支持: text/markdown"),
    touser: str = FIELD_TO_USER,
  • The @mcp.tool decorator registers the tool with FastMCP, providing title and description metadata.
    @mcp.tool(
        title="企业微信应用号-发送文本消息",
        description="通过企业微信应用号发送文本或Markdown消息",
    )
  • The top-level MCP server is created and `wework.add_tools(mcp)` is called to register all WeWork tools including `wework_app_send_text`.
    mcp = FastMCP(name="mcp-notify", version="0.1.11")
    wework.add_tools(mcp)
    tgbot.add_tools(mcp)
    other.add_tools(mcp)
    hass.add_tools(mcp)
    util.add_tools(mcp)
  • The `get_access_token` helper function (cached) fetches an OAuth access token required for the WeWork App API call.
    @cached(TTLCache(maxsize=1, ttl=3600))
    def get_access_token():
        res = requests.get(
            f"{WEWORK_BASE_URL}/cgi-bin/gettoken",
            params={"corpid": WEWORK_APP_CORPID, "corpsecret": WEWORK_APP_SECRET},
            timeout=60,
        )
        return res.json().get("access_token")

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/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 cover behavioral traits. However, it only states the basic function and does not disclose authentication needs, rate limits, error handling, or any side effects. Agent cannot infer safety or operational constraints.

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 short sentence, concise and without filler. However, it is underspecified, sacrificing clarity for brevity. It earns a 4 for being efficient but not maximal.

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

Completeness3/5

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

For a simple tool with 3 parameters, no output schema, and no annotations, the description is minimally complete. It conveys the core functionality but omits contextual details like recipient resolution or message length limits (which are in schema but not explained). Adequate but lacks depth.

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 documents all parameters. The description adds no additional meaning beyond what is in the schema, meeting the baseline expectation.

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' via '企业微信应用号' (WeChat Work application), specifying the resource and action. This distinguishes it from sibling tools that send to different channels (e.g., ding, lark) or other message types (e.g., file, image) for the same channel.

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?

The description provides no guidance on when to use this tool versus alternatives like wework_send_text or other notification tools. There is no mention of prerequisites, context, or exclusions, making it hard for an AI agent to decide correctly.

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