Skip to main content
Glama

list_merge_requests

Retrieve and filter merge requests from a GitLab project using criteria like state, branch, labels, assignee, or date ranges to manage code review workflows.

Instructions

List all merge requests in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or URL-encoded path
stateNoFilter merge requests by state
target_branchNoFilter by target branch
source_branchNoFilter by source branch
labelsNoComma-separated list of label names
milestoneNoMilestone title
assignee_idNoUser ID of assignee
author_idNoUser ID of author
searchNoSearch against title and description
created_afterNoReturn MRs created after date (ISO 8601)
created_beforeNoReturn MRs created before date (ISO 8601)
updated_afterNoReturn MRs updated after date (ISO 8601)
updated_beforeNoReturn MRs updated before date (ISO 8601)
sortNoSort merge requests
order_byNoSort order
pageNoPage number for pagination (default: 1)
per_pageNoNumber of results per page (default: 20)

Implementation Reference

  • The implementation of the 'listMergeRequests' handler function.
    export async function listMergeRequests(
      projectId: string,
      options: {
        state?: "opened" | "closed" | "locked" | "merged" | "all";
        target_branch?: string;
        source_branch?: string;
        labels?: string;
        milestone?: string;
        assignee_id?: number;
        author_id?: number;
        search?: string;
        created_after?: string;
        created_before?: string;
        updated_after?: string;
        updated_before?: string;
        sort?: "created_at" | "updated_at" | "title";
        order_by?: "asc" | "desc";
        page?: number;
        per_page?: number;
      } = {}
    ): Promise<GitLabMergeRequest[]> {
      if (!projectId?.trim()) {
        throw new Error("Project ID is required");
      }
    
      const endpoint = `/projects/${encodeProjectId(projectId)}/merge_requests`;
      const params = buildSearchParams(options);
    
      const mergeRequests = await gitlabGet<GitLabMergeRequest[]>(endpoint, params);
      return z.array(GitLabMergeRequestSchema).parse(mergeRequests);
    }
  • The Zod schema definition for the 'list_merge_requests' tool input.
    export const ListMergeRequestsSchema = z.object({
      project_id: z.string().describe("Project ID or URL-encoded path"),
      state: z.enum(["opened", "closed", "locked", "merged", "all"]).optional().describe("Filter merge requests by state"),
      target_branch: z.string().optional().describe("Filter by target branch"),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation (implying read-only), but doesn't mention pagination behavior, rate limits, authentication requirements, or what the output format looks like. For a tool with 17 parameters, this leaves significant gaps in understanding how it behaves.

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 a single, efficient sentence that states exactly what the tool does without any wasted words. It's appropriately sized and front-loaded with the essential information.

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

Completeness2/5

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

For a tool with 17 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, how pagination works, authentication requirements, or error conditions. The agent would need to guess about important behavioral aspects despite the comprehensive parameter 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 input schema has 100% description coverage, so all parameters are documented in the schema itself. The description adds no additional parameter information beyond what's in the schema. According to guidelines, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose4/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 ('merge requests in a GitLab project'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'list_issues' or 'search_issues', but the resource specificity is sufficient for basic clarity.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'search_issues' or 'list_issues', nor does it mention prerequisites or context for usage. It's a bare statement of function without any operational context.

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/TheRealChrisThomas/gitlab-mcp-server'

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