# List Merge Requests — GitLab

> List merge requests, filtered by project, group, state, author, assignee, reviewer, labels or target branch. Use this for any "what merge requests are …" question — open MRs in a project, MRs waiting on my review (set Scope to…

- Key: `gitlab-list-merge-requests`
- Type: Action (Read-only)
- Version: 0.0.1
- App: GitLab (`gitlab`) — https://pipedream.com/apps/gitlab.md
- This page (HTML): https://pipedream.com/apps/gitlab/actions/list-merge-requests
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/gitlab/actions/list-merge-requests/list-merge-requests.mjs

## Description

List merge requests, filtered by project, group, state, author, assignee, reviewer, labels or target branch. Use this for any "what merge requests are …" question — open MRs in a project, MRs waiting on my review (set **Scope** to `reviews_for_me`), MRs assigned to me, MRs targeting a release branch. Use **Search Merge Requests** instead when you have text to match against a title or description. Set **Project** to scope to one project, **Group** to scope to a whole group, or leave both blank to search across everything the authenticated user can see — note that with both blank GitLab defaults **Scope** to `created_by_me`, so pass `all` to widen it. Results are summarized by default; set **Detail** to `full` for the complete merge request objects. The returned `iid` is what every other merge request tool needs. [See the documentation](https://docs.gitlab.com/api/merge_requests/#list-merge-requests)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `projectId` | `string` | No | Limit results to this project, given as a path (group/project, e.g. backend/payments) or a numeric project ID. Leave blank to search across projects. Mutually exclusive with Group. |
| `groupId` | `string` | No | Limit results to every project in this group, given as a full path (e.g. backend) or a numeric group ID. Cannot be combined with Project — setting both is rejected. |
| `state` | `string` | No | Return merge requests in this state. Defaults to opened, which is what "open MRs" means. Use merged for MRs that have already landed and all to ignore state entirely. |
| `scope` | `string` | No | Narrow the results by the authenticated user's relationship to the merge request. reviews_for_me answers "what is waiting on my review?", assigned_to_me "what is assigned to me?", and created_by_me "what did I open?". Defaults to all. |
| `authorUsername` | `string` | No | Return only merge requests opened by this username (e.g. jdoe), not their display name. Use List Project Members to look up usernames. |
| `assigneeUsername` | `string` | No | Return only merge requests assigned to this username. |
| `reviewerUsername` | `string` | No | Return only merge requests where this username is a reviewer. None returns merge requests with no reviewer, Any those with any reviewer. To find what is waiting on the authenticated user, set Scope to reviews_for_me instead. |
| `labels` | `string[]` | No | Return only merge requests carrying all of these labels. None matches merge requests with no labels, Any those with at least one. |
| `targetBranch` | `string` | No | Return only merge requests targeting this branch (e.g. main, release/24.1). |
| `sourceBranch` | `string` | No | Return only merge requests originating from this branch. |
| `updatedAfter` | `string` | No | Return only merge requests updated on or after this time. ISO 8601, e.g. 2026-08-01T00:00:00Z. |
| `orderBy` | `string` | No | Field to order results by. Defaults to created_at. |
| `sort` | `string` | No | Sort direction. Defaults to desc (newest first). |
| `maxResults` | `integer` | No | Maximum number of records to return in total, paginating as needed. Defaults to 100. GitLab caps a single page at 100, so higher values mean multiple requests — keep it modest unless you need the whole list. |
| `detail` | `string` | No | How much of each record to return. summary (the default) returns the fields needed to identify and triage a merge request and is much cheaper to read. Use full only when you need a field the summary omits. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "gitlab",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "gitlab-list-merge-requests",
  arguments: {
    projectId: "Project",
    groupId: "Group",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "gitlab-list-merge-requests",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    gitlab: { authProvisionId: "apn_xxxxxxx" },
    projectId: "Project",
    groupId: "Group",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "gitlab-list-merge-requests",
    "configured_props": {
      "gitlab": { "authProvisionId": "apn_xxxxxxx" },
      "projectId": "Project",
      "groupId": "Group"
    }
  }'
```

---

- App: https://pipedream.com/apps/gitlab.md · All apps: https://pipedream.com/apps
