Skip to main content
Glama

wework_send_text

Send text or Markdown messages to WeWork group chats using bot integration. Configure message type and content to deliver notifications through enterprise communication channels.

Instructions

通过企业微信群机器人发送文本或Markdown消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes消息内容,长度限制: (text: 2048个字节, markdown_v2: 4096个字节)
msgtypeNo内容类型,仅支持: text/markdown_v2text
bot_keyNo企业微信群机器人key,uuid格式,默认从环境变量获取

Implementation Reference

  • Handler function for the 'wework_send_text' tool. Decorated with @mcp.tool() for registration and defines input schema via Pydantic Fields. Implements sending text or markdown_v2 messages to WeWork group robot via webhook.
    @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()
  • Registration of WeWork tools, including 'wework_send_text', by calling add_tools on the MCP instance.
    wework.add_tools(mcp)
  • Pydantic Field definitions reused in tool parameters for input validation, specifically bot_key uses FIELD_BOT_KEY.
    FIELD_BOT_KEY = Field("", description="企业微信群机器人key,uuid格式,默认从环境变量获取") FIELD_TO_USER = Field("", description="接收消息的成员ID,多个用`|`分隔,为`@all`时向该企业应用全部成员发送,默认从环境变量获取")
  • Environment variable configurations used as defaults in the wework_send_text tool, such as WEWORK_BOT_KEY and WEWORK_BASE_URL.
    WEWORK_BOT_KEY = os.getenv("WEWORK_BOT_KEY", "") WEWORK_APP_AGENTID = int(os.getenv("WEWORK_APP_AGENTID", 1000002)) WEWORK_APP_CORPID = os.getenv("WEWORK_APP_CORPID", "") WEWORK_APP_SECRET = os.getenv("WEWORK_APP_SECRET", "") WEWORK_APP_TOUSER = os.getenv("WEWORK_APP_TOUSER", "@all") WEWORK_BASE_URL = os.getenv("WEWORK_BASE_URL") or "https://qyapi.weixin.qq.com"

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