企业微信群机器人-发送图文消息
wework_send_newsSend rich news links with title, URL, and optional description/image to WeChat Work group bot.
Instructions
通过企业微信群机器人发送图文链接消息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | 标题,不超过128个字节 | |
| url | Yes | 跳转链接,必填 | |
| picurl | No | 图片URL | |
| description | No | 描述,不超过512个字节 | |
| bot_key | No | 企业微信群机器人key,uuid格式,默认从环境变量获取 |
Implementation Reference
- mcp_notify/wework.py:61-88 (handler)The actual implementation of the 'wework_send_news' tool. It sends a news/article message (title, url, picurl, description) via the WeWork group bot webhook API. Registered as an MCP tool via the @mcp.tool decorator within the add_tools() function.
@mcp.tool( title="企业微信群机器人-发送图文消息", description="通过企业微信群机器人发送图文链接消息", ) def wework_send_news( title: str = Field(description="标题,不超过128个字节"), url: str = Field(description="跳转链接,必填"), picurl: str = Field("", description="图片URL"), description: str = Field("", description="描述,不超过512个字节"), bot_key: str = FIELD_BOT_KEY, ): res = requests.post( f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key or WEWORK_BOT_KEY}", json={ "msgtype": "news", "news": { "articles": [ { "title": title, "description": description, "url": url, "picurl": picurl, }, ], }, }, ) return res.json() - mcp_notify/wework.py:21-22 (registration)The 'add_tools' function that registers all WeWork tools onto the FastMCP server. The 'wework_send_news' tool is defined (lines 61-88) inside this function and decorated with @mcp.tool.
def add_tools(mcp: FastMCP, logger=None): - mcp_notify/__init__.py:19-19 (registration)The MCP server initialization file calls 'wework.add_tools(mcp)' on line 19 to register all WeWork tools including wework_send_news.
wework.add_tools(mcp)