Skip to main content
Glama

gitlab_get_merge_request_notes

Retrieve comments and notes from GitLab merge requests to review discussions, track feedback, and analyze code review conversations with pagination and sorting options.

Instructions

List merge request comments Returns: Array of notes/comments with content Use when: Reading MR discussions, reviews Pagination: Yes (default 10 per page) Sorting: By created_at or updated_at

Example response: [{ "id": 789, "body": "Great work! Just one suggestion...", "author": {"username": "reviewer"}, "created_at": "2024-01-15T10:30:00Z", "type": "DiffNote", "resolvable": true, "resolved": false }]

Related tools:

  • gitlab_get_merge_request_discussions: Threaded discussions

  • gitlab_add_merge_request_comment: Add comment

  • gitlab_resolve_discussion: Resolve threads

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
mr_iidYesMerge request number (IID - Internal ID) Type: integer Format: Project-specific MR number (without !) Required: Yes Examples: - 456 (for MR !456) - 7890 (for MR !7890) How to find: Look at MR URL or title - URL: https://gitlab.com/group/project/-/merge_requests/456 → use 456 - Title: "Add new feature (!456)" → use 456 Note: This is NOT the global MR ID
per_pageNoNumber of results per page Type: integer Range: 1-100 Default: 20 Example: 50 (for faster browsing) Tip: Use smaller values (10-20) for detailed operations, larger (50-100) for listing
pageNoPage number for pagination Type: integer Range: ≥1 Default: 1 Example: 3 (to get the third page of results) Note: Use with per_page to navigate large result sets
sortNoSort direction Type: string (enum) Options: 'asc' | 'desc' Default: Varies by context (usually 'desc' for time-based) Examples: - 'asc': A→Z, oldest→newest, smallest→largest - 'desc': Z→A, newest→oldest, largest→smallestasc
order_byNoField to sort by Type: string (enum) Options vary by endpoint: - Commits: 'created_at', 'title' - Issues: 'created_at', 'updated_at', 'priority', 'due_date' - MRs: 'created_at', 'updated_at', 'title' Default: Usually 'created_at' Example: 'updated_at' to see recently modified items firstcreated_at
max_body_lengthNoMaximum length for text content Type: integer Range: 0-10000 (0 = unlimited) Default: 1000 Examples: - 0: Show full content (no truncation) - 500: Limit to 500 characters - 2000: Allow longer descriptions Note: Truncated text ends with '...'

Implementation Reference

  • Main handler function implementing the tool logic: extracts parameters like project_id, mr_iid, pagination options, and calls GitLabClient.get_merge_request_notes()
    def handle_get_merge_request_notes(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting merge request notes"""
        project_id = require_project_id(client, arguments)
        mr_iid = require_argument(arguments, "mr_iid")
        per_page = get_argument(arguments, "per_page", SMALL_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        sort = get_argument(arguments, "sort", "asc")
        order_by = get_argument(arguments, "order_by", "created_at")
        max_body_length = get_argument(arguments, "max_body_length", DEFAULT_MAX_BODY_LENGTH)
        
        return client.get_merge_request_notes(
            project_id, mr_iid, per_page, page, sort, order_by, max_body_length
        )
  • MCP tool schema definition specifying input parameters, types, defaults, enums, and requirements for validation.
    types.Tool(
        name=TOOL_GET_MR_NOTES,
        description=desc.DESC_GET_MR_NOTES,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": SMALL_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1},
                "sort": {"type": "string", "description": desc.DESC_SORT_ORDER, "enum": ["asc", "desc"], "default": "asc"},
                "order_by": {"type": "string", "description": desc.DESC_ORDER_BY, "enum": ["created_at", "updated_at"], "default": "created_at"},
                "max_body_length": {"type": "integer", "description": desc.DESC_MAX_BODY_LENGTH, "default": DEFAULT_MAX_BODY_LENGTH, "minimum": 0}
            },
            "required": ["mr_iid"]
        }
    ),
  • Maps the tool name constant to its handler function in the TOOL_HANDLERS dictionary used by server.call_tool()
    TOOL_GET_MR_NOTES: handle_get_merge_request_notes,
  • Constant definition of the canonical tool name string used across the codebase.
    TOOL_GET_MR_NOTES = "gitlab_get_merge_request_notes"
  • Tool registration in server.list_tools() which provides the schema to MCP clients at runtime.
        name=TOOL_GET_MR_NOTES,
        description=desc.DESC_GET_MR_NOTES,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID},
                "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": SMALL_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1},
                "sort": {"type": "string", "description": desc.DESC_SORT_ORDER, "enum": ["asc", "desc"], "default": "asc"},
                "order_by": {"type": "string", "description": desc.DESC_ORDER_BY, "enum": ["created_at", "updated_at"], "default": "created_at"},
                "max_body_length": {"type": "integer", "description": desc.DESC_MAX_BODY_LENGTH, "default": DEFAULT_MAX_BODY_LENGTH, "minimum": 0}
            },
            "required": ["mr_iid"]
        }
    ),
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 key traits: it's a read operation (implied by 'List'), includes pagination details ('Yes (default 10 per page)'), sorting options ('By created_at or updated_at'), and provides an example response structure. However, it doesn't mention rate limits, authentication needs, or error handling, leaving some gaps for a tool with 7 parameters.

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: it starts with the core purpose, followed by key behavioral details (returns, use when, pagination, sorting), an example response, and related tools. Each section is brief and informative, with no wasted sentences. The formatting (bulleted lists in the response) enhances readability without verbosity.

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 complexity (7 parameters, no annotations, no output schema), the description is largely complete: it covers purpose, usage, pagination, sorting, and provides an example response. However, it lacks details on error cases, rate limits, or authentication requirements, which are important for a read operation in a GitLab context. The example response helps but doesn't fully substitute for an output schema.

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 schema already documents all 7 parameters thoroughly. The description adds no specific parameter semantics beyond what's in the schema (e.g., it doesn't explain how 'max_body_length' interacts with the example response). This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't compensate with additional insights.

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 starts with a clear verb ('List') and resource ('merge request comments'), specifying the exact scope. It distinguishes from sibling tools like 'gitlab_get_merge_request_discussions' by noting it returns an array of notes/comments, not threaded discussions, and from 'gitlab_add_merge_request_comment' by being a read operation. This is specific and avoids tautology.

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 states 'Use when: Reading MR discussions, reviews', providing clear context for when to invoke this tool. It also lists related tools with brief distinctions (e.g., 'gitlab_get_merge_request_discussions: Threaded discussions'), guiding the agent on alternatives. This offers explicit guidance on when to use this tool versus others.

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