Skip to main content
Glama
sfyyy

Claude Code DingTalk MCP Server

by sfyyy

dingtalk_send_link

Send link messages with titles, descriptions, and optional images to DingTalk groups from Claude Code for notifications and alerts.

Instructions

Send a link message to DingTalk group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesLink title
textYesLink description text
messageUrlYesTarget URL
picUrlNoOptional image URL

Implementation Reference

  • src/index.ts:127-152 (registration)
    Registration of the 'dingtalk_send_link' tool in the ListTools handler, including name, description, and input schema.
    {
      name: 'dingtalk_send_link',
      description: 'Send a link message to DingTalk group',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'Link title',
          },
          text: {
            type: 'string',
            description: 'Link description text',
          },
          messageUrl: {
            type: 'string',
            description: 'Target URL',
          },
          picUrl: {
            type: 'string',
            description: 'Optional image URL',
          },
        },
        required: ['title', 'text', 'messageUrl'],
      },
    },
  • Main handler function for the dingtalk_send_link tool, called from the switch statement in CallToolRequestSchema handler. Checks client configuration and delegates to DingTalkClient.sendLink.
    private async handleSendLink(args: { title: string; text: string; messageUrl: string; picUrl?: string }) {
      if (!this.dingTalkClient) {
        throw new Error('DingTalk client not configured. Use dingtalk_configure first or set environment variables (DINGTALK_WEBHOOK, DINGTALK_SECRET).');
      }
    
      const success = await this.dingTalkClient.sendLink(args.title, args.text, args.messageUrl, args.picUrl);
      return {
        content: [
          {
            type: 'text',
            text: success 
              ? '✅ Link message sent successfully' 
              : '❌ Failed to send link message',
          },
        ],
      };
    }
  • Core implementation of sending a link message in DingTalkClient, constructs the DingTalkMessage object and calls sendMessage.
    async sendLink(title: string, text: string, messageUrl: string, picUrl?: string): Promise<boolean> {
      return this.sendMessage({
        msgtype: 'link',
        link: { title, text, messageUrl, picUrl }
      });
    }
  • Generic sendMessage helper in DingTalkClient that handles HTTP POST to webhook with optional signature, used by all message types including link.
    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;
      }
    }
  • Type definition for link message in DingTalkMessage interface, used to structure the payload for DingTalk API.
    link?: {
      title: string;
      text: string;
      picUrl?: string;
      messageUrl: string;
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Send') but doesn't mention whether this requires authentication, has rate limits, affects group state, or what happens on success/failure. For a messaging tool with zero annotation coverage, this leaves critical behavioral traits unspecified.

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 that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 the complexity of a messaging tool with no annotations and no output schema, the description is insufficient. It doesn't cover behavioral aspects like authentication needs, error handling, or response format, and it fails to differentiate from sibling tools, leaving gaps in contextual understanding.

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 all four parameters (title, text, messageUrl, picUrl) with clear descriptions. The description adds no additional meaning beyond implying these parameters are used to construct a 'link message,' which is minimal value over what the schema provides.

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') and target ('link message to DingTalk group'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like dingtalk_send_markdown or dingtalk_send_text, which presumably also send messages to DingTalk groups but in different formats.

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_text. It mentions 'link message' but doesn't explain what contexts or message types warrant a link format over text or markdown, leaving the agent to guess based on tool names alone.

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