Skip to main content
Glama

wework_app_send_text

Send text or Markdown messages through WeWork enterprise accounts to specified users or all members. Supports messages up to 2048 bytes for team communication and notifications.

Instructions

通过企业微信应用号发送文本或Markdown消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes消息内容,最长不超过2048个字节
msgtypeNo内容类型,仅支持: text/markdowntext
touserNo接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取

Implementation Reference

  • The handler function that sends text or markdown messages to specified users via the enterprise WeChat (WeWork) application using the obtained access token.
    def wework_app_send_text( text: str = Field(description="消息内容,最长不超过2048个字节"), msgtype: str = Field("text", description="内容类型,仅支持: text/markdown"), touser: str = FIELD_TO_USER, ): 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: {"content": text}, "enable_duplicate_check": 1, "duplicate_check_interval": 60, }, ) return res.json() or {}
  • The @mcp.tool decorator registers the wework_app_send_text function as an MCP tool with title and description.
    @mcp.tool( title="企业微信应用号-发送文本消息", description="通过企业微信应用号发送文本或Markdown消息", )
  • Invokes add_tools from the wework module on the FastMCP instance to register all WeWork tools, including wework_app_send_text.
    wework.add_tools(mcp)
  • Cached utility function to fetch and cache the WeWork access token using corp ID and secret, used in the handler.
    @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")
  • Pydantic Field definition for the 'touser' parameter schema, providing default and description.
    FIELD_TO_USER = Field("", description="接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取")

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