wework_send_image
Send images to WeWork group chats using a bot. Upload images via URL to share visual content with team members through the Notify MCP Server.
Instructions
通过企业微信群机器人发送图片消息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | 图片url | |
| bot_key | No | 企业微信群机器人key,uuid格式,默认从环境变量获取 |
Implementation Reference
- mcp_notify/wework.py:48-61 (handler)The handler function for the 'wework_send_image' tool. It fetches the image from the provided URL, encodes it to base64, computes its MD5 hash, and sends it as an image message using the WeWork group robot webhook API.def wework_send_image( url: str = Field(description="图片url"), bot_key: str = FIELD_BOT_KEY, ): res = requests.get(url, timeout=120) res.raise_for_status() b64str = base64.b64encode(res.content).decode() md5str = hashlib.md5(res.content).hexdigest() res = requests.post( f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key or WEWORK_BOT_KEY}", json={"msgtype": "image", "image": {"base64": b64str, "md5": md5str}}, timeout=120, ) return res.json()
- mcp_notify/wework.py:44-47 (registration)The @mcp.tool decorator registers the 'wework_send_image' tool with its title and description within the add_tools function.@mcp.tool( title="企业微信群机器人-发送图片消息", description="通过企业微信群机器人发送图片消息", )
- mcp_notify/__init__.py:18-19 (registration)Top-level registration: Creates the FastMCP instance and calls wework.add_tools(mcp), which defines and registers the 'wework_send_image' tool among others.mcp = FastMCP(name="mcp-notify", version="0.1.8") wework.add_tools(mcp)
- mcp_notify/wework.py:20-21 (helper)Pydantic Field helpers used for the bot_key parameter in wework_send_image and other WeWork tools, providing descriptions and defaulting to environment variables.FIELD_BOT_KEY = Field("", description="企业微信群机器人key,uuid格式,默认从环境变量获取") FIELD_TO_USER = Field("", description="接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取")