Skip to main content
Glama

gitlab_list_merge_requests

Retrieve merge requests from a GitLab project based on scope and state. Use this to filter requests by creation, assignment, or status (opened, closed, locked, merged).

Instructions

List merge requests in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe ID or URL-encoded path of the project
scopeNoReturn merge requests for the specified scope (created_by_me, assigned_to_me, all)
stateNoReturn merge requests with specified state (opened, closed, locked, merged)

Implementation Reference

  • The handler function that implements the gitlab_list_merge_requests tool. It validates input, calls the GitLab API to list merge requests for the given project, and formats the response.
    export const listMergeRequests: ToolHandler = async (params, context) => {
      const { project_id, state, scope } = params.arguments || {};
      if (!project_id) {
        throw new McpError(ErrorCode.InvalidParams, 'project_id is required');
      }
      
      const response = await context.axiosInstance.get(
        `/projects/${encodeURIComponent(String(project_id))}/merge_requests`,
        { params: { state, scope } }
      );
      return formatResponse(response.data);
    };
  • The input schema definition for the gitlab_list_merge_requests tool, specifying parameters like project_id, state, and scope.
    {
      name: 'gitlab_list_merge_requests',
      description: 'List merge requests in a GitLab project',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'The ID or URL-encoded path of the project'
          },
          state: {
            type: 'string',
            description: 'Return merge requests with specified state (opened, closed, locked, merged)',
            enum: ['opened', 'closed', 'locked', 'merged']
          },
          scope: {
            type: 'string',
            description: 'Return merge requests for the specified scope (created_by_me, assigned_to_me, all)',
            enum: ['created_by_me', 'assigned_to_me', 'all']
          }
        },
        required: ['project_id']
      }
    },
  • Registration of the gitlab_list_merge_requests tool in the central tool registry, mapping the tool name to its handler function.
    gitlab_list_merge_requests: repoHandlers.listMergeRequests,

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

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