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
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Message title | |
| text | Yes | Markdown formatted text content | |
| atAll | No | Whether to @all members |
Implementation Reference
- src/index.ts:287-305 (handler)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', }, ], }; - src/index.ts:104-126 (schema)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 }); - src/dingtalk.ts:77-83 (helper)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 } }); } - src/session-notifier.ts:206-211 (helper)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 }