Skip to main content
Glama
sfyyy

Claude Code DingTalk MCP Server

by sfyyy

dingtalk_notify_session_end

Send DingTalk notifications when coding sessions end, including duration, tasks completed, and statistics for team awareness.

Instructions

Send a session completion notification with automatic stats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionTypeNoType of session (e.g., "开发协助", "代码审查", "问题解决")开发协助
durationNoSession duration (e.g., "30分钟", "1小时20分")
mainTasksNoList of main tasks completed in this session
summaryNoBrief summary of the session会话已完成
filesCountNoNumber of files modified/created
toolsUsedNoNumber of tools/commands used
atAllNoWhether to @all members

Implementation Reference

  • The handler function that implements the dingtalk_notify_session_end tool. It constructs a detailed markdown message with session details, stats, tasks list, and sends it to DingTalk using the client.
    private async handleNotifySessionEnd(args: { sessionType?: string; duration?: string; mainTasks?: string[]; summary?: string; filesCount?: number; toolsUsed?: number; 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 sessionType = args.sessionType || '开发协助'; const duration = args.duration || '刚刚完成'; const mainTasks = args.mainTasks || []; const summary = args.summary || '会话已完成'; const filesCount = args.filesCount || 0; const toolsUsed = args.toolsUsed || 0; const now = new Date(); const gitUsername = this.getGitUsername(); const title = `🤖 Claude Code ${sessionType}完成`; let content = `## 🤖 Claude Code ${sessionType}完成 **完成时间:** ${now.toLocaleString('zh-CN')} **会话时长:** ${duration} **操作者:** ${gitUsername} ### 📋 本次会话 ${summary}`; if (mainTasks.length > 0) { content += ` ### ✅ 主要任务 ${mainTasks.map(task => `- ${task.trim()}`).join('\n')}`; } content += ` ### 📊 操作统计 - **文件操作:** ${filesCount} 个 - **工具使用:** ${toolsUsed} 次 --- *Claude Code 自动通知 | ${now.toLocaleDateString('zh-CN')}*`; const success = await this.dingTalkClient.sendMarkdown(title, content, args.atAll); return { content: [ { type: 'text', text: success ? '✅ Session completion notification sent successfully' : '❌ Failed to send session completion notification', }, ], }; }
  • Input schema definition for the tool, specifying optional parameters for session notification.
    { name: 'dingtalk_notify_session_end', description: 'Send a session completion notification with automatic stats', inputSchema: { type: 'object', properties: { sessionType: { type: 'string', description: 'Type of session (e.g., "开发协助", "代码审查", "问题解决")', default: '开发协助' }, duration: { type: 'string', description: 'Session duration (e.g., "30分钟", "1小时20分")', }, mainTasks: { type: 'array', items: { type: 'string' }, description: 'List of main tasks completed in this session', }, summary: { type: 'string', description: 'Brief summary of the session', default: '会话已完成' }, filesCount: { type: 'number', description: 'Number of files modified/created', default: 0 }, toolsUsed: { type: 'number', description: 'Number of tools/commands used', default: 0 }, atAll: { type: 'boolean', description: 'Whether to @all members', default: false } }, required: [] }, },
  • src/index.ts:218-227 (registration)
    Switch case in the CallToolRequest handler that routes the tool call to the specific handler method.
    case 'dingtalk_notify_session_end': return await this.handleNotifySessionEnd(args as unknown as { sessionType?: string; duration?: string; mainTasks?: string[]; summary?: string; filesCount?: number; toolsUsed?: number; atAll?: boolean; });

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