Skip to main content
Glama

gitlab_add_issue_comment

Add comments to GitLab issues to provide feedback, updates, or additional information using markdown formatting with mentions and references.

Instructions

Add comment to issue Returns: Created comment object Use when: Providing feedback, updates Supports: Markdown, mentions, references

Example: "Fixed in PR !456. Please test and confirm."

Related tools:

  • gitlab_get_issue: Read issue first

  • gitlab_list_issues: Find issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted
issue_iidYesIssue number (IID - Internal ID) Type: integer Format: Project-specific issue number (without #) Required: Yes Examples: - 123 (for issue #123) - 4567 (for issue #4567) How to find: Look at issue URL or title - URL: https://gitlab.com/group/project/-/issues/123 → use 123 - Title: "Fix login bug (#123)" → use 123 Note: This is NOT the global issue ID
bodyYesComment content Type: string Required: Yes Format: GitLab Flavored Markdown Features: - Mentions: @username - References: #123, !456 - Code blocks: ```language - Task lists: - [ ] Task - Slash commands: /assign @user Examples: 'LGTM! 👍' 'Found an issue in line 42: ```python # This could be None result = data["key"] ``` Should check if key exists first.'

Implementation Reference

  • The main handler function that implements the core logic of the gitlab_add_issue_comment tool. It validates input parameters, detects the project if not provided, extracts issue_iid and body, and delegates to GitLabClient.add_issue_comment.
    def handle_add_issue_comment(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle adding a comment to an issue""" project_id = require_project_id(client, arguments) issue_iid = require_argument(arguments, "issue_iid") body = require_argument(arguments, "body") return client.add_issue_comment(project_id, issue_iid, body)
  • Pydantic/MCP schema definition for the tool, including input validation schema with required parameters project_id (optional), issue_iid, and body.
    types.Tool( name=TOOL_ADD_ISSUE_COMMENT, description=desc.DESC_ADD_ISSUE_COMMENT, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID}, "issue_iid": {"type": "integer", "description": desc.DESC_ISSUE_IID}, "body": {"type": "string", "description": desc.DESC_COMMENT_BODY} }, "required": ["issue_iid", "body"] } ),
  • Registration of the handler in the TOOL_HANDLERS dictionary mapping, which is used by the server to dispatch tool calls to the correct handler function.
    TOOL_APPROVE_MR: handle_approve_merge_request, TOOL_ADD_ISSUE_COMMENT: handle_add_issue_comment, TOOL_ADD_MR_COMMENT: handle_add_merge_request_comment,
  • Constant defining the exact tool name string used throughout the codebase for consistency.
    TOOL_ADD_ISSUE_COMMENT = "gitlab_add_issue_comment"
  • Detailed description string for the tool, used in the schema and documentation.
    DESC_ADD_ISSUE_COMMENT = """Add comment to issue Returns: Created comment object Use when: Providing feedback, updates Supports: Markdown, mentions, references Example: "Fixed in PR !456. Please test and confirm." Related tools: - gitlab_get_issue: Read issue first - gitlab_list_issues: Find issues"""

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/Vijay-Duke/mcp-gitlab'

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