Skip to main content
Glama
sfyyy

Claude Code DingTalk MCP Server

by sfyyy

dingtalk_send_markdown

Send formatted markdown messages to DingTalk groups for task alerts and notifications from Claude Code.

Instructions

Send a markdown message to DingTalk group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesMessage title
textYesMarkdown formatted text content
atAllNoWhether to @all members

Implementation Reference

  • The primary handler for the 'dingtalk_send_markdown' tool. It checks if the DingTalk client is configured, appends the Git username to the message text, calls the DingTalkClient's sendMarkdown method, and returns a success or failure response.
    private async handleSendMarkdown(args: { title: string; text: 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 textWithUser = `${args.text}\n\n---\n👤 **发送者:** ${gitUsername}`; const success = await this.dingTalkClient.sendMarkdown(args.title, textWithUser, args.atAll); return { content: [ { type: 'text', text: success ? '✅ Markdown message sent successfully' : '❌ Failed to send markdown message', }, ], };
  • Input schema definition for the 'dingtalk_send_markdown' tool, specifying required title and text fields, and optional atAll boolean.
    { name: 'dingtalk_send_markdown', description: 'Send a markdown message to DingTalk group', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Message title', }, text: { type: 'string', description: 'Markdown formatted text content', }, atAll: { type: 'boolean', description: 'Whether to @all members', default: false, }, }, required: ['title', 'text'], }, },
  • src/index.ts:212-213 (registration)
    Tool dispatch registration in the CallToolRequestSchema handler's switch statement, routing calls to the handleSendMarkdown method.
    case 'dingtalk_send_markdown': return await this.handleSendMarkdown(args as unknown as { title: string; text: string; atAll?: boolean });
  • Helper method in DingTalkClient that formats and sends the markdown message to the DingTalk webhook using the generic sendMessage method.
    async sendMarkdown(title: string, text: string, atAll = false): Promise<boolean> { return this.sendMessage({ msgtype: 'markdown', markdown: { title, text }, at: { isAtAll: atAll } }); }
  • Example usage of the tool in session-notifier.ts, demonstrating how it's called via MCP request.
    name: 'dingtalk_send_markdown', arguments: { title, text: content, atAll: false }

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