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"""
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by stating the return type ('Created comment object'), supported features ('Supports: Markdown, mentions, references'), and providing an example. However, it lacks details on permissions, error conditions, or rate limits, which would be helpful for a mutation tool.

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 well-structured and front-loaded with the core purpose, followed by return value, usage guidelines, features, an example, and related tools. Each section is concise and adds value without redundancy, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, mutation operation) and lack of annotations or output schema, the description does a good job covering purpose, usage, and behavior. It includes an example and related tools, but could improve by mentioning authentication needs or potential side effects, which are relevant for a comment-adding tool.

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 schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description does not add any parameter-specific information beyond what the schema provides, such as explaining the relationship between parameters or additional constraints. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add comment to issue') and resource ('issue'), distinguishing it from sibling tools like gitlab_add_merge_request_comment. It specifies the return value ('Created comment object'), making the purpose explicit and distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly provides usage context with 'Use when: Providing feedback, updates' and lists related tools ('gitlab_get_issue: Read issue first', 'gitlab_list_issues: Find issues'), offering clear guidance on when to use this tool and what alternatives to consider for prerequisite steps.

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

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