Skip to main content
Glama
sfyyy

Claude Code DingTalk MCP Server

by sfyyy

dingtalk_send_text

Send text messages to DingTalk groups from Claude Code for task alerts and notifications, with optional @all mentions.

Instructions

Send a text message to DingTalk group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesText content to send
atAllNoWhether to @all members

Implementation Reference

  • MCP tool handler function that prepares the message by appending the git username and calls DingTalkClient.sendText to send the text message to DingTalk.
    private async handleSendText(args: { content: string; atAll?: boolean }) {
      if (!this.dingTalkClient) {
        throw new Error('DingTalk client not configured. Use dingtalk_configure first or set environment variables (DINGTALK_WEBHOOK, DINGTALK_SECRET).');
      }
    
      const gitUsername = this.getGitUsername();
      const contentWithUser = `${args.content}\n\n---\nšŸ‘¤ å‘é€č€…: ${gitUsername}`;
    
      const success = await this.dingTalkClient.sendText(contentWithUser, args.atAll);
      return {
        content: [
          {
            type: 'text',
            text: success 
              ? 'āœ… Text message sent successfully' 
              : 'āŒ Failed to send text message',
          },
        ],
      };
    }
  • Input schema definition for the dingtalk_send_text tool, specifying content as required string and optional atAll boolean.
    inputSchema: {
      type: 'object',
      properties: {
        content: {
          type: 'string',
          description: 'Text content to send',
        },
        atAll: {
          type: 'boolean',
          description: 'Whether to @all members',
          default: false,
        },
      },
      required: ['content'],
    },
  • src/index.ts:85-103 (registration)
    Tool registration in the listTools response, including name, description, and input schema.
    {
      name: 'dingtalk_send_text',
      description: 'Send a text message to DingTalk group',
      inputSchema: {
        type: 'object',
        properties: {
          content: {
            type: 'string',
            description: 'Text content to send',
          },
          atAll: {
            type: 'boolean',
            description: 'Whether to @all members',
            default: false,
          },
        },
        required: ['content'],
      },
    },
  • Helper method in DingTalkClient that constructs the text message payload and delegates to sendMessage.
    async sendText(content: string, atAll = false): Promise<boolean> {
      return this.sendMessage({
        msgtype: 'text',
        text: { content },
        at: { isAtAll: atAll }
      });
    }
  • Core helper function that handles HTTP POST to DingTalk webhook, including optional signature generation for security.
    async sendMessage(message: DingTalkMessage): Promise<boolean> {
      try {
        const signParams = this.generateSign();
        const url = signParams 
          ? `${this.config.webhook}&${signParams}`
          : this.config.webhook;
    
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify(message),
        });
    
        const result = await response.json();
        return result.errcode === 0;
      } catch (error) {
        console.error('DingTalk notification failed:', error);
        return false;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions sending a message but doesn't cover critical aspects like authentication requirements, rate limits, error conditions, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the core functionality without unnecessary elaboration.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error handling, or behavioral traits like side effects. Given the complexity of sending messages (which involves authentication and potential failures), more context is needed.

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 description coverage is 100%, so the schema already documents both parameters ('content' and 'atAll') adequately. The description doesn't add any parameter-specific information beyond what's in the schema, such as content length limits or '@all' behavior details, meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('send a text message') and target ('to DingTalk group'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'dingtalk_send_markdown' or 'dingtalk_send_link' that also send messages, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'dingtalk_send_markdown' or 'dingtalk_send_link', nor does it mention prerequisites or context for sending messages. It simply states what the tool does without usage instructions.

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/sfyyy/claude-code-dingtalk-mcp'

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