Skip to main content
Glama

gitlab_add_comment_to_issue

Add comments to GitLab issues to provide updates, ask questions, or share information directly through the MCP server for GitLab and Jira integration.

Instructions

Adds a comment to a GitLab issue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe path of the GitLab project.
issueIidYesThe internal ID of the issue.
bodyYesThe comment text.

Implementation Reference

  • MCP tool handler for gitlab_add_comment_to_issue: extracts arguments, calls GitLabService.addCommentToIssue, and returns success response.
    case 'gitlab_add_comment_to_issue': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const { projectPath, issueIid, body } = args as { projectPath: string; issueIid: number; body: string };
      const result = await gitlabService.addCommentToIssue(projectPath, issueIid, body);
      return {
        content: [
          {
            type: 'text',
            text: `Comment added successfully: ${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • Tool schema definition and registration in allTools array, including input schema for projectPath, issueIid, and body.
    {
      name: 'gitlab_add_comment_to_issue',
      description: 'Adds a comment to a GitLab issue.',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'The path of the GitLab project.',
          },
          issueIid: {
            type: 'number',
            description: 'The internal ID of the issue.',
          },
          body: {
            type: 'string',
            description: 'The comment text.',
          },
        },
        required: ['projectPath', 'issueIid', 'body'],
      },
  • Core implementation in GitLabService: calls GitLab API to POST a note (comment) to the specified issue.
    async addCommentToIssue(projectPath: string, issueIid: number, body: string): Promise<any> {
      const encodedProjectPath = encodeURIComponent(projectPath);
      return this.callGitLabApi<any>(
        `projects/${encodedProjectPath}/issues/${issueIid}/notes`,
        'POST',
        { body },
      );
    }

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/HainanZhao/mcp-gitlab-jira'

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