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; };

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