Skip to main content
Glama

企业微信群机器人-发送图片消息

wework_send_image

Send image messages to WeChat Work (WeWork) group chat using a robot. Provide the image URL and optional bot key to notify your team.

Instructions

通过企业微信群机器人发送图片消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes图片url
bot_keyNo企业微信群机器人key,uuid格式,默认从环境变量获取

Implementation Reference

  • The handler function for the 'wework_send_image' MCP tool. It downloads an image from a URL, converts it to base64, computes its MD5 hash, and sends it to a WeWork group robot via webhook.
    @mcp.tool(
        title="企业微信群机器人-发送图片消息",
        description="通过企业微信群机器人发送图片消息",
    )
    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()
  • Input schema for wework_send_image: takes a URL string for the image and an optional bot_key (defaulting from environment variable).
    def wework_send_image(
        url: str = Field(description="图片url"),
        bot_key: str = FIELD_BOT_KEY,
  • Helper field definition reused across WeWork bot tools, providing the bot_key parameter schema with default from env.
    FIELD_BOT_KEY = Field("", description="企业微信群机器人key,uuid格式,默认从环境变量获取")
    FIELD_TO_USER = Field("", description="接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取")
    
    
    def add_tools(mcp: FastMCP, logger=None):
    
        @mcp.tool(
            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.tool(
            title="企业微信群机器人-发送图片消息",
            description="通过企业微信群机器人发送图片消息",
        )
        def wework_send_image(
            url: str = Field(description="图片url"),
            bot_key: str = FIELD_BOT_KEY,
        ):
  • Registration of the 'wework_send_image' tool via the @mcp.tool decorator.
    @mcp.tool(
        title="企业微信群机器人-发送图片消息",
        description="通过企业微信群机器人发送图片消息",
    )
  • The add_tools function is called from __init__.py to register all WeWork tools on the MCP server.
    def add_tools(mcp: FastMCP, logger=None):
    
        @mcp.tool(
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description fails to disclose behavioral traits such as authentication requirements, rate limits, or whether it overwrites existing content. The schema hints at bot_key defaulting from environment, but this is minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no waste. Front-loaded with essential information about what the tool does.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description is adequate for a simple tool but lacks details on return values, error handling, or success confirmation. It covers the core purpose but leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage for both parameters. The description does not add extra meaning beyond what the schema already provides, so baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (send), resource (image message via WeChat Work group robot), and distinguishes from siblings that send other message types or via different channels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like wework_send_text or wework_send_news. Does not specify prerequisites or when the tool is not appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aahl/mcp-notify'

If you have feedback or need assistance with the MCP directory API, please join our Discord server