gitlab_add_issue_comment
Add comments to GitLab issues, supporting Markdown, mentions, and references. Use to provide feedback, updates, or discussions on issues. Requires issue number and comment content.
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
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Comment 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.' | |
| issue_iid | Yes | Issue 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 | |
| project_id | No | Project 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 |
Implementation Reference
- src/mcp_gitlab/tool_handlers.py:329-336 (handler)Core handler function that validates and extracts parameters (project_id auto-detected if missing, issue_iid, body), then calls GitLabClient.add_issue_comment to post the 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)
- MCP tool schema defining input parameters: project_id (string, optional), issue_iid (required integer), body (required string).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"] } ),
- src/mcp_gitlab/tool_handlers.py:1048-1048 (registration)Registration of the handler function in the central TOOL_HANDLERS dictionary used by server.call_tool().TOOL_ADD_ISSUE_COMMENT: handle_add_issue_comment,
- src/mcp_gitlab/constants.py:235-235 (helper)Constant defining the official tool name string used across the codebase.TOOL_ADD_ISSUE_COMMENT = "gitlab_add_issue_comment"