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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The ID or URL-encoded path of the project | |
| scope | No | Return merge requests for the specified scope (created_by_me, assigned_to_me, all) | |
| state | No | Return merge requests with specified state (opened, closed, locked, merged) |
Input Schema (JSON Schema)
{
"properties": {
"project_id": {
"description": "The ID or URL-encoded path of the project",
"type": "string"
},
"scope": {
"description": "Return merge requests for the specified scope (created_by_me, assigned_to_me, all)",
"enum": [
"created_by_me",
"assigned_to_me",
"all"
],
"type": "string"
},
"state": {
"description": "Return merge requests with specified state (opened, closed, locked, merged)",
"enum": [
"opened",
"closed",
"locked",
"merged"
],
"type": "string"
}
},
"required": [
"project_id"
],
"type": "object"
}
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); };
- src/utils/tools-data.ts:64-87 (schema)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'] } },
- src/utils/tool-registry.ts:27-27 (registration)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,