Skip to main content
Glama

钉钉群机器人-发送文本消息

ding_send_text

Sends text or Markdown messages to DingTalk group robots using a bot access token. Supports custom message types and titles.

Instructions

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

Input Schema

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

Implementation Reference

  • The tool 'ding_send_text' is registered via @mcp.tool decorator on the function ding_send_text within add_tools(), which is called from __init__.py
    @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()
  • Handler function for ding_send_text: sends text/markdown messages to DingTalk group robot via HTTP POST to DingTalk Open API
    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()
  • Schema/input definition for ding_send_text: accepts text (required), title, msgtype, and bot_key parameters using pydantic Field descriptors
    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,默认从环境变量获取"),
    ):
  • Registration call: other.add_tools(mcp) is invoked in __init__.py to register all tools from other.py, including ding_send_text
    other.add_tools(mcp)
Behavior2/5

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

No annotations provided. Description only restates the basic function without disclosing behavioral traits such as rate limits, error handling, or side effects of sending messages.

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?

Single sentence is concise and front-loaded with the core action. No redundant information, though a bit more structure could help.

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 no output schema, no annotations, and 4 parameters, the description is minimal. It omits details like default msgtype behavior, optional title usage, and environment variable fallback.

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 coverage is 100% with descriptions for all parameters. Description adds no extra meaning beyond the schema, achieving baseline expectations.

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 tool sends text or Markdown messages via DingTalk group robot (specific verb+resource). The title and description distinguish it from sibling notification tools.

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 (e.g., other messaging tools). No mention of prerequisites like configuring a bot token or how to choose between text and Markdown.

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