Skip to main content
Glama
lh8966
by lh8966

send_to_wechat

Send GitLab commit updates and daily work reports to WeChat Work groups using text or markdown formatting for team communication and progress tracking.

Instructions

发送消息到企业微信

Input Schema

NameRequiredDescriptionDefault
messageYes要发送的消息内容
messageTypeNo消息类型text

Input Schema (JSON Schema)

{ "properties": { "message": { "description": "要发送的消息内容", "type": "string" }, "messageType": { "default": "text", "description": "消息类型", "enum": [ "text", "markdown" ], "type": "string" } }, "required": [ "message" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'send_to_wechat': validates input parameters and delegates message sending to WeChatService.sendMessage, returning success/failure response.
    async handleSendToWeChat(args) { // 验证参数 ErrorHandler.validateParams(args, { message: { required: true, type: 'string' }, messageType: { required: false, type: 'string', enum: ['text', 'markdown'] }, }); const { message, messageType = 'text' } = args; const result = await this.wechatService.sendMessage(message, messageType); logger.info(`企业微信消息发送${result.success ? '成功' : '失败'}`, { messageType }); return { content: [ { type: 'text', text: `消息发送${result.success ? '成功' : '失败'}: ${result.message}`, }, ], }; }
  • Input schema definition for the 'send_to_wechat' tool, specifying message and optional messageType.
    inputSchema: { type: 'object', properties: { message: { type: 'string', description: '要发送的消息内容', }, messageType: { type: 'string', enum: ['text', 'markdown'], description: '消息类型', default: 'text', }, }, required: ['message'], },
  • src/index.js:124-125 (registration)
    Registration of the 'send_to_wechat' handler in the CallToolRequestSchema switch dispatcher.
    case 'send_to_wechat': return await this.handleSendToWeChat(args);
  • Core implementation in WeChatService that sends messages to enterprise WeChat via webhook (preferred) or API, handling both text and markdown formats.
    async sendMessage(message, messageType = 'text') { try { // 优先使用Webhook方式(更简单) if (this.webhookUrl) { return await this.sendWebhookMessage(message, messageType); } // 使用企业微信API方式 if (this.corpId && this.corpSecret && this.agentId) { return await this.sendApiMessage(message, messageType); } throw new Error('未配置企业微信发送方式,请设置WECHAT_WEBHOOK_URL或完整的企业微信API配置'); } catch (error) { console.error('发送企业微信消息失败:', error.message); return { success: false, message: `发送失败: ${error.message}`, }; } }

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/lh8966/gitlab-wechat-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server