Skip to main content
Glama

gitlab_list_merge_requests

Retrieve and filter merge requests from a GitLab project to review active changes, track progress, or find specific submissions using state-based filtering and pagination.

Instructions

List project merge requests Returns: Array of MRs with key information Use when: Reviewing MRs, finding specific MRs Filtering: By state (opened/closed/merged/all) Pagination: Yes (default 20 per page)

Example response: [{ "iid": 456, "title": "Add new feature", "state": "opened", "source_branch": "feature/new-feature", "target_branch": "main", "draft": false, "has_conflicts": false, "web_url": "https://gitlab.com/group/project/-/merge_requests/456" }]

Related tools:

  • gitlab_get_merge_request: Full MR details

  • gitlab_get_merge_request_changes: View diffs

  • gitlab_merge_merge_request: Merge an MR

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
stateNoMerge request state filter Type: string (enum) Options: 'opened' | 'closed' | 'merged' | 'all' Default: 'all' Examples: - 'opened' (active MRs needing review) - 'merged' (completed MRs) - 'closed' (abandoned MRs) - 'all' (everything) Use case: Focus on MRs needing attentionopened
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 main handler function that executes the tool logic: lists merge requests for a project by detecting or requiring project_id, then calling GitLabClient.get_merge_requests with state, pagination.
    def handle_list_merge_requests(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle listing merge requests"""
        project_id = require_project_id(client, arguments)
        state = get_argument(arguments, "state", "opened")
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_merge_requests(project_id, state, per_page, page)
  • Input schema definition for the tool, specifying parameters project_id, state (default 'opened'), per_page, page with types, descriptions, enums, defaults, and constraints.
    types.Tool(
        name=TOOL_LIST_MRS,
        description=desc.DESC_LIST_MRS,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "state": {"type": "string", "description": desc.DESC_STATE_MR, "enum": ["opened", "closed", "merged", "all"], "default": "opened"},
                "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}
            }
        }
    ),
  • Registration of the tool name to its handler function in the TOOL_HANDLERS dictionary, which is used by server.py.handle_call_tool to dispatch tool calls.
    TOOL_LIST_MRS: handle_list_merge_requests,
  • Constant defining the canonical tool name string used throughout the codebase for consistency.
    TOOL_LIST_MRS = "gitlab_list_merge_requests"
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it specifies the return type ('Array of MRs with key information'), filtering capability ('By state'), pagination behavior ('Yes (default 20 per page)'), and provides an example response structure. It doesn't mention authentication requirements or rate limits, but covers most operational aspects.

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 perfectly structured with clear sections: purpose statement, return type, usage context, filtering, pagination, example response, and related tools. Every sentence earns its place with zero waste, and information is front-loaded appropriately.

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?

For a list operation with no output schema, the description provides excellent context: it specifies the return format, includes a detailed example response, explains filtering and pagination behavior, and relates to sibling tools. The only minor gap is lack of explicit mention about authentication or error handling, but overall it's highly complete.

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?

Schema description coverage is 100%, so the schema already fully documents all 4 parameters. The description mentions filtering by state and pagination, which aligns with parameters but doesn't add meaningful semantic value beyond what the schema provides. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 verb ('List') and resource ('project merge requests'), and distinguishes from siblings by specifying it returns an array with key information rather than full details or diffs. The opening line 'List project merge requests' is specific and unambiguous.

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 'Use when: Reviewing MRs, finding specific MRs' and lists three related tools with their specific purposes ('Full MR details', 'View diffs', 'Merge an MR'), giving clear guidance on when to use this tool versus alternatives.

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