Skip to main content
Glama

ding_send_text

Send text or Markdown messages to DingTalk group bots for team notifications and alerts.

Instructions

钉钉群机器人发送文本或Markdown消息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes消息内容
titleNo消息标题
msgtypeNo内容类型,仅支持: text/markdownmarkdown
bot_keyNo钉钉群机器人access_token,默认从环境变量获取

Implementation Reference

  • The @mcp.tool decorator registers and defines the 'ding_send_text' handler function, which sends text or Markdown messages to a DingTalk group robot via the API. Includes parameter schema via Pydantic Fields.
    @mcp.tool(
        title="钉钉群机器人-发送文本消息",
        description="钉钉群机器人发送文本或Markdown消息",
    )
    def ding_send_text(
        text: str = Field(description="消息内容"),
        title: str = Field("", description="消息标题"),
        msgtype: str = Field("markdown", description="内容类型,仅支持: text/markdown"),
        bot_key: str = Field("", description="钉钉群机器人access_token,默认从环境变量获取"),
    ):
        """
        https://open.dingtalk.com/document/development/custom-robots-send-group-messages
        """
        if msgtype == "markdown":
            body = {"title": title, "text": text}
        else:
            body = {"content": f'{title}\n{text}'.strip()}
        if not bot_key:
            bot_key = os.getenv("DINGTALK_BOT_KEY", "")
        base = os.getenv("DINGTALK_BASE_URL") or "https://oapi.dingtalk.com"
        res = requests.post(
            f"{base}/robot/send?access_token={bot_key}",
            json={"msgtype": msgtype, msgtype: body},
        )
        return res.json()
  • Top-level registration call that invokes other.add_tools(mcp) to register the ding_send_text tool among others.
    other.add_tools(mcp)
  • Pydantic Field definitions providing the input schema for the ding_send_text tool parameters.
    def ding_send_text(
        text: str = Field(description="消息内容"),
        title: str = Field("", description="消息标题"),
        msgtype: str = Field("markdown", description="内容类型,仅支持: text/markdown"),
        bot_key: str = Field("", description="钉钉群机器人access_token,默认从环境变量获取"),
    ):

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