Skip to main content
Glama
lh8966

GitLab WeChat MCP

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}`,
        };
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action '发送消息' (send message), implying a write operation, but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what happens upon success/failure. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a message-sending tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., side effects, response format), usage context, and doesn't compensate for the absence of structured fields, making it inadequate for full agent understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters ('message' and 'messageType'), including enum values and defaults. The description adds no additional meaning beyond the schema, such as examples or constraints, so it meets the baseline of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '发送消息到企业微信' clearly states the action (send) and target (WeChat Enterprise), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'generate_daily_report' or 'get_gitlab_commits', which are unrelated communication tools, so it doesn't need sibling differentiation but could be more specific about what kind of messages it sends.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or any context for its application. It lacks information about prerequisites, target audience (e.g., specific WeChat groups or users), or scenarios where it's appropriate, leaving the agent with minimal usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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