Skip to main content
Glama

add_issue_comment

Add comments to GitLab issues to provide updates, ask questions, or document progress within project workflows.

Instructions

Add a comment to an issue in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or URL-encoded path
issue_iidYesIssue internal ID
bodyYesContent of the comment

Implementation Reference

  • Implementation of addIssueComment which makes a POST request to the GitLab API to add a comment to an issue.
    export async function addIssueComment(projectId: string, issueIid: number, body: string): Promise<GitLabComment> {
      if (!projectId?.trim()) {
        throw new Error("Project ID is required");
      }
      if (!issueIid || issueIid < 1) {
        throw new Error("Valid issue IID is required");
      }
      if (!body?.trim()) {
        throw new Error("Comment body is required");
      }
    
      const endpoint = `/projects/${encodeProjectId(projectId)}/issues/${issueIid}/notes`;
    
      const comment = await gitlabPost<GitLabComment>(endpoint, { body });
      return GitLabCommentSchema.parse(comment);
    }
  • Zod schema for validating add_issue_comment arguments.
    export const AddIssueCommentSchema = z.object({
      project_id: z.string().describe("Project ID or URL-encoded path"),
      issue_iid: z.number().describe("Issue internal ID"),
      body: z.string().describe("Content of the comment")
    });
  • src/server.ts:412-416 (registration)
    Registration/Handler block in the MCP server switch statement.
    case "add_issue_comment": {
      const args = AddIssueCommentSchema.parse(request.params.arguments);
      const comment = await api.addIssueComment(args.project_id, args.issue_iid, args.body);
      return { content: [{ type: "text", text: JSON.stringify(comment, null, 2) }] };
    }

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/TheRealChrisThomas/gitlab-mcp-server'

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