Skip to main content
Glama
al-one

MCP Server for notify to weixin / telegram / bark / lark

企业微信应用号-发送图片消息

wework_app_send_image

Send image notifications through WeChat Work applications to specified users or groups using image URLs.

Instructions

通过企业微信应用号发送发送图片消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes图片URL
touserNo接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取

Implementation Reference

  • The main handler function for the 'wework_app_send_image' tool. It takes a URL and optional touser, then delegates to the shared wework_send_media helper function specifying media type 'image'.
    def wework_app_send_image(
        url: str = Field(description="图片URL"),
        touser: str = FIELD_TO_USER,
    ):
        return wework_send_media(touser, url, "image")
  • The @mcp.tool decorator registers the wework_app_send_image function as an MCP tool with title and description.
    @mcp.tool(
        title="企业微信应用号-发送图片消息",
        description="通过企业微信应用号发送发送图片消息",
    )
  • Core helper function that downloads media from URL, uploads it to WeWork media API, and sends it via the app message API. Determines media type based on URL extension or provided msgtype. Used by wework_app_send_image and similar tools.
    def wework_send_media(touser, url: str, msgtype=None):
        if msgtype:
            pass
        elif '.jpg' in url.lower() or '.jpeg' in url.lower() or '.png' in url.lower():
            msgtype = 'image'
        elif '.mp4' in url.lower():
            msgtype = 'video'
        elif '.arm' in url.lower():
            msgtype = 'voice'
        else:
            msgtype = 'file'
        res = requests.get(url, timeout=120)
        res.raise_for_status()
        file = io.BytesIO(res.content)
        mine = res.headers.get("content-type") or "application/octet-stream"
        res = requests.post(
            f"{WEWORK_BASE_URL}/cgi-bin/media/upload",
            params={"type": msgtype, "access_token": get_access_token()},
            files={"media": ("filename", file, mine)},
            timeout=120,
        )
        media = res.json() or {}
        if not (media_id := media.get("media_id")):
            return media
        res = requests.post(
            f"{WEWORK_BASE_URL}/cgi-bin/message/send?access_token={get_access_token()}",
            json={
                "touser": touser or WEWORK_APP_TOUSER,
                "agentid": WEWORK_APP_AGENTID,
                "msgtype": msgtype,
                msgtype: {"media_id": media_id},
            },
        )
        return res.json()
  • Cached helper function to fetch WeWork application access token using corp ID and secret from environment variables.
    @cached(TTLCache(maxsize=1, ttl=3600))
    def get_access_token():
        res = requests.get(
            f"{WEWORK_BASE_URL}/cgi-bin/gettoken",
            params={"corpid": WEWORK_APP_CORPID, "corpsecret": WEWORK_APP_SECRET},
            timeout=60,
        )
        return res.json().get("access_token")
  • Top-level call to add_tools from wework module, which registers all WeWork tools including wework_app_send_image to the main MCP instance.
    wework.add_tools(mcp)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions sending an image message but doesn't disclose behavioral traits such as authentication requirements, rate limits, error handling, or what happens on success/failure. This leaves critical operational details unclear for a tool that likely involves external API calls.

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

Conciseness4/5

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

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, though it could benefit from more detail to improve usefulness without sacrificing conciseness.

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

Completeness2/5

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

Given the complexity of sending messages via an external service like WeChat Work, with no annotations and no output schema, the description is incomplete. It lacks information on authentication, response format, error cases, or how it differs from similar tools, making it inadequate for safe and effective use by an AI agent.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('url' for image URL, 'touser' for recipient IDs). The description adds no additional meaning beyond what the schema provides, such as explaining URL format constraints or recipient ID examples, meeting the baseline for high coverage.

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

Purpose3/5

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

The description states the action ('发送图片消息' - send image message) and target ('企业微信应用号' - WeChat Work app), which is clear but basic. It doesn't distinguish this tool from its siblings like 'wework_app_send_text' or 'wework_app_send_video' beyond mentioning 'image', leaving the purpose somewhat vague regarding specific use cases.

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 is provided on when to use this tool versus alternatives. With many sibling tools for sending different message types (e.g., text, video, file) in WeChat Work, the description lacks context on selection criteria, prerequisites, or exclusions, offering only a bare statement of function.

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/al-one/mcp-notify'

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