Skip to main content
Glama
lh8966
by lh8966

send_to_wechat

Send GitLab commit updates and work reports to WeChat Work groups using text or markdown messages for team communication.

Instructions

发送消息到企业微信

Input Schema

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

Implementation Reference

  • The main handler function for the 'send_to_wechat' tool. Validates input parameters and delegates message sending to WeChatService.sendMessage, then returns the result in MCP format.
    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 for the send_to_wechat tool defining message and optional messageType parameters.
    inputSchema: { type: 'object', properties: { message: { type: 'string', description: '要发送的消息内容', }, messageType: { type: 'string', enum: ['text', 'markdown'], description: '消息类型', default: 'text', }, }, required: ['message'], },
  • src/index.js:68-87 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    { name: 'send_to_wechat', description: '发送消息到企业微信', 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)
    Dispatch case in the CallToolRequest handler that routes 'send_to_wechat' calls to the handler function.
    case 'send_to_wechat': return await this.handleSendToWeChat(args);
  • Core helper method in WeChatService that handles sending messages via webhook or API, called by the tool handler.
    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