企业微信群机器人-发送文本消息
wework_send_textSend text or Markdown messages to a WeWork group chat using a bot key. Supports up to 2048 bytes for text and 4096 bytes for Markdown.
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-38 (handler)The handler function for the 'wework_send_text' tool. Sends a text or markdown message via a WeWork (企业微信) group bot webhook. Accepts text content, msgtype (text/markdown_v2), and an optional bot_key. Makes a POST request to the WeWork webhook API and returns the response JSON.
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/wework.py:23-26 (registration)The tool registration decorator (@mcp.tool) for 'wework_send_text', with title '企业微信群机器人-发送文本消息' and description '通过企业微信群机器人发送文本或Markdown消息'.
@mcp.tool( title="企业微信群机器人-发送文本消息", description="通过企业微信群机器人发送文本或Markdown消息", ) - mcp_notify/__init__.py:18-19 (registration)Registration of the wework tools module into the main FastMCP server via wework.add_tools(mcp).
mcp = FastMCP(name="mcp-notify", version="0.1.11") wework.add_tools(mcp) - mcp_notify/wework.py:28-31 (schema)Pydantic Field definitions for the tool's parameters: 'text' (message content), 'msgtype' (text/markdown_v2), and 'bot_key' (WeWork bot key with environment variable fallback).
text: str = Field(description="消息内容,长度限制: (text: 2048个字节, markdown_v2: 4096个字节)"), msgtype: str = Field("text", description="内容类型,仅支持: text/markdown_v2"), bot_key: str = FIELD_BOT_KEY, ):