Skip to main content
Glama

gitlab_list_merge_requests

List merge requests for a GitLab project to track code changes and review status. Specify the project path to retrieve open and pending merge requests.

Instructions

Lists merge requests for a given GitLab project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe path of the GitLab project (e.g., "namespace/project-name").

Implementation Reference

  • src/index.ts:149-162 (registration)
    Tool registration and input schema definition for gitlab_list_merge_requests
      name: 'gitlab_list_merge_requests',
      description: 'Lists merge requests for a given GitLab project.',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description:
              'The path of the GitLab project (e.g., "namespace/project-name").',
          },
        },
        required: ['projectPath'],
      },
    },
  • Handler logic in the MCP server that processes calls to gitlab_list_merge_requests by invoking the GitLab service
    case 'gitlab_list_merge_requests': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const { projectPath } = args as { projectPath: string };
      const result = await gitlabService.listMergeRequests(projectPath);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Helper method in GitLabService that performs the actual API call to list merge requests for the specified project
    async listMergeRequests(projectPath: string): Promise<GitLabMergeRequest[]> {
      const encodedProjectPath = encodeURIComponent(projectPath);
      return this.callGitLabApi<GitLabMergeRequest[]>(
        `projects/${encodedProjectPath}/merge_requests`,
      );
    }
  • Type definition for GitLabMergeRequest, the return type of the listMergeRequests method.
    export interface GitLabMergeRequest {
      id: number;
      iid: number;
      title: string;
      author: {
        name: string;
        username: string;
      };
      updated_at: string;
      web_url: string;
      project_name?: string;
    }

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/HainanZhao/mcp-gitlab-jira'

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