Skip to main content
Glama
Shawyeok

mcp-dingding-bot

send_markdown_message

Send formatted markdown messages with titles, mentions, and notifications to DingTalk group chats using a custom robot.

Instructions

Send a markdown message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe title of the message
textYesThe text content to send
atMobilesNoThe mobile numbers of users to @mention (ping) individually in the group chat
atAllNoWhether to @all the users in the group

Implementation Reference

  • Handler function for the 'send_markdown_message' tool. It invokes dingtalkBot.sendMarkdown and formats success or error response.
    async ({ title, text, atMobiles, atAll }) => {
      const response = await dingtalkBot.sendMarkdown(title, text, atMobiles, atAll);
      if (response.errcode !== 0) {
        return {
          content: [{ type: "text", text: `Failed to send message, code: ${response.errcode}, message: ${response.errmsg}` }],
        };
      }
      return {
        content: [{ type: "text", text: "Message sent successfully" }],
      };
    }
  • Zod input schema defining parameters for send_markdown_message tool: title, text, optional atMobiles and atAll.
    {
      title: z.string().describe("The title of the message"),
      text: z.string().describe("The text content to send"),
      atMobiles: z.array(z.string()).optional().describe("The mobile numbers of users to @mention (ping) individually in the group chat"),
      atAll: z.boolean().optional().describe("Whether to @all the users in the group"),
    },
  • src/index.ts:43-63 (registration)
    Registration of the 'send_markdown_message' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      'send_markdown_message',
      'Send a markdown message',
      {
        title: z.string().describe("The title of the message"),
        text: z.string().describe("The text content to send"),
        atMobiles: z.array(z.string()).optional().describe("The mobile numbers of users to @mention (ping) individually in the group chat"),
        atAll: z.boolean().optional().describe("Whether to @all the users in the group"),
      },
      async ({ title, text, atMobiles, atAll }) => {
        const response = await dingtalkBot.sendMarkdown(title, text, atMobiles, atAll);
        if (response.errcode !== 0) {
          return {
            content: [{ type: "text", text: `Failed to send message, code: ${response.errcode}, message: ${response.errmsg}` }],
          };
        }
        return {
          content: [{ type: "text", text: "Message sent successfully" }],
        };
      }
    );
  • Core implementation of sending markdown message: constructs MarkdownMessage payload and performs authenticated POST request to DingTalk robot API.
    async sendMarkdown(
      title: string,
      text: string,
      atMobiles?: string[],
      atAll: boolean = false
    ): Promise<MessageResponse> {
      const data: MarkdownMessage = {
        msgtype: 'markdown',
        markdown: {
          title,
          text,
        },
        at: {
          atMobiles: atMobiles || [],
          isAtAll: atAll,
        },
      };
    
      const response = await fetch(this.getSignedUrl(), {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(data),
      });
      return response.json() as Promise<MessageResponse>;
    }
  • Utility method to generate signed URL for DingTalk API requests using HMAC-SHA256 signature if secret is provided.
    private getSignedUrl(): string {
      const timestamp = Date.now();
    
      if (this.secret) {
        const stringToSign = `${timestamp}\n${this.secret}`;
        const hmac = crypto.createHmac('sha256', this.secret);
        const sign = encodeURIComponent(
          hmac.update(stringToSign).digest('base64')
        );
        return `${this.baseUrl}?access_token=${this.accessToken}×tamp=${timestamp}&sign=${sign}`;
      }
    
      return `${this.baseUrl}?access_token=${this.accessToken}`;
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Send a markdown message' only indicates a sending action without revealing any behavioral traits such as permissions required, rate limits, whether it's a read-only or destructive operation, or what happens upon success/failure. This leaves critical behavioral aspects undocumented.

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

Conciseness5/5

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

The description is extremely concise with just three words, making it front-loaded and free of unnecessary information. Every word directly relates to the tool's function, though this brevity comes at the cost of completeness. For conciseness alone, it scores perfectly.

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

Completeness1/5

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

Given the tool has no annotations, no output schema, and a sibling tool, the description is completely inadequate. It fails to explain what the tool does beyond its name, when to use it, behavioral aspects, or how it differs from 'send_text_message'. For a messaging tool with potential side effects and alternatives, this minimal description provides insufficient context for effective use.

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?

The input schema has 100% description coverage, with all four parameters clearly documented in the schema itself. The description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or usage examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles parameter documentation adequately.

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

Purpose2/5

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

The description 'Send a markdown message' is a tautology that essentially restates the tool name 'send_markdown_message'. It doesn't specify what resource is being acted upon (e.g., a chat channel, notification system, or messaging platform) or distinguish this tool from its sibling 'send_text_message'. The purpose is vague and lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives like 'send_text_message'. The description provides no context about appropriate use cases, prerequisites, or exclusions. Without any usage guidelines, agents cannot make informed decisions between similar tools.

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/Shawyeok/mcp-dingding-bot'

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