Skip to main content
Glama
lh8966

GitLab WeChat MCP

by lh8966

generate_daily_report

Generate and send GitLab commit summaries as daily reports to WeChat Work groups. Query commits by date, user, or project for automated team updates.

Instructions

生成并发送GitLab提交记录的日报到企业微信

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameNoGitLab用户名(可选,默认使用配置的用户名)
dateYes查询日期,格式:YYYY-MM-DD
projectIdNo项目ID(可选,不指定则查询所有项目)

Implementation Reference

  • Main handler function that implements the generate_daily_report tool logic: validates input, fetches GitLab commits using GitLabService, generates report content using helper, sends markdown report via WeChatService, and returns result.
    async handleGenerateDailyReport(args) {
      // 验证参数
      ErrorHandler.validateParams(args, {
        date: { required: true, type: 'string', format: 'date' },
        username: { required: false, type: 'string' },
        projectId: { required: false, type: 'string' },
      });
    
      const { username, date, projectId } = args;
      const gitlabConfig = config.getGitLabConfig();
      const actualUsername = username || gitlabConfig.username;
      
      logger.info('开始生成日报', { date, username: actualUsername, projectId });
      
      // 获取提交记录
      const commits = await this.gitlabService.getCommitsByDate(
        actualUsername,
        date,
        projectId
      );
    
      // 生成日报内容
      const report = this.generateReportContent(commits, date, actualUsername);
    
      // 发送到企业微信
      const result = await this.wechatService.sendMessage(report, 'markdown');
    
      logger.info(`日报生成并发送${result.success ? '成功' : '失败'}`, { commitCount: commits.length });
    
      return {
        content: [
          {
            type: 'text',
            text: `日报生成并发送${result.success ? '成功' : '失败'}\n\n报告内容:\n${report}`,
          },
        ],
      };
    }
  • Supporting function that formats the daily report as Markdown from the list of commits, including summary stats and detailed list.
    generateReportContent(commits, date, username) {
      const commitCount = commits.length;
      const projects = [...new Set(commits.map(c => c.project_name))];
      
      let report = `# ${username} 的代码提交日报\n\n`;
      report += `**日期**: ${date}\n`;
      report += `**提交数量**: ${commitCount}\n`;
      report += `**涉及项目**: ${projects.join(', ')}\n\n`;
    
      if (commitCount === 0) {
        report += '今日无代码提交记录。';
      } else {
        report += '## 提交详情\n\n';
        commits.forEach((commit, index) => {
          report += `### ${index + 1}. ${commit.title}\n`;
          report += `- **项目**: ${commit.project_name}\n`;
          report += `- **时间**: ${new Date(commit.committed_date).toLocaleString('zh-CN')}\n`;
          report += `- **分支**: ${commit.ref_name || 'unknown'}\n`;
          if (commit.message && commit.message !== commit.title) {
            report += `- **详情**: ${commit.message.replace(commit.title, '').trim()}\n`;
          }
          report += `- **链接**: [查看提交](${commit.web_url})\n\n`;
        });
      }
    
      return report;
    }
  • Input schema defining parameters for generate_daily_report tool: date (required), username and projectId (optional).
    inputSchema: {
      type: 'object',
      properties: {
        username: {
          type: 'string',
          description: 'GitLab用户名(可选,默认使用配置的用户名)',
        },
        date: {
          type: 'string',
          description: '查询日期,格式:YYYY-MM-DD',
        },
        projectId: {
          type: 'string',
          description: '项目ID(可选,不指定则查询所有项目)',
        },
      },
      required: ['date'],
    },
  • src/index.js:88-109 (registration)
    Registration of the generate_daily_report tool in the ListTools response, including name, description, and input schema.
    {
      name: 'generate_daily_report',
      description: '生成并发送GitLab提交记录的日报到企业微信',
      inputSchema: {
        type: 'object',
        properties: {
          username: {
            type: 'string',
            description: 'GitLab用户名(可选,默认使用配置的用户名)',
          },
          date: {
            type: 'string',
            description: '查询日期,格式:YYYY-MM-DD',
          },
          projectId: {
            type: 'string',
            description: '项目ID(可选,不指定则查询所有项目)',
          },
        },
        required: ['date'],
      },
    },
  • src/index.js:126-127 (registration)
    Dispatch/registration of the handler in the CallToolRequest switch statement.
    case 'generate_daily_report':
      return await this.handleGenerateDailyReport(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates and sends reports, implying a write/send operation, but doesn't cover critical aspects like authentication needs, rate limits, error handling, or what '发送' entails (e.g., direct message, group chat). For a tool with no annotations and a mutation action, this is a significant gap in transparency.

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: '生成并发送GitLab提交记录的日报到企业微信'. It's front-loaded with the core action and destination, with zero wasted words. Every part earns its place by specifying the what, from where, and to where.

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 tool's complexity (generating and sending reports, implying mutation), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the report contains, how it's formatted, success/failure responses, or integration details. For a tool with behavioral implications and no structured support, more context is needed to be fully helpful.

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 input schema has 100% description coverage, with clear parameter details (e.g., 'username' is optional with a default, 'date' is required in YYYY-MM-DD format, 'projectId' is optional for filtering). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 tool's purpose: '生成并发送GitLab提交记录的日报到企业微信' (generate and send daily GitLab commit reports to WeChat). It specifies the verb ('生成并发送'), resource ('GitLab提交记录的日报'), and destination ('企业微信'), making the action explicit. However, it doesn't differentiate from sibling tools like 'get_gitlab_commits' or 'send_to_wechat', which might handle parts of this process separately.

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. It doesn't mention sibling tools (e.g., 'get_gitlab_commits' for just fetching commits or 'send_to_wechat' for sending messages), prerequisites, or exclusions. Usage is implied from the purpose but lacks explicit context for tool selection.

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