Skip to main content
Glama

gitlab_get_merge_request_discussions

Retrieve threaded discussion threads from GitLab merge requests to read and understand code review comments with structured conversation flow.

Instructions

Get MR discussion threads Returns: Threaded discussions with replies Use when: Reading code review comments Better than notes: Shows thread structure

Example response: [{ "id": "abc123...", "notes": [{ "body": "Should we use a different approach here?", "author": {"username": "reviewer"}, "resolvable": true, "resolved": false }, { "body": "Good point, let me refactor this.", "author": {"username": "author"} }] }]

Related tools:

  • gitlab_resolve_discussion: Mark resolved

  • gitlab_add_merge_request_comment: Reply

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

Implementation Reference

  • The core handler function that implements the gitlab_get_merge_request_discussions tool. It extracts parameters (project_id via detection or arg, mr_iid required, optional pagination), then delegates to GitLabClient.get_merge_request_discussions().
    def handle_get_merge_request_discussions(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting merge request discussions"""
        project_id = require_project_id(client, arguments)
        mr_iid = require_argument(arguments, "mr_iid")
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_merge_request_discussions(project_id, mr_iid, per_page, page)
  • Registers the handler function in the central TOOL_HANDLERS dictionary used by server.py to dispatch tool calls.
    TOOL_GET_MR_DISCUSSIONS: handle_get_merge_request_discussions,
  • Defines the tool schema including inputSchema with properties for project_id, mr_iid (required), per_page, page, and references description from tool_descriptions.
        name=TOOL_GET_MR_DISCUSSIONS,
        description=desc.DESC_GET_MR_DISCUSSIONS,
        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": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
            },
            "required": ["mr_iid"]
        }
    ),
  • Constant defining the exact tool name string used across the codebase for references, registrations, and tests.
    TOOL_GET_MR_DISCUSSIONS = "gitlab_get_merge_request_discussions"
  • Registers the tool schema directly in the MCP server's list_tools() handler, making it available to MCP clients.
        name="gitlab_get_merge_request_discussions",
        description=desc.DESC_GET_MR_DISCUSSIONS,
        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": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
            },
            "required": ["mr_iid"]
        }
    ),

Tool Definition Quality

Score is being calculated. Check back soon.

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