企业微信群机器人-发送文本消息
wework_send_textSend text or Markdown messages to WeChat Work group chats using bot integration. Configure bot keys to deliver notifications with character limits up to 4096 bytes.
Instructions
通过企业微信群机器人发送文本或Markdown消息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 消息内容,长度限制: (text: 2048个字节, markdown_v2: 4096个字节) | |
| msgtype | No | 内容类型,仅支持: text/markdown_v2 | text |
| bot_key | No | 企业微信群机器人key,uuid格式,默认从环境变量获取 |
Implementation Reference
- mcp_notify/wework.py:27-41 (handler)Handler function for 'wework_send_text' tool. Sends text or markdown messages via WeWork group robot webhook using requests.post. Includes input schema via Pydantic Field.
title="企业微信群机器人-发送文本消息", description="通过企业微信群机器人发送文本或Markdown消息", ) def wework_send_text( text: str = Field(description="消息内容,长度限制: (text: 2048个字节, markdown_v2: 4096个字节)"), msgtype: str = Field("text", description="内容类型,仅支持: text/markdown_v2"), bot_key: str = FIELD_BOT_KEY, ): if msgtype == "markdown": msgtype = "markdown_v2" res = requests.post( f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key or WEWORK_BOT_KEY}", json={"msgtype": msgtype, msgtype: {"content": text}}, ) return res.json() - mcp_notify/__init__.py:19-19 (registration)Registers the 'wework_send_text' tool (among others from wework.py) by calling add_tools on the FastMCP instance.
wework.add_tools(mcp) - mcp_notify/wework.py:20-21 (schema)Pydantic Field definitions reused in 'wework_send_text' and other tools for input validation.
FIELD_BOT_KEY = Field("", description="企业微信群机器人key,uuid格式,默认从环境变量获取") FIELD_TO_USER = Field("", description="接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取") - mcp_notify/__init__.py:7-9 (registration)Imports the wework module containing the add_tools function that registers 'wework_send_text'.
from . import ( wework, tgbot,