Skip to main content
Glama

gitlab_get_merge_request_discussions

Retrieve threaded discussions and replies from GitLab merge requests to streamline code review processes and track feedback efficiently.

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
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
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
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
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

Implementation Reference

  • Core handler function that extracts project_id, mr_iid, per_page, page from arguments (auto-detecting project if needed) and 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)
  • Pydantic/MCP input schema definition specifying required mr_iid (integer), optional project_id, pagination params with bounds and defaults
    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"] } ),
  • Registration of the handler function in the TOOL_HANDLERS dictionary mapping tool name constant to implementation
    TOOL_GET_MR_DISCUSSIONS: handle_get_merge_request_discussions,
  • Constant definition for the tool name string used in registration and schema
    TOOL_GET_MR_DISCUSSIONS = "gitlab_get_merge_request_discussions"

Other Tools

Related 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