wework_send_news
Send rich link messages with titles, images, and descriptions to WeWork group chats using bot integration for team notifications and updates.
Instructions
通过企业微信群机器人发送图文链接消息
Input Schema
TableJSON 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:68-91 (handler)The handler function that implements the core logic of sending a news (link article) message via WeWork group robot webhook using requests.post to the API endpoint.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:64-67 (registration)The @mcp.tool decorator registers the wework_send_news function as an MCP tool with title and description.@mcp.tool( title="企业微信群机器人-发送图文消息", description="通过企业微信群机器人发送图文链接消息", )
- mcp_notify/__init__.py:19-19 (registration)Calls add_tools from wework module on the FastMCP instance, which defines and registers the wework_send_news tool among others.wework.add_tools(mcp)
- mcp_notify/wework.py:20-20 (helper)Pydantic Field definition for the bot_key parameter, providing default and description used in the tool schema.FIELD_BOT_KEY = Field("", description="企业微信群机器人key,uuid格式,默认从环境变量获取")
- mcp_notify/wework.py:18-18 (helper)Base URL constant for WeWork API endpoints, used in the handler.WEWORK_BASE_URL = os.getenv("WEWORK_BASE_URL") or "https://qyapi.weixin.qq.com"